KCMS CMM Reference Manual
只搜尋這本書
以 PDF 格式下載這本書

KcsLoadable Class

4

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 (KcsXform, KcsProfileFormat and KcsProfile) 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:
  • kcsload.h (the KcsLoadable class header file)
  • kcsshare.h and kcsswap.h
  • kcschunk.h and kcsuidmp.h

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 public members are described.

Public Members

The KcsLoadable class provides the following public members.
Table 4-1 KcsLoadable
Public MemberDescription
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 chunkset/chunkid entry in the UID map. 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 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 UID map for the chunk id.If permanent use count == 0, deletes chunk from file. Calls KcsShareable::dettach().
virtual KcsChunkId
getChunkId(KcsStatus *aStatus, KcsChunkSet *aCS);
Looks in the UID map and returns the chunk Id
associated with this object and aCS. If no entry is
found in the UID map, 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, returns pointer to the object; else returns NULL.
virtual KcsStatus isLoadable();Returns KcsSuccess if the loadable object can load and regenerate itself.
virtual long isLoaded();Returns non-zero if the loadable object its state loaded.
Table 4-1 KcsLoadable(Continued)
Public MemberDescription
KcsLoadable(KcsStatus *);Constructor.
KcsLoadable(KcsChunkSet *, KcsChunkId,
KcsStatus *);
Constructor that instantiates a loadable based on a
UID that is a combination of KcsChunkSet and
KcsChunkId.
virtual
~KcsLoadable();
Destructor. Deallocates all resources associated with
specified instance.
virtual KcsStatus
load(const KcsLoadHints aLoadHints =
KcsLoadAllNow,
KcsCallbackFunction aCallback = NULL);
Regenerates all necessary state from the static store
associated with the aLoadHints.
KcsStatus
putObjIntoUIDMap(KcsChunkSet * aCS,
KcsChunkId aChunkId);
Puts the object identified by this chunk set and
chunkid in UID map. Returns pointer to the object.
virtual KcsStatus save()
{return(KCS_SUCCESS);};
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. If no entry, calls
createChunkId() to get a new chunk id, does a
permanent attach, and then calls setChunkSet()
and setChunkId().
virtual KcsStatus
unLoad(KcsLoadHints aloadHints =
(KcsPurgeMemoryNow));
Minimizes the memory requirements of the object
by releasing all unnecessary state reclaimed from
the static store.