#include // ***************************************************************************** // * cdevMessage::import : // * This metod is used by the cdevPacket class to generate a cdevMessage // * object from a cdevBinaryPacket object. In order for the cdevPacket // * class to perform this task, the import method and the // * CDEV_PACKET_VERSION must be registered using the // * cdevPacket::registerImportMethod function. // ***************************************************************************** cdevPacket * cdevMessage::import( cdevPacketBinary & packet) { char * binary = NULL; size_t binaryLen = 0; packet.streamOut(&binary, &binaryLen); return new cdevMessage(binary, binaryLen); } // ***************************************************************************** // * cdevMessage::cdevMessage : // * This is a parameterized constructor for the cdevMessage object. If none // * of the parameters are specified then this constructor will build a // * cdevMessage object made completely from defaults. // ***************************************************************************** cdevMessage::cdevMessage ( short ClientID, unsigned TransIndex, unsigned CancelTransIndex, unsigned LocalDataIndex, unsigned ForeignDataIndex, unsigned OperationCode, int CompletionCode, unsigned DeviceCount, char ** DeviceList, char * Message, cdevData * Data, cdevData * Context, cdevData * TagMap) : clientID (ClientID), transIndex (TransIndex), cancelTransIndex (CancelTransIndex), localDataIndex (LocalDataIndex), foreignDataIndex (ForeignDataIndex), operationCode (OperationCode), completionCode (CompletionCode), deviceCount (DeviceCount), deviceList (NULL), message (NULL), data (NULL), context (NULL), tagMap (NULL) { saveTbl.rawData=0; if(DeviceCount>0 && DeviceList!=NULL) { deviceList = (char **)new char * [deviceCount]; for(int i=0; i0 && Message.deviceList!=NULL) { deviceList = (char **)new char * [deviceCount]; for(int i=0; iasciiDump(fp); fprintf(fp, "Context Object : %s", context!=NULL?"\n":"(not specified)\n"); fflush(fp); if(context) context->asciiDump(fp); fprintf(fp, "Tag Map : %s", tagMap!=NULL?"\n":"(not specified)\n"); if(tagMap) { size_t tagNumCnt = 0; int * tagNums = NULL; size_t tagNameCnt = 0; char ** tagNames = NULL; if(tagMap->getElems(1, &tagNumCnt)==CDEV_SUCCESS && tagMap->getElems(2, &tagNameCnt)==CDEV_SUCCESS && tagMap->getType (2)==CDEV_STRING && tagNumCnt==tagNameCnt) { char ** tagNames = NULL; char * singleName = NULL; tagNums = new int[tagNumCnt]; tagMap->get(1, tagNums); if(tagNameCnt==1) { tagNames = &singleName; tagMap->find(2, (void *&)singleName); } else tagMap->find(2, (void *&)tagNames); for(int i=0; i