With a common interface, the KcsIO class maintains device-, platform-, and transport-independent I/O functionality for all derivatives.
The header file for the class is kcsio.h. The constant and #define identifiers for this class are defined in the kcsids.h header file as:
const KcsId KcsSharIOId = {(0x494F0000UL)}; /* 'IO' */ #define KcsSharIOIdd (0x494F0000UL) /* 'IO' */
The enumerations and protected and public members are described, as well as the member function override rules when deriving from this class.
The KcsIO class provides the following enumerations.
Table 2-1 KcsIO Enumerations
The KcsIO class provides the following protected members.
Table 2-2 KcsIO Protected Members
The KcsIO class provides the following public members.
Table 2-3 KcsIO Public Members
The following table tells you which KcsIO member functions you must override and can override. The member functions indicated with an "X" in the Must column are required to derive successfully from this base class. Others can be used and not overridden.
Table 2-4 KcsIO Member Function Override Rules
Member Function |
Override Rules |
|
---|---|---|
Must |
Can |
|
getEOF() |
X |
|
getType() |
X |
|
isEqual() |
X |
|
KcsIO() |
X |
|
~KcsIO() |
|
X |
relRead() |
X |
|
relWrite() |
X |
|
setCursorPos() |
X |
|
setEOF() |
X |
|
setOffset() |
|
X |
The following code shows you how to use a KcsIO derivative as a data member or as an object to pass into a function.
//Read 4 bytes from KcsIO starting at byte 8. long getTheSecondLong(KcsStatus *aStat, KcsIO *aIO) { long badNumber = -1; long sSecondLong; if (aIO == NULL) return(badNumber); if ((*aStat = aIO->absRead(8, 4, &sSecondLong)) == KCS_SUCCESS) return(sSecondLong); else return(badNumber); } |