The KcsMemoryBlock class is a memory-based I/O derivative of the KcsIO class. It provides a way to manipulate blocks of memory by creating a KcsIO object. You can use the protected and public member functions in this class in the implementation of your CMM; you cannot override any member function in this class.
The header file for the class is kcsmblk.h.
It is highly recommended that you do not use any of the variables and functions for handle-based memory in the kcsmblk.h header file. Handle-based memory is not required on the Solaris system.
The constant and #define identifiers for this class are defined in the kcsids.h header file as:
const KcsId KcsIOMBlkId = {(0x4D426C6BUL)}; /* 'MBlk' */ #define KcsIOMBlkIdd (0x4D426C6BUL) /* 'MBlk' */
In addition to the KcsIO virtual member functions that must be overridden for a minimal KcsIO implementation, the KcsMemoryBlock class has member functions for manipulating blocks of memory. See Table 2-4 for a list of the member functions minimally required to derive from the KcsIO class.
The enumerations and protected and public members are described.
The KcsMemboryBlock class provides the following enumerations.
Table 2-5 KcsMemoryBlock Enumerations
Enumeration |
Description |
---|---|
enum KcsMemoryKind { KCS_APPLICATION_HEAP, KCS_SYSTEM_HEAP }; |
enum used in setCursorPos(). The object is in the application or system heap. |
The KcsMemboryBlock class provides the following protected members
Table 2-6 KcsMemoryBlock Protected Members
The KcsmemoryBlock class provides the following public members.
Table 2-7 KcsMemoryBlock Public Members
This example shows you how to change the size of memory with the KcsMemoryBlock class.
KcsStatus resizeIt() { unsigned long sNewSize = 10; KcsStatus sStatus; KcsMemoryBlock *memBlock; char * buffer = {`a','b','c','d'}; // create a new KcsMemoryBlock object memBlock = new KcsMemoryBlock(&sStatus,4); if (sStatus != KCS_SUCCESS) return (sStatus); // put the four bytes above into the new KcsMemoryBlock sStatus = memBlock->put(buffer,4); if (sStatus != KCS_SUCCESS) return (sStatus); // resize the KcsMemoryBlock from 4 to 10 sStatus = memBlock->reSize(sNewSize); //Finished with the data delete memBlock; return (sStatus); } |