License
Overview
The license functions provide functionality for validating and querying HOOPS Access license information. These functions allow you to validate license keys, check license status, query available features, and retrieve license details such as customer name and expiry date.
License Functions
The license module provides the following functionality:
- License validation and management
validate()- Validates the provided license keyrelease()- Releases the current license
- License status queries
isValid()- Checks if the license is currently validhasExpired()- Checks if the license has expiredisPerpetual()- Checks if the license is perpetual
- Feature availability
hasAccessFeature()- Checks if the license has access feature enabledhasMeshFeature()- Checks if the license has mesh feature enabledhasSolveFeature()- Checks if the license has solve feature enabled
- License information
getCustomerName()- Retrieves the customer name from the licensegetExpiryDate()- Retrieves the expiry date from the license
Usage
Validating a License
To use HOOPS Access, you must first validate a license key:
#include "samcpp/core/license.h"
const char* licenseKey = "your-license-key-here";
auto status = cae::core::license::validate(licenseKey);
if (!status) {
std::cerr << "License validation failed: " << status.getErrorMessage() << std::endl;
return -1;
}
Checking License Status
You can query the license status to verify it is valid and check its properties:
int isValid = 0;
cae::core::license::isValid(&isValid);
if (isValid) {
int hasExpired = 0;
cae::core::license::hasExpired(&hasExpired);
if (hasExpired) {
std::cout << "License has expired" << std::endl;
}
}
Checking Feature Availability
Before using specific HOOPS Access features, verify they are enabled in your license:
int hasMesh = 0;
cae::core::license::hasMeshFeature(&hasMesh);
if (hasMesh) {
// Proceed with mesh operations
} else {
std::cerr << "Mesh feature not available in license" << std::endl;
}
Retrieving License Information
You can retrieve license details such as customer name and expiry date:
char* customerName = nullptr;
int nameSize = 0;
cae::core::license::getCustomerName(&customerName, &nameSize);
if (customerName) {
std::cout << "Licensed to: " << customerName << std::endl;
}
char* expiryDate = nullptr;
int dateSize = 0;
cae::core::license::getExpiryDate(&expiryDate, &dateSize);
if (expiryDate) {
std::cout << "License expires: " << expiryDate << std::endl;
}
Releasing the License
When finished with HOOPS Access operations, release the license:
cae::core::license::release();
Members Descriptions
The currently available license functions are described in the following sections.
-
Status
cae::core::license::validate(const char *licenseKey) Validates the provided license key and activates the license for use with SAM.
Parameters: licenseKey – The license key string to validate. Returns: Status. NONEif successful.
-
Status
cae::core::license::release() Releases the current license and frees associated resources.
Returns: Status. NONEif successful.
-
Status
cae::core::license::isValid(int *isValidFlag) Checks if the license is currently valid and active.
Parameters: isValidFlag – Pointer to integer flag that will be set to 1 if valid, 0 otherwise. Returns: Status. NONEif successful.
-
Status
cae::core::license::hasExpired(int *hasExpiredFlag) Checks if the license has expired beyond its validity period.
Parameters: hasExpiredFlag – Pointer to integer flag that will be set to 1 if expired, 0 otherwise. Returns: Status. NONEif successful.
-
Status
cae::core::license::isPerpetual(int *isPerpetualFlag) Checks if the license is perpetual (never expires) or time-limited.
Parameters: isPerpetualFlag – Pointer to integer flag that will be set to 1 if perpetual, 0 otherwise. Returns: Status. NONEif successful.
-
Status
cae::core::license::hasAccessFeature(int *hasFeature) Checks if the license has the access feature enabled.
Parameters: hasFeature – Pointer to integer flag that will be set to 1 if enabled, 0 otherwise. Returns: Status. NONEif successful.
-
Status
cae::core::license::hasMeshFeature(int *hasFeature) Checks if the license has the mesh feature enabled.
Parameters: hasFeature – Pointer to integer flag that will be set to 1 if enabled, 0 otherwise. Returns: Status. NONEif successful.
-
Status
cae::core::license::hasSolveFeature(int *hasFeature) Checks if the license has the solve feature enabled.
Parameters: hasFeature – Pointer to integer flag that will be set to 1 if enabled, 0 otherwise. Returns: Status. NONEif successful.
-
Status
cae::core::license::getCustomerName(char **customerName, int *customerNameSize) Retrieves the customer name from the license information.
Parameters: - customerName – Pointer to char pointer that will receive the customer name string.
- customerNameSize – Pointer to integer that will receive the string size.
Returns:
-
Status
cae::core::license::getExpiryDate(char **expiryDate, int *expiryDataSize) Retrieves the expiry date from the license information.
Parameters: - expiryDate – Pointer to char pointer that will receive the expiry date string.
- expiryDataSize – Pointer to integer that will receive the string size.
Returns: