KCMS CMM Developer's Guide

Examples

The following example shows you how to use the entry points when creating a KcsProfileFormat derivative.


Example 6-1 KcsProfileFormat Class Entry Points Example

extern long KcsDLOpenPfmtCount = 0;  

/* Global initialization - constructor can be used */ 
KcsStatus 
KcsInitPfmt(long libMajor, long libMinor, long *myMajor, long *myMinor) 
{
     // Set up the return values
     *myMajor = KCS_MAJOR_VERSION;
     *myMinor = KCS_MINOR_VERSION;

     //Check the major version
     if (libMajor != KCS_MAJOR_VERSION)
         return (KCS_CMM_MAJOR_VERSION_MISMATCH);

     //Currently, if minor version of library is less than the KCMS
     // minor version, return an error.
     if (libMinor != KCS_MINOR_VERSION)
         return (KCS_CMM_MINOR_VERSION_MISMATCH);

     //Library guarantees if your minor version number is greater than
     //KCMS minor version number, it will handle it. No more init.
     return(KCS_SUCCESS); 
}  

/* Clean up global initialization */ 
KcsStatus 
KcsCleanupPfmt() 
{
     KcsStatus sStat;
     return(KCS_SUCCESS); 
}  

/* Create a profile format derivative based on information passed in,  
* there is profile data associated with it. Corresponds to the  
* KcsCreateProfile() API call. */ 
KcsProfileFormat * 
KcsCreatePfmtBlnk(KcsStatus *aStat, KcsId aCmmId,
      KcsVersion aCmmVersion, KcsId aProfId, KcsVersion aProfileVersion) 
{
     //Create the new derivative
     return(new KcsProfileFormatInterColor3_0(aStat, aCmmId,
          aCmmVersion, aProfId, aProfileVersion)); 
}  

/* Create a profile format derivative using the supplied IO.  
* Corresponds to the KcsLoadProfile() API call. */ 
KcsProfileFormat * KcsCreatePfmt(KcsStatus *aStat, KcsIO *aIO) 
{
     //Create the new derivative
     return(new KcsProfileFormatInterColor3_0(aStat, aIO));
}