AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
Runtime.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/macros.h>
20#include <agx/config/AGX_LAAS_ENABLE.h>
21
22#ifdef STANDALONE_RUNTIME
23
24#ifdef AGX_LAAS_ENABLE
25#undef AGX_LAAS_ENABLE
26#endif
27
28#define AGX_LAAS_ENABLE() 0
29
30#include <map>
31#include <vector>
32#include <string>
33
34#else
35
36#include <agx/agx.h>
37#include <agx/Singleton.h>
38#include <agx/String.h>
39#include <agx/HashTable.h>
40
41#endif
42
43
44namespace agx {
45
47
48 #ifdef STANDALONE_RUNTIME
49 typedef std::string String;
50 #endif
52
53
54
63
64
73 #ifdef STANDALONE_RUNTIME
74 class Runtime {
75 #else
77 #endif
78
79 public:
80
82 NIC = 1,
83 USB = 2,
84 HDD = 3
85 };
86
87
88 #ifdef STANDALONE_RUNTIME
89 typedef std::vector< UniqueIdStruct > UniqueIdVector;
90 #else
92 #endif
93
95 static Runtime* instance();
96
98 static bool isInitialized();
99
100
104 static agx::String generateMD5( const agx::String& deviceID );
105
106
107 #if AGX_LAAS_ENABLE()
108
111
112
121 bool loadLicenseFile( const agx::String& licPath, bool forceRefresh = false );
122
123
135 bool loadLicenseString( const agx::String& licenseContents, bool forceRefresh = false );
136
141
149
150
158 bool activateAgxLicense( int licenseId, const agx::String& activationPassword );
159
160
170 bool activateAgxLicense( int licenseId, const agx::String& activationPassword, const agx::String& outputLicenseFile );
171
172
176 agx::String generateOfflineActivationRequest(int licenseId, const agx::String& activationPassword );
177
182 bool processOfflineActivationRequest(const agx::String& activationResponse);
183
190
191
192
206 bool openNetworkSession(const agx::String& licenseFile = "floating.lfx" );
207
215
220 bool isFloatingLicense() const;
221
222
234 const agx::String& runtimeLicensePassword,
235 const agx::String& applicationFilename ) const;
236
244 bool activateEncryptedRuntime( const agx::String& encryptedRuntimeData,
245 const agx::String& outputLicenseFile );
247 #endif
248
249
250
253
258
259
260 #ifndef STANDALONE_RUNTIME
261
262
274 bool unlock(const char* licenseString);
275
276 bool unlock( const agx::String& licenseString);
277
278
291 bool verifyAndUnlock( const char* licenseStr );
292
297 bool hasKey( const char* key ) const;
298
302 const agx::String& readValue( const char* key ) const;
303
305
306
307
310
315 bool isValid() const;
316
321 const agx::String& getStatus() const;
322
327
328
333 bool isModuleEnabled( const char* name ) const;
334
339
341
342
354 bool checkVersion(const agx::String& versionString, int generation, int major=-1, int minor=-1, int patch=-1);
355
356
357 SINGLETON_CLASSNAME_METHOD();
358 #endif
359
360 #ifndef STANDALONE_RUNTIME
362 virtual void shutdown() override;
363 #else
364 void shutdown();
365 #endif
366
370 void clear();
371
372 protected:
374
375 virtual ~Runtime();
376
377 private:
378 static Runtime *s_instance;
379
380 #ifndef STANDALONE_RUNTIME
382
383 #if AGX_LAAS_ENABLE()
384 bool readLaasLicense();
385 #endif
386
387
388 bool readAgxLicense();
389 bool validate();
390
391 void fillTable( void* ptr );
392
393
394
395
396 StringTable m_table;
397
398 agx::StringVector m_modules;
399
400 agx::String m_status; // Contains status information
401 agx::String m_extendedStatus; //
402
403 bool m_valid;
404 #endif
405
406 UniqueIdVector m_uniqueIds;
407 };
408
409
410}
411
#define AGXPHYSICS_EXPORT
Inheritance with partial specialization due to bug with ref_ptr containers.
The Runtime class will read a license file upon creation and check what configuration is allowed to r...
Definition Runtime.h:76
agx::String encryptRuntimeActivation(int runtimeLicenseId, const agx::String &runtimeLicensePassword, const agx::String &applicationFilename) const
Encrypt license id and password for runtime activation.
static Runtime * instance()
Singleton instance method.
agx::String readEncryptedLicense()
Read the encrypted license, normally the contents from the license file.
const agx::String & getExtendedStatus() const
Provides optional extended status information about why license validation failed.
bool hasKey(const char *key) const
bool processOfflineActivationRequest(const agx::String &activationResponse)
Processes the response from a manual activation request.
bool isModuleEnabled(const char *name) const
Check if a named AGX module is enabled.
bool openNetworkSession(const agx::String &licenseFile="floating.lfx")
Try to open a network session using the specified floating license.
agx::Vector< UniqueIdStruct > UniqueIdVector
Definition Runtime.h:91
bool deactivateAgxLicense()
Deactivate the currently loaded license if the license type allows it.
bool unlock(const char *licenseString)
Will try to unlock AGX with the license provided in licenseString.
virtual void shutdown() override
Singleton cleanup method.
bool activateAgxLicense(int licenseId, const agx::String &activationPassword)
Perform online activation of AGX.
const agx::StringVector & getEnabledModules() const
bool checkVersion(const agx::String &versionString, int generation, int major=-1, int minor=-1, int patch=-1)
Version string can be one of two variants:
const agx::String & getStatus() const
Provides status information if license validation failed.
static agx::String generateMD5(const agx::String &deviceID)
Utility method using agxStream::MD5Checksum::getMD5.
static bool isInitialized()
bool isValid() const
bool unlock(const agx::String &licenseString)
bool closeNetworkSession()
Close the active network session.
agx::String generateOfflineActivationRequest(int licenseId, const agx::String &activationPassword)
Generates an activation request for a machine that does not have Internet access.
bool isLicenseRefreshed()
Check if license was refreshed upon loading.
virtual ~Runtime()
const UniqueIdVector & getUniqueIds() const
bool activateAgxLicense(int licenseId, const agx::String &activationPassword, const agx::String &outputLicenseFile)
Perform online activation of AGX.
void clear()
Clear any previously loaded license.
const agx::String & readValue(const char *key) const
bool loadLicenseString(const agx::String &licenseContents, bool forceRefresh=false)
Load a license but provided as a string instead of read from a file.
bool verifyAndUnlock(const char *licenseStr)
Unlock AGX Dynamics using obfuscated license string.
bool isFloatingLicense() const
Query licensetype.
bool loadLicenseFile(const agx::String &licPath, bool forceRefresh=false)
Load a License file that was created by activating AGX.
bool activateEncryptedRuntime(const agx::String &encryptedRuntimeData, const agx::String &outputLicenseFile)
Perform online activation of an encrypted runtime license.
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...
Definition Singleton.h:31
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AgXString< std::string > String
Definition String.h:427
struct agx::UniqueIdStruct_ UniqueIdStruct
Struct holding information about a Unique Id.
void AGXPHYSICS_EXPORT shutdown()
Shutdown of the AGX Dynamics API will be done when the number of shutdown matches the number of calls...
Struct holding information about a Unique Id.
Definition Runtime.h:57
unsigned int type
Definition Runtime.h:61
agx::String id
Definition Runtime.h:58
agx::String raw
Definition Runtime.h:59
agx::String comment
Definition Runtime.h:60