Version: 9.16.0
SMESHUtils_MGLicenseKeyGen Namespace Reference

Manage loading libSalomeMeshGemsKeyGenerator. More...

Functions

bool SignCAD_After (void *meshgems_cad, std::string &error)
 Sign a CAD. More...
 
bool UnlockProduct (const std::string &product, std::string &error)
 Unlock a specific MeshGems product (for products called as a library) More...
 
bool SignCAD (void *meshgems_cad, std::string &error)
 Sign a CAD (or don't do it if env MESHGEMS_OLD_STYLE is set) More...
 
bool SignMesh_After (void *meshgems_mesh, std::string &error)
 Sign a mesh. More...
 
bool SignMesh (void *meshgems_mesh, const std::string &product, std::string &error)
 Sign a mesh (or don't do it if env MESHGEMS_OLD_STYLE is set) More...
 
std::string GetKey_After (const std::string &gmfFile, int nbVertex, int nbEdge, int nbFace, int nbVol, std::string &error)
 Return a license key to pass as argument to a MG mesher executable. More...
 
std::string GetKey_After (std::string &error)
 Return a license key to pass as argument to a MG mesher executable (>2.15) More...
 
int GetMGVersionFromEnv (const char *env_variable)
 Get MeshGems version major/minor/patch from the environment variables. More...
 
int GetMGVersionFromFunction (const char *function_name)
 Get MeshGems version major/minor/patch from the keygen library and meshgems built-in functions. More...
 
int GetMGVersionHex (std::string &error)
 Get MeshGems version from the keygen library or meshgems built-in functions. More...
 
bool NeedsMGSpatialEnvLicense (std::string &error)
 Guess if the Spatial license is needed (if MeshGems is > 2.15.0) More...
 
bool SetMGSpatialEnvLicense (std::string &error)
 Set the SPATIAL_LICENSE environment variable. More...
 
std::string GetKey (const std::string &gmfFile, int nbVertex, int nbEdge, int nbFace, int nbVol, std::string &error)
 Get the license key from libMeshGemsKeyGenerator.so or $SPATIAL_LICENSE Called by plugins calling MG products as executables. More...
 
std::string GetKey (std::string &error)
 Get the license key from libMeshGemsKeyGenerator.so or $SPATIAL_LICENSE Called for MG 2.15 by CADSurf and MG plugins calling MG products as library, i.e. More...
 
bool CheckKeyGenLibrary (std::string &error)
 Return false if libMeshGemsKeyGenerator.so is not functional. More...
 
std::string GetLibraryName ()
 Return KeyGenerator library name. More...
 

Detailed Description

Manage loading libSalomeMeshGemsKeyGenerator.

[so|dll] and sing MeshGems CAD or mesh

Function Documentation

◆ CheckKeyGenLibrary()

bool SMESHUtils_MGLicenseKeyGen::CheckKeyGenLibrary ( std::string &  error)

Return false if libMeshGemsKeyGenerator.so is not functional.

Parameters
[out]error- return error description
Returns
bool - is a success

References GetKey().

◆ GetKey() [1/2]

std::string SMESHUtils_MGLicenseKeyGen::GetKey ( const std::string &  gmfFile,
int  nbVertex,
int  nbEdge,
int  nbFace,
int  nbVol,
std::string &  error 
)

Get the license key from libMeshGemsKeyGenerator.so or $SPATIAL_LICENSE Called by plugins calling MG products as executables.

If MESHGEMS_OLD_STYLE is set, return "0", to use old DLIM8 server license instead of the key.

Parameters
[in]gmfFile- path to an input mesh file
[in]nb*- nb of entities in the input mesh
[out]error- return error description
Returns
std::string - the key

References GetKey_After(), MESHGEMS_OLD_STYLE, MESSAGE, NeedsMGSpatialEnvLicense(), SetMGSpatialEnvLicense(), and SPATIAL_LICENSE.

Referenced by CheckKeyGenLibrary(), MG_ADAPT::MgAdapt::getCommandToRun(), GetMGLicenseKeyImpl(), and SetMGSpatialEnvLicense().

◆ GetKey() [2/2]

std::string SMESHUtils_MGLicenseKeyGen::GetKey ( std::string &  error)

Get the license key from libMeshGemsKeyGenerator.so or $SPATIAL_LICENSE Called for MG 2.15 by CADSurf and MG plugins calling MG products as library, i.e.

compiled as library with -DSALOME_USE_MG_LIBS=ON

Parameters
[out]error- return error description
Returns
std::string - the key

References GetKey_After(), MESHGEMS_OLD_STYLE, MESSAGE, and SPATIAL_LICENSE.

◆ GetKey_After() [1/2]

std::string SMESHUtils_MGLicenseKeyGen::GetKey_After ( const std::string &  gmfFile,
int  nbVertex,
int  nbEdge,
int  nbFace,
int  nbVol,
std::string &  error 
)

Return a license key to pass as argument to a MG mesher executable.

Parameters
[in]gmfFile- path to an input mesh file
[in]nb*- nb of entities in the input mesh
[out]error- return error description
Returns
std::string - the key

References GetProc.

Referenced by GetKey().

◆ GetKey_After() [2/2]

std::string SMESHUtils_MGLicenseKeyGen::GetKey_After ( std::string &  error)

Return a license key to pass as argument to a MG mesher executable (>2.15)

Parameters
[out]error- return error description
Returns
std::string - the key

References GetProc.

◆ GetLibraryName()

std::string SMESHUtils_MGLicenseKeyGen::GetLibraryName ( )

Return KeyGenerator library name.

◆ GetMGVersionFromEnv()

int SMESHUtils_MGLicenseKeyGen::GetMGVersionFromEnv ( const char *  env_variable)

Get MeshGems version major/minor/patch from the environment variables.

Parameters
[out]error- return error description
Returns
int - the version

References MESSAGE.

Referenced by GetMGVersionHex().

◆ GetMGVersionFromFunction()

int SMESHUtils_MGLicenseKeyGen::GetMGVersionFromFunction ( const char *  function_name)

Get MeshGems version major/minor/patch from the keygen library and meshgems built-in functions.

Parameters
[out]error- return error description
Returns
int - the function implemented in the library

References GetProc, and MESSAGE.

Referenced by GetMGVersionHex().

◆ GetMGVersionHex()

int SMESHUtils_MGLicenseKeyGen::GetMGVersionHex ( std::string &  error)

Get MeshGems version from the keygen library or meshgems built-in functions.

Parameters
[out]error- return error description
Returns
int - the version

References GetMGVersionFromEnv(), GetMGVersionFromFunction(), and MESSAGE.

Referenced by NeedsMGSpatialEnvLicense().

◆ NeedsMGSpatialEnvLicense()

bool SMESHUtils_MGLicenseKeyGen::NeedsMGSpatialEnvLicense ( std::string &  error)

Guess if the Spatial license is needed (if MeshGems is > 2.15.0)

Parameters
[out]error- return error description
Returns
bool - true if MeshGems is > 2.15.0

References GetMGVersionHex(), MESHGEMS_215, and MESSAGE.

Referenced by GetKey(), SignCAD(), and SignMesh().

◆ SetMGSpatialEnvLicense()

bool SMESHUtils_MGLicenseKeyGen::SetMGSpatialEnvLicense ( std::string &  error)

Set the SPATIAL_LICENSE environment variable.

Parameters
[out]error- return error description
Returns
bool - true in case of success

References GetKey(), MESSAGE, and SPATIAL_LICENSE.

Referenced by GetKey().

◆ SignCAD()

bool SMESHUtils_MGLicenseKeyGen::SignCAD ( void *  meshgems_cad,
std::string &  error 
)

Sign a CAD (or don't do it if env MESHGEMS_OLD_STYLE is set)

Parameters
[in]meshgems_cad- pointer to a MG CAD object (meshgems_cad_t)
[out]error- return error description
Returns
bool - is a success

References MESHGEMS_OLD_STYLE, NeedsMGSpatialEnvLicense(), SignCAD_After(), and UnlockProduct().

◆ SignCAD_After()

bool SMESHUtils_MGLicenseKeyGen::SignCAD_After ( void *  meshgems_cad,
std::string &  error 
)

Sign a CAD.

Parameters
[in]meshgems_cad- pointer to a MG CAD object (meshgems_cad_t)
[out]error- return error description
Returns
bool - is a success

References GetProc, SMESH::returnError(), SMESH_CATCH, and SMESH_TRY.

Referenced by SignCAD().

◆ SignMesh()

bool SMESHUtils_MGLicenseKeyGen::SignMesh ( void *  meshgems_mesh,
const std::string &  product,
std::string &  error 
)

Sign a mesh (or don't do it if env MESHGEMS_OLD_STYLE is set)

Parameters
[in]meshgems_mesh- pointer to a MG mesh (meshgems_mesh_t)
[in]product- product of MeshGems to unlock
[out]error- return error description
Returns
bool - is a success

References MESHGEMS_OLD_STYLE, NeedsMGSpatialEnvLicense(), SignMesh_After(), and UnlockProduct().

◆ SignMesh_After()

bool SMESHUtils_MGLicenseKeyGen::SignMesh_After ( void *  meshgems_mesh,
std::string &  error 
)

Sign a mesh.

Parameters
[in]meshgems_mesh- pointer to a MG mesh (meshgems_mesh_t)
[out]error- return error description
Returns
bool - is a success

References GetProc, SMESH::returnError(), SMESH_CATCH, and SMESH_TRY.

Referenced by SignMesh().

◆ UnlockProduct()

bool SMESHUtils_MGLicenseKeyGen::UnlockProduct ( const std::string &  product,
std::string &  error 
)

Unlock a specific MeshGems product (for products called as a library)

Parameters
[in]product- product of MeshGems to unlock
[out]error- return error description
Returns
bool - is a success

References GetProc, MESSAGE, SMESH::returnError(), SMESH_CATCH, and SMESH_TRY.

Referenced by SignCAD(), and SignMesh().