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 key
    • release() - Releases the current license
  • License status queries
    • isValid() - Checks if the license is currently valid
    • hasExpired() - Checks if the license has expired
    • isPerpetual() - Checks if the license is perpetual
  • Feature availability
    • hasAccessFeature() - Checks if the license has access feature enabled
    • hasMeshFeature() - Checks if the license has mesh feature enabled
    • hasSolveFeature() - Checks if the license has solve feature enabled
  • License information
    • getCustomerName() - Retrieves the customer name from the license
    • getExpiryDate() - 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.