19 #include <cMsgPrivate.h>
44 void cMsgMessage::payloadClear(
void) {
45 cMsgPayloadClear(myMsgPointer);
56 void cMsgMessage::payloadReset(
void) {
57 cMsgPayloadReset(myMsgPointer);
65 void cMsgMessage::payloadPrint(
void)
const {
66 cMsgPayloadPrint(myMsgPointer);
76 bool cMsgMessage::hasPayload()
const {
78 cMsgHasPayload(myMsgPointer, &hasPayload);
79 return hasPayload ?
true :
false;
90 bool cMsgMessage::payloadContainsName(
const string &name)
const {
91 return cMsgPayloadContainsName(myMsgPointer, name.c_str()) ?
true :
false;
101 int cMsgMessage::payloadGetCount()
const {
103 cMsgPayloadGetCount(myMsgPointer, &count);
148 int cMsgMessage::payloadGetType(
const string &name)
const
151 err = cMsgPayloadGetType(myMsgPointer, name.c_str(), &type);
152 if (err != CMSG_OK) {
153 if (err == CMSG_BAD_ARGUMENT)
156 throw(
cMsgException(
string(
"No payload item named ") + name));
171 int err = cMsgPayloadCopy(msg.myMsgPointer, myMsgPointer);
185 string cMsgMessage::payloadGetText()
const {
187 cMsgGetPayloadText(myMsgPointer, &txt);
201 void cMsgMessage::payloadSetFromText(
const string &txt)
203 int err = cMsgPayloadSetAllFieldsFromText(myMsgPointer, txt.c_str());
204 if (err != CMSG_OK) {
218 string cMsgMessage::payloadGetFieldDescription(
const string &name)
const
220 const char *field = cMsgPayloadFieldDescription(myMsgPointer, name.c_str());
222 string err(
"No such field as ");
244 int err = cMsgPayloadGetInfo(myMsgPointer, &names, &types, &len);
245 if (err != CMSG_OK) {
246 if (err == CMSG_BAD_ARGUMENT)
247 throw(cMsgException(
"Name is null"));
248 else if (err == CMSG_ERROR)
249 throw(cMsgException(
"No payload exists"));
251 throw(cMsgException(
"Out of memory"));
254 map<string,int> *mp =
new map<string,int>;
255 for (
int i=0; i<len; i++) {
256 (*mp)[names[i]] = types[i];
271 bool cMsgMessage::payloadRemoveField(
const string &name) {
272 return cMsgPayloadRemove(myMsgPointer, name.c_str()) == 0 ?
false :
true;
288 int err = cMsgSetHistoryLengthMax(myMsgPointer, len);
289 if (err != CMSG_OK)
throw (
cMsgException(
"len must be >= 0 and < CMSG_HISTORY_LENGTH_ABS_MAX"));
312 void cMsgMessage::getBinary(
const string &name,
const char **val,
int &len,
int &endian)
314 int err = cMsgGetBinary(myMsgPointer, name.c_str(), val, &len, &endian);
315 if (err != CMSG_OK) {
316 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
317 else throw(
cMsgException(
string(
"No payload item named ") + name));
335 void cMsgMessage::getBinaryArray(
const string &name,
const char ***vals,
336 int **lens,
int **endians,
int &count)
338 int err = cMsgGetBinaryArray(myMsgPointer, name.c_str(), vals, lens, endians, &count);
339 if (err != CMSG_OK) {
340 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
341 else throw(
cMsgException(
string(
"No payload item named ") + name));
361 int err = cMsgGetMessage(myMsgPointer, name.c_str(), &val);
362 if (err != CMSG_OK) {
363 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
364 else throw(
cMsgException(
string(
"No payload item named ") + name));
368 void *newMsgPointer=cMsgCopyMessage(val);
369 if(newMsgPointer==NULL)
370 throw(
cMsgException(
"?cMsgMessage::getMessage...unable to create new message from message contents",CMSG_ERROR));
389 vector<cMsgMessage*> *cMsgMessage::getMessagePVector(
const string &name)
const throw(
cMsgException) {
392 int err = cMsgGetMessageArray(myMsgPointer, name.c_str(), &vals, &len);
393 if (err != CMSG_OK) {
394 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
395 else throw(
cMsgException(
string(
"No payload item named ") + name));
400 vector<cMsgMessage*> *msgPVec =
new vector<cMsgMessage*>;
401 for (
int i=0; i<len; i++) msgPVec->push_back(
new cMsgMessage(cMsgCopyMessage(vals[i])));
420 vector<cMsgMessage> *cMsgMessage::getMessageVector(
const string &name)
const throw(
cMsgException) {
423 int err = cMsgGetMessageArray(myMsgPointer, name.c_str(), &vals, &len);
424 if (err != CMSG_OK) {
425 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
426 else throw(
cMsgException(
string(
"No payload item named ") + name));
431 vector<cMsgMessage> *msgVec =
new vector<cMsgMessage>;
432 for (
int i=0; i<len; i++) msgVec->push_back(
cMsgMessage(cMsgCopyMessage(vals[i])));
454 int err = cMsgGetMessageArray(myMsgPointer, name.c_str(), &vals, &len);
455 if (err != CMSG_OK) {
456 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
457 else throw(
cMsgException(
string(
"No payload item named ") + name));
462 for (
int i=0; i<len; i++) msgPArray[i]=(
new cMsgMessage(cMsgCopyMessage(vals[i])));
484 int err = cMsgGetMessageArray(myMsgPointer, name.c_str(), &vals, &len);
485 if (err != CMSG_OK) {
486 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
487 else throw(
cMsgException(
string(
"No payload item named ") + name));
492 for (
int i=0; i<len; i++) msgArray[i]=(
cMsgMessage(cMsgCopyMessage(vals[i])));
509 string cMsgMessage::getString(
const string &name)
const throw(
cMsgException) {
511 int err = cMsgGetString(myMsgPointer, name.c_str(), &val);
512 if (err != CMSG_OK) {
513 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
514 else throw(
cMsgException(
string(
"No payload item named ") + name));
533 vector<string> *cMsgMessage::getStringVector(
const string &name)
const throw(
cMsgException) {
536 int err = cMsgGetStringArray(myMsgPointer, name.c_str(), &vals, &len);
537 if (err != CMSG_OK) {
538 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
539 else throw(
cMsgException(
string(
"No payload item named ") + name));
543 vector<string> *strs =
new vector<string>;
544 for (
int i=0; i<len; i++) strs->push_back(
string(vals[i]));
561 string *cMsgMessage::getStringArray(
const string &name)
const throw(
cMsgException) {
564 int err = cMsgGetStringArray(myMsgPointer, name.c_str(), &vals, &len);
565 if (err != CMSG_OK) {
566 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
567 else throw(
cMsgException(
string(
"No payload item named ") + name));
571 string *strs =
new string[len];
572 for (
int i=0; i<len; i++) strs[i]=
string(vals[i]);
588 float cMsgMessage::getFloat(
const string &name)
const throw(
cMsgException) {
590 int err = cMsgGetFloat(myMsgPointer, name.c_str(), &val);
591 if (err != CMSG_OK) {
592 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
593 else throw(
cMsgException(
string(
"No payload item named ") + name));
607 double cMsgMessage::getDouble(
const string &name)
const throw(
cMsgException) {
609 int err = cMsgGetDouble(myMsgPointer, name.c_str(), &val);
610 if (err != CMSG_OK) {
611 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
612 else throw(
cMsgException(
string(
"No payload item named ") + name));
631 vector<float> *cMsgMessage::getFloatVector(
const string &name)
const throw(
cMsgException) {
634 int err = cMsgGetFloatArray(myMsgPointer, name.c_str(), &vals, &len);
635 if (err != CMSG_OK) {
636 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
637 else throw(
cMsgException(
string(
"No payload item named ") + name));
640 vector<float> *flts =
new vector<float>;
641 for (
int i=0; i<len; i++) flts->push_back(vals[i]);
658 float *cMsgMessage::getFloatArray(
const string &name)
const throw(
cMsgException) {
661 int err = cMsgGetFloatArray(myMsgPointer, name.c_str(), &vals, &len);
662 if (err != CMSG_OK) {
663 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
664 else throw(
cMsgException(
string(
"No payload item named ") + name));
668 float *flts =
new float[len];
669 for (
int i=0; i<len; i++) flts[i]=vals[i];
686 vector<double> *cMsgMessage::getDoubleVector(
const string &name)
const throw(
cMsgException) {
689 int err = cMsgGetDoubleArray(myMsgPointer, name.c_str(), &vals, &len);
690 if (err != CMSG_OK) {
691 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
692 else throw(
cMsgException(
string(
"No payload item named ") + name));
695 vector<double> *dbls =
new vector<double>;
696 for (
int i=0; i<len; i++) dbls->push_back(vals[i]);
714 double *cMsgMessage::getDoubleArray(
const string &name)
const throw(
cMsgException) {
717 int err = cMsgGetDoubleArray(myMsgPointer, name.c_str(), &vals, &len);
718 if (err != CMSG_OK) {
719 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
720 else throw(
cMsgException(
string(
"No payload item named ") + name));
724 double *dbls =
new double[len];
725 for (
int i=0; i<len; i++) dbls[i]=vals[i];
741 int8_t cMsgMessage::getInt8(
const string &name)
const throw(
cMsgException) {
743 int err = cMsgGetInt8(myMsgPointer, name.c_str(), &val);
744 if (err != CMSG_OK) {
745 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
746 else throw(
cMsgException(
string(
"No payload item named ") + name));
760 int16_t cMsgMessage::getInt16(
const string &name)
const throw(
cMsgException) {
762 int err = cMsgGetInt16(myMsgPointer, name.c_str(), &val);
763 if (err != CMSG_OK) {
764 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
765 else throw(
cMsgException(
string(
"No payload item named ") + name));
779 int32_t cMsgMessage::getInt32(
const string &name)
const throw(
cMsgException) {
781 int err = cMsgGetInt32(myMsgPointer, name.c_str(), &val);
782 if (err != CMSG_OK) {
783 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
784 else throw(
cMsgException(
string(
"No payload item named ") + name));
798 int64_t cMsgMessage::getInt64(
const string &name)
const throw(
cMsgException) {
800 int err = cMsgGetInt64(myMsgPointer, name.c_str(), &val);
801 if (err != CMSG_OK) {
802 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
803 else throw(
cMsgException(
string(
"No payload item named ") + name));
817 uint8_t cMsgMessage::getUint8(
const string &name)
const throw(
cMsgException) {
819 int err = cMsgGetUint8(myMsgPointer, name.c_str(), &val);
820 if (err != CMSG_OK) {
821 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
822 else throw(
cMsgException(
string(
"No payload item named ") + name));
836 uint16_t cMsgMessage::getUint16(
const string &name)
const throw(
cMsgException) {
838 int err = cMsgGetUint16(myMsgPointer, name.c_str(), &val);
839 if (err != CMSG_OK) {
840 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
841 else throw(
cMsgException(
string(
"No payload item named ") + name));
855 uint32_t cMsgMessage::getUint32(
const string &name)
const throw(
cMsgException) {
857 int err = cMsgGetUint32(myMsgPointer, name.c_str(), &val);
858 if (err != CMSG_OK) {
859 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
860 else throw(
cMsgException(
string(
"No payload item named ") + name));
874 uint64_t cMsgMessage::getUint64(
const string &name)
const throw(
cMsgException) {
876 int err = cMsgGetUint64(myMsgPointer, name.c_str(), &val);
877 if (err != CMSG_OK) {
878 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
879 else throw(
cMsgException(
string(
"No payload item named ") + name));
897 vector<int8_t> *cMsgMessage::getInt8Vector(
const string &name)
const throw(
cMsgException) {
900 int err = cMsgGetInt8Array(myMsgPointer, name.c_str(), &vals, &len);
901 if (err != CMSG_OK) {
902 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
903 else throw(
cMsgException(
string(
"No payload item named ") + name));
906 vector<int8_t> *ints =
new vector<int8_t>;
907 for (
int i=0; i<len; i++) ints->push_back(vals[i]);
924 int8_t *cMsgMessage::getInt8Array(
const string &name)
const throw(
cMsgException) {
927 int err = cMsgGetInt8Array(myMsgPointer, name.c_str(), &vals, &len);
928 if (err != CMSG_OK) {
929 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
930 else throw(
cMsgException(
string(
"No payload item named ") + name));
933 int8_t *ints =
new int8_t[len];
934 for (
int i=0; i<len; i++) ints[i]=vals[i];
951 vector<int16_t> *cMsgMessage::getInt16Vector(
const string &name)
const throw(
cMsgException) {
954 int err = cMsgGetInt16Array(myMsgPointer, name.c_str(), &vals, &len);
955 if (err != CMSG_OK) {
956 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
957 else throw(
cMsgException(
string(
"No payload item named ") + name));
960 vector<int16_t> *ints =
new vector<int16_t>;
961 for (
int i=0; i<len; i++) ints->push_back(vals[i]);
978 int16_t *cMsgMessage::getInt16Array(
const string &name)
const throw(
cMsgException) {
981 int err = cMsgGetInt16Array(myMsgPointer, name.c_str(), &vals, &len);
982 if (err != CMSG_OK) {
983 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
984 else throw(
cMsgException(
string(
"No payload item named ") + name));
987 int16_t *ints =
new int16_t[len];
988 for (
int i=0; i<len; i++) ints[i]=vals[i];
1005 vector<int32_t> *cMsgMessage::getInt32Vector(
const string &name)
const throw(
cMsgException) {
1007 const int32_t *vals;
1008 int err = cMsgGetInt32Array(myMsgPointer, name.c_str(), &vals, &len);
1009 if (err != CMSG_OK) {
1010 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1011 else throw(
cMsgException(
string(
"No payload item named ") + name));
1014 vector<int32_t> *ints =
new vector<int32_t>;
1015 for (
int i=0; i<len; i++) ints->push_back(vals[i]);
1032 int32_t *cMsgMessage::getInt32Array(
const string &name)
const throw(
cMsgException) {
1034 const int32_t *vals;
1035 int err = cMsgGetInt32Array(myMsgPointer, name.c_str(), &vals, &len);
1036 if (err != CMSG_OK) {
1037 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1038 else throw(
cMsgException(
string(
"No payload item named ") + name));
1041 int32_t *ints =
new int32_t[len];
1042 for (
int i=0; i<len; i++) ints[i]=vals[i];
1059 vector<int64_t> *cMsgMessage::getInt64Vector(
const string &name)
const throw(
cMsgException) {
1061 const int64_t *vals;
1062 int err = cMsgGetInt64Array(myMsgPointer, name.c_str(), &vals, &len);
1063 if (err != CMSG_OK) {
1064 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1065 else throw(
cMsgException(
string(
"No payload item named ") + name));
1068 vector<int64_t> *ints =
new vector<int64_t>;
1069 for (
int i=0; i<len; i++) ints->push_back(vals[i]);
1086 int64_t *cMsgMessage::getInt64Array(
const string &name)
const throw(
cMsgException) {
1088 const int64_t *vals;
1089 int err = cMsgGetInt64Array(myMsgPointer, name.c_str(), &vals, &len);
1090 if (err != CMSG_OK) {
1091 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1092 else throw(
cMsgException(
string(
"No payload item named ") + name));
1095 int64_t *ints =
new int64_t[len];
1096 for (
int i=0; i<len; i++) ints[i]=vals[i];
1114 vector<uint8_t> *cMsgMessage::getUint8Vector(
const string &name)
const throw(
cMsgException) {
1116 const uint8_t *vals;
1117 int err = cMsgGetUint8Array(myMsgPointer, name.c_str(), &vals, &len);
1118 if (err != CMSG_OK) {
1119 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1120 else throw(
cMsgException(
string(
"No payload item named ") + name));
1123 vector<uint8_t> *ints =
new vector<uint8_t>;
1124 for (
int i=0; i<len; i++) ints->push_back(vals[i]);
1142 uint8_t *cMsgMessage::getUint8Array(
const string &name)
const throw(
cMsgException) {
1144 const uint8_t *vals;
1145 int err = cMsgGetUint8Array(myMsgPointer, name.c_str(), &vals, &len);
1146 if (err != CMSG_OK) {
1147 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1148 else throw(
cMsgException(
string(
"No payload item named ") + name));
1151 uint8_t *ints =
new uint8_t[len];
1152 for (
int i=0; i<len; i++) ints[i]=vals[i];
1170 vector<uint16_t> *cMsgMessage::getUint16Vector(
const string &name)
const throw(
cMsgException) {
1172 const uint16_t *vals;
1173 int err = cMsgGetUint16Array(myMsgPointer, name.c_str(), &vals, &len);
1174 if (err != CMSG_OK) {
1175 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1176 else throw(
cMsgException(
string(
"No payload item named ") + name));
1179 vector<uint16_t> *ints =
new vector<uint16_t>;
1180 for (
int i=0; i<len; i++) ints->push_back(vals[i]);
1198 uint16_t *cMsgMessage::getUint16Array(
const string &name)
const throw(
cMsgException) {
1200 const uint16_t *vals;
1201 int err = cMsgGetUint16Array(myMsgPointer, name.c_str(), &vals, &len);
1202 if (err != CMSG_OK) {
1203 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1204 else throw(
cMsgException(
string(
"No payload item named ") + name));
1207 uint16_t *ints =
new uint16_t[len];
1208 for (
int i=0; i<len; i++) ints[i]=vals[i];
1225 vector<uint32_t> *cMsgMessage::getUint32Vector(
const string &name)
const throw(
cMsgException) {
1227 const uint32_t *vals;
1228 int err = cMsgGetUint32Array(myMsgPointer, name.c_str(), &vals, &len);
1229 if (err != CMSG_OK) {
1230 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1231 else throw(
cMsgException(
string(
"No payload item named ") + name));
1234 vector<uint32_t> *ints =
new vector<uint32_t>;
1235 for (
int i=0; i<len; i++) ints->push_back(vals[i]);
1252 uint32_t *cMsgMessage::getUint32Array(
const string &name)
const throw(
cMsgException) {
1254 const uint32_t *vals;
1255 int err = cMsgGetUint32Array(myMsgPointer, name.c_str(), &vals, &len);
1256 if (err != CMSG_OK) {
1257 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1258 else throw(
cMsgException(
string(
"No payload item named ") + name));
1261 uint32_t *ints =
new uint32_t[len];
1262 for (
int i=0; i<len; i++) ints[i]=vals[i];
1279 vector<uint64_t> *cMsgMessage::getUint64Vector(
const string &name)
const throw(
cMsgException) {
1281 const uint64_t *vals;
1282 int err = cMsgGetUint64Array(myMsgPointer, name.c_str(), &vals, &len);
1283 if (err != CMSG_OK) {
1284 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1285 else throw(
cMsgException(
string(
"No payload item named ") + name));
1288 vector<uint64_t> *ints =
new vector<uint64_t>;
1289 for (
int i=0; i<len; i++) ints->push_back(vals[i]);
1307 uint64_t *cMsgMessage::getUint64Array(
const string &name)
const throw(
cMsgException) {
1309 const uint64_t *vals;
1310 int err = cMsgGetUint64Array(myMsgPointer, name.c_str(), &vals, &len);
1311 if (err != CMSG_OK) {
1312 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Wrong field type"));
1313 else throw(
cMsgException(
string(
"No payload item named ") + name));
1316 uint64_t *ints =
new uint64_t[len];
1317 for (
int i=0; i<len; i++) ints[i]=vals[i];
1345 void cMsgMessage::add(
const string &name,
const char *src,
int size,
int endian) {
1346 int err = cMsgAddBinary(myMsgPointer, name.c_str(), src, size, endian);
1347 if (err != CMSG_OK) {
1348 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name or if error in binary-to-text conversion"));
1349 else if (err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"src or name null, size < 1, or endian improper value"));
1350 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1351 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1372 void cMsgMessage::add(
const string &name,
const char **srcs,
int number,
1373 const int sizes[],
const int endians[]) {
1374 int err = cMsgAddBinaryArray(myMsgPointer, name.c_str(), srcs, number, sizes, endians);
1375 if (err != CMSG_OK) {
1376 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name or if error in binary-to-text conversion"));
1377 else if (err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"srcs or name null, sizes < 1, or endians improper value"));
1378 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1379 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1400 void cMsgMessage::add(
const string &name,
const string &s) {
1401 int err = cMsgAddString(myMsgPointer, name.c_str(), s.c_str());
1402 if (err != CMSG_OK) {
1403 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1404 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1405 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1422 void cMsgMessage::add(
const string &name,
const string *s) {
1439 void cMsgMessage::add(
const string &name,
const char **strs,
int len) {
1440 if (strs == NULL)
throw (
cMsgException(
"strs arg is null"));
1443 int err = cMsgAddStringArray(myMsgPointer, name.c_str(), strs, len);
1444 if (err != CMSG_OK) {
1445 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1446 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1447 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1465 void cMsgMessage::add(
const string &name,
const string *strs,
int len) {
1466 if (strs == NULL)
throw (
cMsgException(
"strs arg is null"));
1470 const char *strings[len];
1472 const char **strings = (
const char **)malloc(len*
sizeof(
char *));
1473 if (strings == NULL)
throw(
cMsgException(
"No memory available"));
1476 for (
int i=0; i<len; i++) {
1477 strings[i] = strs[i].c_str();
1480 int err = cMsgAddStringArray(myMsgPointer, name.c_str(), strings, len);
1484 if (err != CMSG_OK) {
1485 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1486 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1487 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1505 void cMsgMessage::add(
const string &name,
const vector<string> &strs) {
1506 if (strs.size() < 1)
throw(
cMsgException(
"Zero length vector"));
1508 const char *strings[strs.size()];
1510 const char **strings = (
const char **)malloc(strs.size()*
sizeof(
char *));
1511 if (strings == NULL)
throw(
cMsgException(
"No memory available"));
1514 for (vector<string>::size_type i=0; i < strs.size(); i++) {
1515 strings[i] = strs[i].c_str();
1518 int err = cMsgAddStringArray(myMsgPointer, name.c_str(), strings, strs.size());
1522 if (err != CMSG_OK) {
1523 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1524 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1525 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1540 void cMsgMessage::add(
const string &name,
const vector<string> *strs) {
1559 int err = cMsgAddMessage(myMsgPointer, name.c_str(), msg.
myMsgPointer);
1560 if (err != CMSG_OK) {
1561 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1562 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1563 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1598 void cMsgMessage::add(
const string &name,
const cMsgMessage *msg,
int len) {
1600 if (len < 1)
throw (
cMsgException(
"cmsg message array len < 1"));
1603 const void *msgs[len];
1605 const void **msgs = (
const void **)malloc(len*
sizeof(
void *));
1606 if (msgs == NULL)
throw(
cMsgException(
"No memory available"));
1609 for (
int i=0; i<len; i++) {
1613 int err = cMsgAddMessageArray(myMsgPointer, name.c_str(), msgs, len);
1617 if (err != CMSG_OK) {
1618 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1619 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1620 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1641 void cMsgMessage::add(
const string &name,
const cMsgMessage* *msg,
int len) {
1643 if (len < 1)
throw (
cMsgException(
"cmsg message array len < 1"));
1646 const void *msgs[len];
1648 const void **msgs = (
const void **)malloc(len*
sizeof(
void *));
1649 if (msgs == NULL)
throw(
cMsgException(
"No memory available"));
1652 for (
int i=0; i<len; i++) {
1656 int err = cMsgAddMessageArray(myMsgPointer, name.c_str(), msgs, len);
1660 if (err != CMSG_OK) {
1661 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1662 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1663 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1683 void cMsgMessage::add(
const string &name,
const vector<cMsgMessage*> &msgPVec) {
1684 if (msgPVec.size() < 1)
throw(
cMsgException(
"Zero length vector"));
1686 const void *msgs[msgPVec.size()];
1688 const void **msgs = (
const void **)malloc(msgPVec.size()*
sizeof(
void *));
1689 if (msgs == NULL)
throw(
cMsgException(
"No memory available"));
1692 for (vector<cMsgMessage*>::size_type i=0; i < msgPVec.size(); i++) {
1693 msgs[i] = msgPVec[i]->myMsgPointer;
1696 int err = cMsgAddMessageArray(myMsgPointer, name.c_str(), msgs, msgPVec.size());
1700 if (err != CMSG_OK) {
1701 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1702 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1703 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1723 void cMsgMessage::add(
const string &name,
const vector<cMsgMessage> &msgVec) {
1724 if (msgVec.size() < 1)
throw(
cMsgException(
"Zero length vector"));
1726 const void *msgs[msgVec.size()];
1728 const void **msgs = (
const void **)malloc(msgVec.size()*
sizeof(
void *));
1729 if (msgs == NULL)
throw(
cMsgException(
"No memory available"));
1732 for (vector<cMsgMessage>::size_type i=0; i < msgVec.size(); i++) {
1733 msgs[i] = msgVec[i].myMsgPointer;
1736 int err = cMsgAddMessageArray(myMsgPointer, name.c_str(), msgs, msgVec.size());
1740 if (err != CMSG_OK) {
1741 if (err == CMSG_BAD_FORMAT)
throw(
cMsgException(
"Improper name"));
1742 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1743 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1763 void cMsgMessage::add(
const string &name,
const vector<cMsgMessage*> *msgPVec) {
1781 void cMsgMessage::add(
const string &name,
const vector<cMsgMessage> *msgVec) {
1800 void cMsgMessage::add(
const string &name,
float val) {
1801 int err = cMsgAddFloat(myMsgPointer, name.c_str(), val);
1802 if (err != CMSG_OK) {
1803 if (err == CMSG_BAD_FORMAT ||
1804 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
1805 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1806 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1823 void cMsgMessage::add(
const string &name,
double val) {
1824 int err = cMsgAddDouble(myMsgPointer, name.c_str(), val);
1825 if (err != CMSG_OK) {
1826 if (err == CMSG_BAD_FORMAT ||
1827 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
1828 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1829 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1849 void cMsgMessage::add(
const string &name,
const float *vals,
int len) {
1850 int err = cMsgAddFloatArray(myMsgPointer, name.c_str(), vals, len);
1851 if (err != CMSG_OK) {
1852 if (err == CMSG_BAD_FORMAT ||
1853 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
1854 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1855 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1872 void cMsgMessage::add(
const string &name,
const vector<float> &vals) {
1873 int err = cMsgAddFloatArray(myMsgPointer, name.c_str(), &vals[0], vals.size());
1874 if (err != CMSG_OK) {
1875 if (err == CMSG_BAD_FORMAT ||
1876 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
1877 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1878 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1895 void cMsgMessage::add(
const string &name,
const vector<float> *vals) {
1912 void cMsgMessage::add(
const string &name,
const double *vals,
int len) {
1913 int err = cMsgAddDoubleArray(myMsgPointer, name.c_str(), vals, len);
1914 if (err != CMSG_OK) {
1915 if (err == CMSG_BAD_FORMAT ||
1916 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
1917 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1918 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1935 void cMsgMessage::add(
const string &name,
const vector<double> &vals) {
1936 int err = cMsgAddDoubleArray(myMsgPointer, name.c_str(), &vals[0], vals.size());
1937 if (err != CMSG_OK) {
1938 if (err == CMSG_BAD_FORMAT ||
1939 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
1940 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1941 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1958 void cMsgMessage::add(
const string &name,
const vector<double> *vals) {
1976 void cMsgMessage::add(
const string &name, int8_t val) {
1977 int err = cMsgAddInt8(myMsgPointer, name.c_str(), val);
1978 if (err != CMSG_OK) {
1979 if (err == CMSG_BAD_FORMAT ||
1980 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
1981 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
1982 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
1999 void cMsgMessage::add(
const string &name, int16_t val) {
2000 int err = cMsgAddInt16(myMsgPointer, name.c_str(), val);
2001 if (err != CMSG_OK) {
2002 if (err == CMSG_BAD_FORMAT ||
2003 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2004 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2005 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2022 void cMsgMessage::add(
const string &name, int32_t val) {
2023 int err = cMsgAddInt32(myMsgPointer, name.c_str(), val);
2024 if (err != CMSG_OK) {
2025 if (err == CMSG_BAD_FORMAT ||
2026 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2027 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2028 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2045 void cMsgMessage::add(
const string &name, int64_t val) {
2046 int err = cMsgAddInt64(myMsgPointer, name.c_str(), val);
2047 if (err != CMSG_OK) {
2048 if (err == CMSG_BAD_FORMAT ||
2049 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2050 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2051 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2068 void cMsgMessage::add(
const string &name, uint8_t val) {
2069 int err = cMsgAddUint8(myMsgPointer, name.c_str(), val);
2070 if (err != CMSG_OK) {
2071 if (err == CMSG_BAD_FORMAT ||
2072 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2073 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2074 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2091 void cMsgMessage::add(
const string &name, uint16_t val) {
2092 int err = cMsgAddUint16(myMsgPointer, name.c_str(), val);
2093 if (err != CMSG_OK) {
2094 if (err == CMSG_BAD_FORMAT ||
2095 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2096 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2097 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2114 void cMsgMessage::add(
const string &name, uint32_t val) {
2115 int err = cMsgAddUint32(myMsgPointer, name.c_str(), val);
2116 if (err != CMSG_OK) {
2117 if (err == CMSG_BAD_FORMAT ||
2118 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2119 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2120 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2137 void cMsgMessage::add(
const string &name, uint64_t val) {
2138 int err = cMsgAddUint64(myMsgPointer, name.c_str(), val);
2139 if (err != CMSG_OK) {
2140 if (err == CMSG_BAD_FORMAT ||
2141 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2142 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2143 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2163 void cMsgMessage::add(
const string &name,
const int8_t *vals,
int len) {
2164 int err = cMsgAddInt8Array(myMsgPointer, name.c_str(), vals, len);
2165 if (err != CMSG_OK) {
2166 if (err == CMSG_BAD_FORMAT ||
2167 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
2168 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2169 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2186 void cMsgMessage::add(
const string &name,
const vector<int8_t> &vals) {
2190 int err = cMsgAddInt8Array(myMsgPointer, name.c_str(), &vals[0], vals.size());
2191 if (err != CMSG_OK) {
2192 if (err == CMSG_BAD_FORMAT ||
2193 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2194 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2195 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2212 void cMsgMessage::add(
const string &name,
const vector<int8_t> *vals) {
2229 void cMsgMessage::add(
const string &name,
const int16_t *vals,
int len) {
2230 int err = cMsgAddInt16Array(myMsgPointer, name.c_str(), vals, len);
2231 if (err != CMSG_OK) {
2232 if (err == CMSG_BAD_FORMAT ||
2233 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
2234 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2235 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2252 void cMsgMessage::add(
const string &name,
const vector<int16_t> &vals) {
2255 int err = cMsgAddInt16Array(myMsgPointer, name.c_str(), &vals[0], vals.size());
2256 if (err != CMSG_OK) {
2257 if (err == CMSG_BAD_FORMAT ||
2258 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2259 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2260 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2277 void cMsgMessage::add(
const string &name,
const vector<int16_t> *vals) {
2294 void cMsgMessage::add(
const string &name,
const int32_t *vals,
int len) {
2295 int err = cMsgAddInt32Array(myMsgPointer, name.c_str(), vals, len);
2296 if (err != CMSG_OK) {
2297 if (err == CMSG_BAD_FORMAT ||
2298 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
2299 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2300 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2317 void cMsgMessage::add(
const string &name,
const vector<int32_t> &vals) {
2321 int err = cMsgAddInt32Array(myMsgPointer, name.c_str(), &vals[0], vals.size());
2322 if (err != CMSG_OK) {
2323 if (err == CMSG_BAD_FORMAT ||
2324 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2325 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2326 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2343 void cMsgMessage::add(
const string &name,
const vector<int32_t> *vals) {
2360 void cMsgMessage::add(
const string &name,
const int64_t *vals,
int len) {
2361 int err = cMsgAddInt64Array(myMsgPointer, name.c_str(), vals, len);
2362 if (err != CMSG_OK) {
2363 if (err == CMSG_BAD_FORMAT ||
2364 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
2365 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2366 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2383 void cMsgMessage::add(
const string &name,
const vector<int64_t> &vals) {
2387 int err = cMsgAddInt64Array(myMsgPointer, name.c_str(), &vals[0], vals.size());
2388 if (err != CMSG_OK) {
2389 if (err == CMSG_BAD_FORMAT ||
2390 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2391 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2392 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2409 void cMsgMessage::add(
const string &name,
const vector<int64_t> *vals) {
2427 void cMsgMessage::add(
const string &name,
const uint8_t *vals,
int len) {
2428 int err = cMsgAddUint8Array(myMsgPointer, name.c_str(), vals, len);
2429 if (err != CMSG_OK) {
2430 if (err == CMSG_BAD_FORMAT ||
2431 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
2432 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2433 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2450 void cMsgMessage::add(
const string &name,
const vector<uint8_t> &vals) {
2454 int err = cMsgAddUint8Array(myMsgPointer, name.c_str(), &vals[0], vals.size());
2455 if (err != CMSG_OK) {
2456 if (err == CMSG_BAD_FORMAT ||
2457 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2458 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2459 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2476 void cMsgMessage::add(
const string &name,
const vector<uint8_t> *vals) {
2493 void cMsgMessage::add(
const string &name,
const uint16_t *vals,
int len) {
2494 int err = cMsgAddUint16Array(myMsgPointer, name.c_str(), vals, len);
2495 if (err != CMSG_OK) {
2496 if (err == CMSG_BAD_FORMAT ||
2497 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
2498 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2499 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2516 void cMsgMessage::add(
const string &name,
const vector<uint16_t> &vals) {
2520 int err = cMsgAddUint16Array(myMsgPointer, name.c_str(), &vals[0], vals.size());
2521 if (err != CMSG_OK) {
2522 if (err == CMSG_BAD_FORMAT ||
2523 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2524 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2525 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2542 void cMsgMessage::add(
const string &name,
const vector<uint16_t> *vals) {
2559 void cMsgMessage::add(
const string &name,
const uint32_t *vals,
int len) {
2560 int err = cMsgAddUint32Array(myMsgPointer, name.c_str(), vals, len);
2561 if (err != CMSG_OK) {
2562 if (err == CMSG_BAD_FORMAT ||
2563 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
2564 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2565 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2582 void cMsgMessage::add(
const string &name,
const vector<uint32_t> &vals) {
2586 int err = cMsgAddUint32Array(myMsgPointer, name.c_str(), &vals[0], vals.size());
2587 if (err != CMSG_OK) {
2588 if (err == CMSG_BAD_FORMAT ||
2589 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2590 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2591 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2608 void cMsgMessage::add(
const string &name,
const vector<uint32_t> *vals) {
2625 void cMsgMessage::add(
const string &name,
const uint64_t *vals,
int len) {
2626 int err = cMsgAddUint64Array(myMsgPointer, name.c_str(), vals, len);
2627 if (err != CMSG_OK) {
2628 if (err == CMSG_BAD_FORMAT ||
2629 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name or vals is null"));
2630 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2631 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2648 void cMsgMessage::add(
const string &name,
const vector<uint64_t> &vals) {
2652 int err = cMsgAddUint64Array(myMsgPointer, name.c_str(), &vals[0], vals.size());
2653 if (err != CMSG_OK) {
2654 if (err == CMSG_BAD_FORMAT ||
2655 err == CMSG_BAD_ARGUMENT)
throw(
cMsgException(
"Improper name"));
2656 else if (err == CMSG_ALREADY_EXISTS)
throw(
cMsgException(
"Name being used"));
2657 else if (err == CMSG_OUT_OF_MEMORY)
throw(
cMsgException(
"No memory available"));
2674 void cMsgMessage::add(
const string &name,
const vector<uint64_t> *vals) {
void * myMsgPointer
Pointer to C message structure.
Class for wrapping cMsg message.
Exception includes description and return code.