Salome HOME
Upgrade to new MG license mechanism and keep compatibility with old ones
[modules/smesh.git] / src / SMESHUtils / SMESH_MGLicenseKeyGen.hxx
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File      : SMESH_MGLicenseKeyGen.hxx
20 // Created   : Sat Jul 31 18:41:04 2021
21 // Author    : Edward AGAPOV (OCC)
22
23 #ifndef __SMESHUtils_MGLicenseKeyGen_HXX__
24 #define __SMESHUtils_MGLicenseKeyGen_HXX__
25
26 #include "SMESH_Utils.hxx"
27
28 #include <string>
29
30 #define MESHGEMS_215 (2 << 16 | 15 << 8 | 0)
31
32 /*!
33  * \brief Manage loading libSalomeMeshGemsKeyGenerator.[so|dll] and sing MeshGems CAD or mesh
34  */
35
36 namespace SMESHUtils_MGLicenseKeyGen
37 {
38   // MeshGems 2.13, 2.14 (for CADSurf)
39   SMESHUtils_EXPORT bool        SignCAD( void* meshgems_cad, std::string& error );
40
41   // MeshGems 2.13, 2.14 (for products launched as library)
42   SMESHUtils_EXPORT bool        SignMesh( void* meshgems_mesh, std::string& error );
43
44   // MeshGems 2.13, 2.14 and 2.15 (for products launched as executables)
45   SMESHUtils_EXPORT std::string GetKey(const std::string& gmfFile,
46                                        int                nbVertex,
47                                        int                nbEdge,
48                                        int                nbFace,
49                                        int                nbVol,
50                                        std::string&       error);
51
52   // MeshGems 2.15 (for products launched as library)
53   SMESHUtils_EXPORT std::string GetKey( std::string& error );
54
55   SMESHUtils_EXPORT bool        CheckKeyGenLibrary( std::string& error );
56
57   SMESHUtils_EXPORT std::string GetLibraryName();
58
59   SMESHUtils_EXPORT int         GetMGVersionHex(std::string& error);
60   SMESHUtils_EXPORT bool        NeedsMGSpatialEnvLicense(std::string& error);
61   SMESHUtils_EXPORT bool        SetMGSpatialEnvLicense(std::string& error);
62 }
63
64 #endif