OEChemIsLicensed

bool OEChemIsLicensed(const char *feature=0, unsigned int *expdate=0)

Determines whether a valid license file is present. This function may be called without a legitimate run-time license to determine whether it is safe to call any OEChem TK, OESystem TK or OEPlatform TK functionality.

The ‘features’ argument can be used to check for a valid license to OEChem TK along with that feature, such as ‘python’, ‘java’ or ‘clr’ (for Csharp). For example, to verify that OEChem TK can be used:

       if (!oechem.OEChemIsLicensed("java"))
           oechem.OEThrow.Warning("OEChem is not licensed for the Java feature.");

The second argument can be used to get the expiration date of the license. This is an array of size three with the date returned as {day, month, year}. Even if the function returns false due to an expired license, the ‘expdate’ will show that expiration date. A value of a zeroes implies that no license or date was found.

       OEUIntArray expdate = new OEUIntArray(3);
       if (oechem.OEChemIsLicensed("java", expdate))
       {
           oechem.OEThrow.Info("License expires: day: " + expdate.getItem(0) + " month: " 
                               + expdate.getItem(1) + " year: " + expdate.getItem(2));
       }