%description: Tests parsimPack/parsimUnpack for generated classes %file: test.msg namespace @TESTNAME@; cplusplus {{ typedef std::vector IntVector; typedef std::list IntList; typedef std::set IntSet; typedef std::map IntDoubleMap; typedef std::list> IntVectorList; typedef std::vector> IntListVector; }} class IntVector {@existingClass;@opaque;} class IntList {@existingClass;@opaque;} class IntSet {@existingClass;@opaque;} class IntDoubleMap {@existingClass;@opaque;} class IntVectorList {@existingClass;@opaque;} class IntListVector {@existingClass;@opaque;} message TestMessage { IntVector v; IntList l; IntSet s; IntDoubleMap m; IntVectorList vl; IntListVector lv; } %includes: #include #include // from src/sim/parsim #include // from src/envir #include "test_m.h" %activity: #define PRINT(X) EV << #X << ":" << (X) << endl TestMessage msg("msg"); msg.getVForUpdate().push_back(1); msg.getVForUpdate().push_back(5); msg.getLForUpdate().push_back(99); msg.getLForUpdate().push_back(54); msg.getLForUpdate().push_back(63); msg.getSForUpdate().insert(888); msg.getSForUpdate().insert(123); msg.getMForUpdate()[3] = 3.14; msg.getMForUpdate()[2] = 2.71; std::vector v; v.push_back(5); v.push_back(7); std::list > vl; vl.push_back(v); msg.setVl(vl); std::list l; l.push_back(5); l.push_back(7); std::vector > lv; lv.push_back(l); msg.setLv(lv); cFileCommBuffer *buffer = new cFileCommBuffer(); msg.parsimPack(buffer); TestMessage msg2("tmp"); msg2.parsimUnpack(buffer); EV << "isBufferEmpty:" << buffer->isBufferEmpty() << endl; EV << "v:"; for (IntVector::const_iterator it=msg2.getV().begin(); it!=msg2.getV().end(); it++) EV << " " << *it; EV << "\n"; EV << "l:"; for (IntList::const_iterator it=msg2.getL().begin(); it!=msg2.getL().end(); it++) EV << " " << *it; EV << "\n"; EV << "s:"; for (IntSet::const_iterator it=msg2.getS().begin(); it!=msg2.getS().end(); it++) EV << " " << *it; EV << "\n"; EV << "m:"; for (IntDoubleMap::const_iterator it=msg2.getM().begin(); it!=msg2.getM().end(); it++) EV << " " << it->first << ":" << it->second; EV << "\n"; EV << "vl:"; for (IntVectorList::const_iterator it=msg2.getVl().begin(); it!=msg2.getVl().end(); it++) { EV << " ["; for (IntVector::const_iterator it2=it->begin(); it2!=it->end(); it2++) EV << " " << *it2; EV << " ]"; } EV << "\n"; EV << "lv:"; for (IntListVector::const_iterator it=msg2.getLv().begin(); it!=msg2.getLv().end(); it++) { EV << " ["; for (IntList::const_iterator it2=it->begin(); it2!=it->end(); it2++) EV << " " << *it2; EV << " ]"; } EV << "\n"; %contains: stdout isBufferEmpty:1 v: 1 5 l: 99 54 63 s: 123 888 m: 2:2.71 3:3.14 vl: [ 5 7 ] lv: [ 5 7 ]