KCMS CMM Reference Manual

Chapter 4 KcsLoadable Class

This chapter describes the KcsLoadable class. This base class provides the basic functionality required to create a dynamically loadable CMM. The classes derived from this class (KcsProfile, KcsProfileFormat, and KcsXform) provide functionality to create your own color profiles. The KcsLoadable class is derived from the KcsShareable class. See Chapter 1, KcsShareable Class for a description of the KcsShareable class.

As you read this chapter, you will find it helpful to have access to the following header files:

Note -

It is highly recommended that you do not use any of the variables and functions for handle-based memory in these header files. Handle-based memory is not required on the Solaris system.

The constant and #define identifiers for this class are defined in the kcsload.h header file as:

const KcsId KcsRlocLoadId = {(0x4C6f6164UL)}; /* 'Load' */
#define KcsRlocLoadIdd (0x4C6f6164UL) /* 'Load' */

In addition to the KcsShareable methods overridden by this class, there are methods for dynamically loading your CMM. The protected and public members are described.

Public Members

The KcsLoadable class provides the following public members.

Table 4-1 KcsLoadable Public Members

Public Member 


typedef KcsStatus (*KCS_FUNC_INIT_PTR)
 	(long, long, long *, long *);


virtual KcsShareable * 
attach(long aHowMany = 1,
 	KcsAttachType aAttachFlag = KcsAttMem,
 	KcsStatus *aStatus = NULL);

Calls changePermanentUseCount().

If aAttachflag = KcsMemFile, also calls KcsShareable::attach().

Returns pointer to the object. 

virtual long 
changePermanentUseCount(KcsStatus *aStatus,
 	long aDelta);

Increments or decrements permanent use count of a particular chunk set/chunk Id entry in the unique identifier (UID) map table. Calls KcsChunkSet::updateChunkUseCount() to update the chunk map. Returns new use count.

static KcsStatus
deleteChunkSetsUIDMapEntries(KcsChunkSet *aCS);

Deletes all the entries in the UID map table associated with a particular chunk set. 

virtual void
dettach(long aHowMany = 1,
 	KcsAttachType aDettachFlag = KcsAttMem,
 	KcsStatus *aStatus = NULL);

If a chunk Id is illegal, searches the UID map table for the chunk Id. Changes permanent use count. If permanent use count == 0, deletes chunk from file. Calls KcsShareable::dettach().

virtual KcsChunkId 
getChunkId(KcsStatus *aStatus, KcsChunkSet *aCS);

Looks in the UID map table and returns the chunk Id associated with this object and aCS. If no entry is found in the UID map table, it returns KCS_OBJMAP_ENTRY_NOT_FOUND and KcsIllegalChunkId.

virtual KcsChunkId getChunkId();

Very useful function; returns the chunk Id portion of the UID associated with this object.  

virtual KcsChunkSet *getChunkSet();

Very useful function; returns the chunk set portion of the UID associated with this object. 

static KcsLoadable *
getObjFromUIDMap(KcsStatus *aStatus,
 	KcsChunkSet *aCS, KcsChunkId aChunkId);

Checks if object identified by this chunk set and chunk Id is instantiated. If object is in UID map table, it returns a pointer to the object; else it returns NULL.

virtual KcsStatus isLoadable();

Returns KcsSuccess if the loadable object can load and regenerate itself.

virtual long isLoaded();

Returns non-zero if the state of the loadable object is loaded.  

KcsLoadable(KcsStatus *);


KcsLoadable(KcsChunkSet *, KcsChunkId,
 	KcsStatus *);

Constructor that instantiates a loadable based on a UID that is a combination of KcsChunkSet and KcsChunkId.


Destructor. Deallocates all resources associated with specified instance. 

virtual KcsStatus 
load(const KcsLoadHints aLoadHints =
 	KcsCallbackFunction aCallback = NULL);

Regenerates all necessary state from the static store associated with the aLoadHints.

putObjIntoUIDMap(KcsChunkSet *aCS,
 	KcsChunkId aChunkId);

Puts the object identified by this chunk set and chunk Id in the UID map table. Returns a pointer to the object. 

virtual KcsStatus save()

Saves all object state information to its static store. 

KcsStatus save(KcsChunkSet *, KcsChunkId);

Saves all object state information to the supplied static store.  

KcsStatus setChunkId(KcsChunkId);

Sets the chunk set portion of the object's UID. Changing the value of ChunkId changes the position of this objects regeneration data within the object's static store. 

KcsStatus setChunkSet(KcsChunkSet *);

Sets the chunk set portion of the object's UID. Changing the value of the chunk set changes the object's static store. 

virtual KcsStatus 
setUID(KcsChunkSet *aNewChunkSet);

Tries to get a chunk Id corresponding to itself and a chunk set from the UID map table. If no entry, it calls createChunkId() to get a new chunk Id, does a permanent attach, and then calls setChunkSet() and setChunkId().

virtual KcsStatus 
unLoad(KcsLoadHints aloadHints =

Minimizes the memory requirements of the object by releasing all unnecessary state reclaimed from the static store.