00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _T_MSG_HH_
00011 #define _T_MSG_HH_
00012
00013 #include <rtworks/ipc.h>
00014 #include <rtworks/tmt.h>
00015 #include <rtworks/tsystem.h>
00016 namespace SmartSockets
00017 {
00018
00019 class System;
00020 class XML;
00027 class T_IPCX_API TipcMsgException : public TipcException {
00028
00029 public:
00033 TipcMsgException () {}
00034
00038 ~TipcMsgException () throw() {}
00039
00040 };
00041
00045 class T_IPCX_API TipcMsgTraverser {
00046 public:
00047
00063 typedef bool (TipcMsgTraverser::* Handler)
00064 (
00065 const TipcMsg& msg,
00066 T_IPC_FT type,
00067 bool isUnknown,
00068 void* valuePtr,
00069 int4 size,
00070 T_IPC_MSG_FIELD field,
00071 int4 index,
00072 const char* name
00073 ) ;
00074
00075
00076
00077 TipcMsgTraverser();
00078
00083 void setHandler(Handler cbMethod);
00084
00088 Handler getHandler();
00089
00090
00094 virtual ~TipcMsgTraverser() throw();
00095
00111 virtual bool onTraverse
00112 (
00113 const TipcMsg& msg,
00114 T_IPC_FT type,
00115 bool isUnknown,
00116 void* valuePtr,
00117 int4 size,
00118 T_IPC_MSG_FIELD field,
00119 int4 index,
00120 const char* name
00121 )
00122 throw () ;
00123
00124 static T_PTR T_ENTRY traverseFuncDelegator
00125 (
00126 T_IPC_MSG msg,
00127 T_IPC_MSG_TRAV trav,
00128 T_PTR arg
00129 );
00130
00131 private:
00132
00133 Handler _cbMethod;
00134
00135
00136 };
00137
00138
00139 class T_IPCX_API TipcSrv;
00140 class T_IPCX_API TipcMsgFile;
00141
00167 class T_IPCX_API TipcMsg {
00168 private:
00170
00171 friend class T_IPCX_API TipcConn;
00172 friend class T_IPCX_API TipcSrv;
00173 friend class T_IPCX_API TipcMsgFile;
00174
00176
00177 int4 _size;
00178
00179 T_IPC_MSG _msg;
00180
00181
00182 void destroyMsg() throw (TipcException);
00183
00184 void absorb(T_IPC_MSG msg);
00185
00186 protected:
00187
00216 void incrRefCount() throw (TipcException);
00217
00218 public:
00219
00223 TipcMsg()
00224 {
00225 _size = 0;
00226 _msg = (T_IPC_MSG)T_NULL;
00227 }
00228
00234 TipcMsg(const TipcMt& mt)
00235 throw (TipcException);
00236
00237
00238
00239
00240
00256 explicit TipcMsg(int4 mtNum,
00257 const char * destination = (const char *)T_NULL,
00258 const char * sender = (const char *)T_NULL)
00259 throw (TipcException);
00260
00270 explicit TipcMsg(const char * mtName)
00271 throw (TipcException);
00272
00279 TipcMsg(const T_IPC_MSG msg)
00280 throw (TipcException);
00281
00288 TipcMsg(const TipcMsg& msg)
00289 throw (TipcException);
00290
00298 TipcMsg& operator=(const T_IPC_MSG msg)
00299 throw (TipcException);
00300 TipcMsg& operator=(const TipcMsg& msg)
00301 throw (TipcException);
00302
00304
00314 ~TipcMsg() throw ();
00315
00316
00320 void destroy() throw (TipcException)
00321 {
00322 destroyMsg();
00323 }
00324
00329 TipcMsg* clone() const
00330 throw (TipcException);
00331
00332
00338 operator T_IPC_MSG() const throw () { return _msg;}
00339
00345 static const char* deliveryModeToStr(T_IPC_DELIVERY_MODE delivery_mode)
00346 throw (TipcException);
00347
00348 static T_IPC_DELIVERY_MODE strToDeliveryMode(const char * delivery_str)
00349 throw (TipcException);
00350
00351
00352 static const char* ftToStr(T_IPC_FT type)
00353 throw (TipcException);
00354
00355 static T_IPC_FT strToFt(const char * str)
00356 throw (TipcException);
00357
00358 static const char* lbModeToStr(T_IPC_LB_MODE lb_mode)
00359 throw (TipcException);
00360
00361 static T_IPC_LB_MODE strToLbMode(const char * str)
00362 throw (TipcException);
00363
00365
00366
00367
00372 static TipcMsg& setName(TipcMsg& msg, const char* name)
00373 {
00374 T_INT4 curr = msg.getNumFields();
00375 msg.setCurrent(curr - 1);
00376 msg.setNameCurrent(const_cast <char*>(name));
00377 return msg;
00378 }
00379
00380 static const TipcMsg& getName(const TipcMsg& msg, const char*& nameReturn)
00381 {
00382 nameReturn = msg.getNameCurrent();
00383
00384 return msg;
00385 }
00386
00387
00388
00389
00390 static TipcMsg& setSize(TipcMsg& msg, int4 size)
00391 {
00392 msg._size = size;
00393 return msg;
00394 }
00395
00396
00397
00398 static const TipcMsg& getSize(const TipcMsg& msg, int4& size_return)
00399 {
00400 size_return = msg._size;
00401 return msg;
00402 }
00404
00405
00416 static void setFieldSize(T_IPC_MSG_FIELD field, int4 size)
00417 throw (TipcException);
00418
00419
00420
00429 void traverse(TipcMsgTraverser* travObj)
00430 throw (TipcException);
00431
00439 bool isReadOnly() const
00440 throw (TipcException);
00441
00450 bool isCurrentFieldKnown() const
00451 throw (TipcException);
00452
00459 int2 getRefCount() const
00460 throw (TipcException);
00461
00481 int4 getSeqNum() const
00482 throw (TipcException);
00483
00484
00490 uint4 getPacketSize() const
00491 throw (TipcException);
00492
00493
00508 const char * getDest() const
00509 throw (TipcException);
00510
00511 void setDest(const char * dest_return)
00512 throw (TipcException);
00513
00514 const char * getSender() const
00515 throw (TipcException);
00516
00517 void setSender(const char * sender)
00518 throw (TipcException);
00520
00537 const TipcMt getType() const
00538 throw (TipcException);
00539
00540 int4 getTypeNum() const
00541 throw (TipcException);
00542
00543 void setType(const TipcMt& mt)
00544 throw (TipcException);
00545
00547
00548
00561 int4 getCurrent() const
00562 throw (TipcException);
00563 void setCurrent(int4 field_num) throw (TipcException);
00565
00566
00586 int4 getNumFields() const throw (TipcException);
00587 void setNumFields(int4 num_fields) throw (TipcException);
00589
00590
00606 int2 getPriority() const throw (TipcException);
00607 void setPriority(int2 priority) throw (TipcException);
00609
00610
00638 int4 getUserProp() const throw (TipcException);
00639 void setUserProp(int4 user_prop) throw (TipcException);
00641
00642
00660 bool getCompression() const throw (TipcException);
00661 void setCompression(bool compression) throw (TipcException);
00663
00664
00688 real8 getDeliveryTimeout() const throw (TipcException);
00689 void setDeliveryTimeout(real8 timeout) throw (TipcException);
00690
00692
00693
00765 T_IPC_DELIVERY_MODE getDeliveryMode() const
00766 throw (TipcException);
00767 void setDeliveryMode(T_IPC_DELIVERY_MODE mode)
00768 throw (TipcException);
00769
00770
00772
00773
00814 T_IPC_LB_MODE getLbMode() const throw (TipcException);
00815 void setLbMode(T_IPC_LB_MODE lb_mode) throw (TipcException);
00817
00836
00837 bool isUsingHeaderStrEncode() const throw (TipcException);
00838 void setHeaderStrEncode(bool header_encode)
00839 throw (TipcException);
00840
00842
00843
00856
00857 const char * getMessageId() const throw (TipcException);
00858 void generateMessageId() throw (TipcException);
00860
00871 const char * getCorrelationId() const throw (TipcException);
00872 void setCorrelationId(const char * correlation_id) throw (TipcException);
00874
00883 const char * getReplyTo() const throw (TipcException);
00884 void setReplyTo(const char * subj) throw (TipcException);
00886
00887
00895 real8 getExpiration() const throw (TipcException);
00896 void setExpiration(real8 expiration) throw (TipcException);
00898
00899
00900
00907 real8 getSenderTimestamp() const throw (TipcException);
00908 void setSenderTimestamp(real8 timestamp) throw (TipcException);
00909
00911
00912
00921 real8 getArrivalTimestamp() const throw (TipcException);
00922 void setArrivalTimestamp(real8 timestamp) throw (TipcException);
00924
00925
00938 void encrypt() throw (TipcException);
00939
00955 void decrypt() throw (TipcException);
00956
00993 void ack() throw (TipcException);
00994
00995
00996
01032 TipcMsg& operator<<(bool arg)
01033 throw (TipcException);
01034
01035 TipcMsg& operator<<(const bool* arg)
01036 throw (TipcException);
01037
01038 TipcMsg& operator<<(const void * arg)
01039 throw (TipcException);
01040 TipcMsg& operator<<(char arg)
01041 throw (TipcException);
01042 TipcMsg& operator<<(int2 arg)
01043 throw (TipcException);
01044 TipcMsg& operator<<(const int2* arg)
01045 throw (TipcException);
01046 TipcMsg& operator<<(int4 arg)
01047 throw (TipcException);
01048 TipcMsg& operator<<(const int4* arg)
01049 throw (TipcException);
01050 TipcMsg& operator<<(int8 arg)
01051 throw (TipcException);
01052 TipcMsg& operator<<(const int8* arg)
01053 throw (TipcException);
01054 TipcMsg& operator<<(const TipcMsg& arg)
01055 throw (TipcException);
01056 TipcMsg& operator<<(const TipcMsg* arg)
01057 throw (TipcException);
01058 TipcMsg& operator<<(real4 arg)
01059 throw (TipcException);
01060 TipcMsg& operator<<(const real4* arg)
01061 throw (TipcException);
01062 TipcMsg& operator<<(real8 arg)
01063 throw (TipcException);
01064 TipcMsg& operator<<(const real8* arg)
01065 throw (TipcException);
01066 TipcMsg& operator<<(real16 arg)
01067 throw (TipcException);
01068 TipcMsg& operator<<(const real16* arg)
01069 throw (TipcException);
01070 TipcMsg& operator<<(const char * arg)
01071 throw (TipcException);
01072 TipcMsg& operator<<(const char ** arg)
01073 throw (TipcException);
01074 TipcMsg& operator<<(const XML& arg)
01075 throw (TipcException);
01076 TipcMsg& operator<<(unsigned char arg)
01077 throw (TipcException);
01078
01080
01081
01114
01115 const TipcMsg& operator>>(bool& arg) const
01116 throw (TipcException);
01117 const TipcMsg& operator>>(const void * & arg) const
01118 throw (TipcException);
01119 const TipcMsg& operator>>(char& arg) const
01120 throw (TipcException);
01121 const TipcMsg& operator>>(int2& arg) const
01122 throw (TipcException);
01123 const TipcMsg& operator>>(const int2*& arg) const
01124 throw (TipcException);
01125 const TipcMsg& operator>>(int4& arg) const
01126 throw (TipcException);
01127 const TipcMsg& operator>>(const int4*& arg) const
01128 throw (TipcException);
01129 const TipcMsg& operator>>(int8& arg) const
01130 throw (TipcException);
01131 const TipcMsg& operator>>(const int8*& arg) const
01132 throw (TipcException);
01133 const TipcMsg& operator>>(TipcMsg& arg) const
01134 throw (TipcException);
01135 const TipcMsg& operator>>(real4& arg) const
01136 throw (TipcException);
01137 const TipcMsg& operator>>(const real4*& arg) const
01138 throw (TipcException);
01139 const TipcMsg& operator>>(real8& arg) const
01140 throw (TipcException);
01141 const TipcMsg& operator>>(const real8*& arg) const
01142 throw (TipcException);
01143 const TipcMsg& operator>>(real16& arg) const
01144 throw (TipcException);
01145 const TipcMsg& operator>>(const real16*& arg) const
01146 throw (TipcException);
01147 const TipcMsg& operator>>(const char *& arg) const
01148 throw (TipcException);
01149 const TipcMsg& operator>>(const char **& arg) const
01150 throw (TipcException);
01151 const TipcMsg& operator>>(XML& arg) const
01152 throw (TipcException);
01153 const TipcMsg& operator>>(unsigned char& arg) const
01154 throw (TipcException);
01155
01157
01204 const TipcMsg& operator>>(TipcMsg*& arg) const
01205 throw (TipcException);
01206
01207 const TipcMsg& operator>>(bool*& arg) const
01208 throw (TipcException);
01209
01210
01212
01213
01221 void append(const void * binary_data, int4 binary_size)
01222 throw (TipcException);
01223 void append(char char_data)
01224 throw (TipcException);
01225 void append(int2 int2_data)
01226 throw (TipcException);
01227 void append(const int2* int2_array_data, int4 int2_array_size)
01228 throw (TipcException);
01229 void append(int4 int4_data)
01230 throw (TipcException);
01231 void append(const int4* int4_array_data, int4 int4_array_size)
01232 throw (TipcException);
01233 void append(int8 int8_data)
01234 throw (TipcException);
01235 void append(const int8 *int8_array_data, int4 int8_array_size)
01236 throw (TipcException);
01237 void append(const TipcMsg& msg_data)
01238 throw (TipcException);
01239 void append(const TipcMsg* msg_array_data, int4 msg_array_size)
01240 throw (TipcException);
01241 void append(real4 real4_data)
01242 throw (TipcException);
01243 void append(const real4* real4_array_data, int4 real4_array_size)
01244 throw (TipcException);
01245 void append(real8 real8_data)
01246 throw (TipcException);
01247 void append(const real8* real8_array_data, int4 real8_array_size)
01248 throw (TipcException);
01249 void append(real16 real16_data)
01250 throw (TipcException);
01251 void append(const real16 *real16_array_data, int4 real16_array_size)
01252 throw (TipcException);
01253 void append(const char * str_data)
01254 throw (TipcException);
01255 void append(const char ** str_array_data, int4 str_array_size)
01256 throw (TipcException);
01257 void append(const char * str_data, real8 real8_data)
01258 throw (TipcException);
01259 void append(const XML& xml_data)
01260 throw (TipcException);
01261 void append(unsigned char byte_data)
01262 throw (TipcException);
01263 void append(bool bool_data)
01264 throw (TipcException);
01265 void append(const bool* bool_array_data, int4 bool_array_size)
01266 throw (TipcException);
01268
01274 void appendTimestamp(real8 timestamp_data)
01275 throw (TipcException);
01276 void appendTimestampArray(const real8 *timestamp_data,
01277 int4 real8_array_size)
01278 throw (TipcException);
01280
01288
01289 void appendUtf8(const char * str_data)
01290 throw (TipcException);
01291 void appendUtf8(const char ** str_array_data, int4 str_array_size)
01292 throw (TipcException);
01294
01295
01315 T_IPC_MSG_FIELD appendPtr(const void * binary_data, int4 binary_data_size)
01316 throw (TipcException);
01317
01318 T_IPC_MSG_FIELD appendPtr(const int2 *int2_array_data, int4 int2_array_size)
01319 throw (TipcException);
01320
01321 T_IPC_MSG_FIELD appendPtr(const int4 *int4_array_data, int4 int4_array_size)
01322 throw (TipcException);
01323
01324 T_IPC_MSG_FIELD appendPtr(const int8 *int8_array_data, int4 int8_array_size)
01325 throw (TipcException);
01326
01327 T_IPC_MSG_FIELD appendPtr(const TipcMsg& msg_data)
01328 throw (TipcException);
01329
01330 T_IPC_MSG_FIELD appendPtr(const TipcMsg* arg, int4 size)
01331 throw (TipcException);
01332
01333 T_IPC_MSG_FIELD appendPtr(const real4 *real4_array_data, int4 real4_array_size)
01334 throw (TipcException);
01335
01336 T_IPC_MSG_FIELD appendPtr(const real8 *real8_array_data, int4 real8_array_size)
01337 throw (TipcException);
01338
01339 T_IPC_MSG_FIELD appendPtr(const real16 *real16_array_data, int4 size)
01340 throw (TipcException);
01341
01342 T_IPC_MSG_FIELD appendPtr(const char * str_data)
01343 throw (TipcException);
01344
01345 T_IPC_MSG_FIELD appendPtr(const char * *str_array_data, int4 str_array_size)
01346 throw (TipcException);
01347
01348 T_IPC_MSG_FIELD appendPtr(const XML& xml_data)
01349 throw (TipcException);
01350
01351 T_IPC_MSG_FIELD appendPtr(bool *bool_array_data, int4 bool_array_size)
01352 throw (TipcException);
01354
01360 T_IPC_MSG_FIELD appendTimestampArrayPtr(const real8 *timestamp_array_data,
01361 int4 timestamp_array_size)
01362 throw (TipcException);
01364
01385 T_IPC_MSG_FIELD appendUtf8Ptr(const char * str_data)
01386 throw (TipcException);
01387
01388 T_IPC_MSG_FIELD appendUtf8Ptr(const char * *str_array_data, int4 str_array_size)
01389 throw (TipcException);
01390
01391
01393
01397 void appendUnknown(T_IPC_FT field_type)
01398 throw (TipcException);
01399
01409
01410 void updatePtr(T_IPC_MSG_FIELD field, const void * binary_data,
01411 int4 binary_data_size)
01412 throw (TipcException);
01413
01414 void updatePtr(T_IPC_MSG_FIELD field, const int2 *int2_array_data,
01415 int4 int2_array_size)
01416 throw (TipcException);
01417
01418 void updatePtr(T_IPC_MSG_FIELD field, const int4 *int4_array_data,
01419 int4 int4_array_size)
01420 throw (TipcException);
01421
01422 void updatePtr(T_IPC_MSG_FIELD field, const int8 *int8_array_data,
01423 int4 int8_array_size)
01424 throw (TipcException);
01425
01426 void updatePtr(T_IPC_MSG_FIELD field, const TipcMsg& msg_data)
01427 throw (TipcException);
01428
01429 void updatePtr(T_IPC_MSG_FIELD field, const TipcMsg* msg_array_data,
01430 int4 msg_array_size)
01431 throw (TipcException);
01432
01433 void updatePtr(T_IPC_MSG_FIELD field, const real4 *real4_array_data,
01434 int4 real4_array_size)
01435 throw (TipcException);
01436
01437 void updatePtr(T_IPC_MSG_FIELD field, const real8 *real8_array_data,
01438 int4 real8_array_size)
01439 throw (TipcException);
01440
01441 void updatePtr(T_IPC_MSG_FIELD field, const real16 *real16_array_data,
01442 int4 size)
01443 throw (TipcException);
01444
01445 void updatePtr(T_IPC_MSG_FIELD field, const char * str_data)
01446 throw (TipcException);
01447
01448 void updatePtr(T_IPC_MSG_FIELD field, const char * *str_array_data,
01449 int4 str_array_size)
01450 throw (TipcException);
01451
01452 void updatePtr(T_IPC_MSG_FIELD field, const XML& xml_data)
01453 throw (TipcException);
01454
01455 void updatePtr(T_IPC_MSG_FIELD field, const bool *bool_array_data,
01456 int4 bool_array_size)
01457 throw (TipcException);
01458
01459 void updateTimestampArrayPtr(T_IPC_MSG_FIELD field,
01460 const real8 * real8_array_data,
01461 int4 real8_array_size)
01462 throw (TipcException);
01463
01464 void updateUtf8Ptr(T_IPC_MSG_FIELD field, const char * str_data)
01465 throw (TipcException);
01466
01467 void updateUtf8Ptr(T_IPC_MSG_FIELD field, const char * *str_array_data,
01468 int4 str_array_size)
01469 throw (TipcException);
01471
01472
01485 const void* nextBinary(int4& size) const
01486 throw (TipcException);
01487
01488 char nextChar() const
01489 throw (TipcException);
01490
01491 int2 nextInt2() const
01492 throw (TipcException);
01493
01494 const int2* nextInt2Array(int4& size) const
01495 throw (TipcException);
01496
01497 int4 nextInt4() const
01498 throw (TipcException);
01499
01500 const int4* nextInt4Array(int4& size) const
01501 throw (TipcException);
01502
01503 int8 nextInt8() const
01504 throw (TipcException);
01505
01506 const int8* nextInt8Array(int4& size) const
01507 throw (TipcException);
01508
01509 const TipcMsg nextMsg() const
01510 throw (TipcException);
01511
01512
01513 real4 nextReal4() const
01514 throw (TipcException);
01515
01516 const real4* nextReal4Array(int4& size) const
01517 throw (TipcException);
01518
01519 real8 nextReal8() const
01520 throw (TipcException);
01521
01522 const real8* nextReal8Array(int4& size) const
01523 throw (TipcException);
01524
01525 real16 nextReal16() const
01526 throw (TipcException);
01527
01528 const real16* nextReal16Array(int4& size) const
01529 throw (TipcException);
01530
01531 const char* nextString() const
01532 throw (TipcException);
01533
01534 const char** nextStringArray(int4& size) const
01535 throw (TipcException);
01536
01537 const XML nextXML() const
01538 throw (TipcException);
01539
01540 unsigned char nextByte() const
01541 throw (TipcException);
01542
01543 bool nextBool() const
01544 throw (TipcException);
01545
01546 real8 nextTimestamp() const
01547 throw (TipcException);
01548
01549 const real8* nextTimestampArray(int4& size) const
01550 throw (TipcException);
01551
01552 const char* nextUtf8() const
01553 throw (TipcException);
01554
01555 const char** nextUtf8Array(int4 &size) const
01556 throw (TipcException);
01557
01559
01571 TipcMsg* nextMsgArray(int4& size) const
01572 throw (TipcException);
01573
01574
01575
01587 bool* nextBoolArray(int4 &size) const
01588 throw (TipcException);
01589
01590 #if 0
01591
01626 template <class InsertIterator> void nextBoolArray (InsertIterator it)
01627 throw (TipcException)
01628 {
01629 T_BOOL *c_api_bool_array;
01630 int4 sizeReturn
01631 if (!TipcMsgNextMsgArray(_msg, &c_api_bool_array, &sizeReturn)) {
01632 throw (TipcException);
01633 }
01634
01635 for (int4 i = 0; i < sizeReturn; i ++) {
01636 *it = c_api_bool_array[i];
01637 }
01638 }
01639
01669 template <class InsertIterator> void nextMsgArray (InsertIterator it)
01670 throw (TipcException)
01671 {
01672 T_IPC_MSG *c_api_msg_array;
01673 int4 sizeReturn
01674 if (!TipcMsgNextMsgArray(_msg, &c_api_msg_array, &sizeReturn)) {
01675 throw (TipcException);
01676 }
01677
01678 for (int4 i = 0; i < sizeReturn; i ++) {
01679 *it = c_api_msg_array[i];
01680 }
01681 }
01682 #endif
01683
01691 void nextUnknown() const
01692 throw (TipcException);
01693
01694
01695
01704 void addNamed(const char * name, const void * value, int4 size)
01705 throw (TipcException);
01706
01707
01708 void addNamed(const char * name, char value)
01709 throw (TipcException);
01710
01711 void addNamed(const char * name, int2 value)
01712 throw (TipcException);
01713
01714 void addNamed(const char * name, const int2 *value, int4 size)
01715 throw (TipcException);
01716
01717 void addNamed(const char * name, int4 value)
01718 throw (TipcException);
01719
01720 void addNamed(const char * name, const int4 *value, int4 size)
01721 throw (TipcException);
01722
01723
01724 void addNamed(const char * name, int8 value)
01725 throw (TipcException);
01726
01727 void addNamed(const char * name, const int8 *value, int4 size)
01728 throw (TipcException);
01729 void addNamed(const char * name, const TipcMsg& value)
01730 throw (TipcException);
01731
01732 void addNamed(const char * name, const TipcMsg *value, int4 size)
01733 throw (TipcException);
01734 void addNamed(const char * name, real4 value)
01735 throw (TipcException);
01736
01737 void addNamed(const char * name, const real4 *value, int4 size)
01738 throw (TipcException);
01739
01740 void addNamed(const char * name, real8 value)
01741 throw (TipcException);
01742
01743 void addNamed(const char * name, const real8 *value, int4 size)
01744 throw (TipcException);
01745
01746 void addNamed(const char * name, real16 value)
01747 throw (TipcException);
01748
01749 void addNamed(const char * name, const real16 *value, int4 size)
01750 throw (TipcException);
01751 void addNamed(const char * name, const char * value)
01752 throw (TipcException);
01753
01754 void addNamed(const char * name, const char * *value, int4 size)
01755 throw (TipcException);
01756
01757 void addNamed(const char * name, const XML& value)
01758 throw (TipcException);
01759
01760 void addNamed(const char * name, unsigned char value)
01761 throw (TipcException);
01762
01763 void addNamed(const char * name, bool value)
01764 throw (TipcException);
01765
01766 void addNamed(const char * name, const bool *value, int4 size)
01767 throw (TipcException);
01768
01769 void addNamedTimestamp(const char * name, real8 value)
01770 throw (TipcException);
01771
01772 void addNamedTimestampArray(const char *name, const real8 *value, int4 size)
01773 throw (TipcException);
01774
01775 void addNamedUtf8(const char * name, const char * value)
01776 throw (TipcException);
01777
01778 void addNamedUtf8Array(const char * name, const char * *value, int4 size)
01779 throw (TipcException);
01780
01781 void addNamedUnknown(const char * name, T_IPC_FT field_type)
01782 throw (TipcException);
01783
01785
01804 T_IPC_MSG_FIELD addNamedPtr(const char * name, const bool *value, int4 size)
01805 throw (TipcException);
01806
01807 T_IPC_MSG_FIELD addNamedPtr(const char * name, const XML& value)
01808 throw (TipcException);
01809
01810
01811 T_IPC_MSG_FIELD addNamedPtr(const char * name, const real16 *value, int4 size)
01812 throw (TipcException);
01813
01814 T_IPC_MSG_FIELD addNamedPtr(const char * name, const real8 *value, int4 size)
01815 throw (TipcException);
01816
01817 T_IPC_MSG_FIELD addNamedPtr(const char * name, const real4 *value, int4 size)
01818 throw (TipcException);
01819
01820 T_IPC_MSG_FIELD addNamedPtr(const char * name, const TipcMsg *value, int4 size)
01821 throw (TipcException);
01822
01823 T_IPC_MSG_FIELD addNamedPtr(const char * name, const TipcMsg& value)
01824 throw (TipcException);
01825
01826 T_IPC_MSG_FIELD addNamedPtr(const char * name, const int4 *value, int4 size)
01827 throw (TipcException);
01828
01829 T_IPC_MSG_FIELD addNamedPtr(const char * name, const void * value, int4 size)
01830 throw (TipcException);
01831
01832 T_IPC_MSG_FIELD addNamedPtr(const char * name, const int2 *value, int4 size)
01833 throw (TipcException);
01834
01835 T_IPC_MSG_FIELD addNamedPtr(const char * name, const int8 *value, int4 size)
01836 throw (TipcException);
01837
01838 T_IPC_MSG_FIELD addNamedPtr(const char * name, const char * *value, int4 size)
01839 throw (TipcException);
01840
01841 T_IPC_MSG_FIELD addNamedPtr(const char * name, const char * value)
01842 throw (TipcException);
01843
01844 T_IPC_MSG_FIELD addNamedTimestampArrayPtr(const char * name,
01845 const real8 *value,
01846 int4 size)
01847 throw (TipcException);
01848
01849 T_IPC_MSG_FIELD addNamedUtf8ArrayPtr(const char * name, const char * *value, int4 size)
01850 throw (TipcException);
01851
01852 T_IPC_MSG_FIELD addNamedUtf8Ptr(const char * name, const char * value)
01853 throw (TipcException);
01854
01856
01869 const void* getNamedBinary(const char * name, int4& size) const
01870 throw (TipcException);
01871
01872 char getNamedChar(const char * name) const
01873 throw (TipcException);
01874
01875 int2 getNamedInt2(const char * name) const
01876 throw (TipcException);
01877
01878 const int2* getNamedInt2Array(const char * name, int4& size) const
01879 throw (TipcException);
01880
01881 int4 getNamedInt4(const char * name) const
01882 throw (TipcException);
01883
01884 const int4* getNamedInt4Array(const char * name, int4& size) const
01885 throw (TipcException);
01886
01887 int8 getNamedInt8(const char * name) const
01888 throw (TipcException);
01889
01890 const int8* getNamedInt8Array(const char * name, int4& size) const
01891 throw (TipcException);
01892
01893 const TipcMsg getNamedMsg(const char * name) const
01894 throw (TipcException);
01895
01896
01897 real4 getNamedReal4(const char * name) const
01898 throw (TipcException);
01899
01900 const real4* getNamedReal4Array(const char * name, int4& size) const
01901 throw (TipcException);
01902
01903 real8 getNamedReal8(const char * name) const
01904 throw (TipcException);
01905
01906 const real8* getNamedReal8Array(const char * name, int4& size) const
01907 throw (TipcException);
01908
01909 real16 getNamedReal16(const char * name) const
01910 throw (TipcException);
01911
01912 const real16* getNamedReal16Array(const char * name, int4& size) const
01913 throw (TipcException);
01914
01915 const char* getNamedString(const char * name) const
01916 throw (TipcException);
01917
01918 const char** getNamedStringArray(const char * name, int4& size) const
01919 throw (TipcException);
01920
01921 const XML getNamedXML(const char * name) const
01922 throw (TipcException);
01923
01924 unsigned char getNamedByte(const char * name) const
01925 throw (TipcException);
01926
01927 bool getNamedBool(const char * name) const
01928 throw (TipcException);
01929
01930 real8 getNamedTimestamp(const char * name) const
01931 throw (TipcException);
01932
01933 const real8 *getNamedTimestampArray(const char * name, int4& size) const
01934 throw (TipcException);
01935
01936 const char* getNamedUtf8(const char * name) const
01937 throw (TipcException);
01938
01939 const char** getNamedUtf8Array(const char * name, int4& size) const
01940 throw (TipcException);
01941
01942 void getNamedUnknown(const char * name) const
01943 throw (TipcException);
01944
01946
01947
01972 TipcMsg* getNamedMsgArray(const char * name, int4& size) const
01973 throw (TipcException);
01974
01975
02001 bool* getNamedBoolArray(const char * name, int4& size) const
02002 throw (TipcException);
02003
02004
02005
02011 T_IPC_FT getTypeNamed(const char * name) const
02012 throw (TipcException);
02013
02014
02018 bool existsNamed(const char * name) const
02019 throw (TipcException);
02020
02024 void setNameCurrent(const char * name)
02025 throw (TipcException);
02026
02030 const char* getNameCurrent() const
02031 throw (TipcException);
02032
02033
02037 void deleteCurrent()
02038 throw (TipcException);
02039
02043 void deleteField(int4 index)
02044 throw (TipcException);
02045
02049 void deleteNamed(const char * name)
02050 throw (TipcException);
02057 void updateNamed(const char * name, const void * value, int4 size)
02058 throw (TipcException);
02059 void updateNamed(const char * name, char value)
02060 throw (TipcException);
02061
02062 void updateNamed(const char * name, int2 value)
02063 throw (TipcException);
02064
02065 void updateNamed(const char * name, const int2 *value, int4 size)
02066 throw (TipcException);
02067
02068 void updateNamed(const char * name, int4 value)
02069 throw (TipcException);
02070 void updateNamed(const char * name, const int4 *value, int4 size)
02071 throw (TipcException);
02072
02073 void updateNamed(const char * name, int8 value)
02074 throw (TipcException);
02075 void updateNamed(const char * name, const int8 *value, int4 size)
02076 throw (TipcException);
02077
02078 void updateNamed(const char * name, const TipcMsg& value)
02079 throw (TipcException);
02080 void updateNamed(const char * name, const TipcMsg *value, int4 size)
02081 throw (TipcException);
02082 void updateNamed(const char * name, real4 value)
02083 throw (TipcException);
02084 void updateNamed(const char * name, const real4 *value, int4 size)
02085 throw (TipcException);
02086 void updateNamed(const char * name, real8 value)
02087 throw (TipcException);
02088 void updateNamed(const char * name, const real8 *value, int4 size)
02089 throw (TipcException);
02090 void updateNamed(const char * name, real16 value)
02091 throw (TipcException);
02092
02093 void updateNamed(const char * name, const real16 *value, int4 size)
02094 throw (TipcException);
02095
02096 void updateNamed(const char * name, const char * value)
02097 throw (TipcException);
02098
02099 void updateNamed(const char * name, const char * *value, int4 size)
02100 throw (TipcException);
02101
02102 void updateNamed(const char * name, const XML& value)
02103 throw (TipcException);
02104
02105 void updateNamed(const char * name, unsigned char value)
02106 throw (TipcException);
02107
02108 void updateNamed(const char * name, bool value)
02109 throw (TipcException);
02110 void updateNamed(const char * name, const bool *value, int4 size)
02111 throw (TipcException);
02112
02113 void updateNamedTimestamp(const char * name, real8 value)
02114 throw (TipcException);
02115
02116 void updateNamedTimestampArray(const char *name,
02117 const real8 *value,
02118 int4 size)
02119 throw (TipcException);
02120
02121 void updateNamedUtf8(const char * name, const char * value)
02122 throw (TipcException);
02123
02124 void updateNamedUtf8(const char * name, const char **value, int4 size)
02125 throw (TipcException);
02126
02128
02139 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const int8 *value, int4 size)
02140 throw (TipcException);
02141
02142 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const int4 *value, int4 size)
02143 throw (TipcException);
02144
02145 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const int2 *value, int4 size)
02146 throw (TipcException);
02147
02148 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const void * value, int4 size)
02149 throw (TipcException);
02150
02151
02152 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const TipcMsg *value, int4 size)
02153 throw (TipcException);
02154
02155 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const TipcMsg& value)
02156 throw (TipcException);
02157
02158
02159 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const real4 *value, int4 size)
02160 throw (TipcException);
02161
02162 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const real8 *value, int4 size)
02163 throw (TipcException);
02164
02165 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const real16 *value, int4 size)
02166 throw (TipcException);
02167
02168 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const char * *value, int4 size)
02169 throw (TipcException);
02170
02171 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const char * value)
02172 throw (TipcException);
02173
02174
02175 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const XML& value)
02176 throw (TipcException);
02177
02178 T_IPC_MSG_FIELD updateNamedPtr(const char * name, const bool *value, int4 size)
02179 throw (TipcException);
02180
02181 T_IPC_MSG_FIELD updateNamedTimestampArrayPtr(const char * name,
02182 const real8 * value,
02183 int4 size)
02184 throw (TipcException);
02185
02186 T_IPC_MSG_FIELD updateNamedUtf8Ptr(const char * name, const char ** value, int4 size)
02187 throw (TipcException);
02188
02189 T_IPC_MSG_FIELD updateNamedUtf8Ptr(const char * name, const char * value)
02190 throw (TipcException);
02191
02193
02202 void print(T_OUT_FUNC out_func = (T_OUT_FUNC) ::TutOut) const
02203 throw (TipcException);
02204
02217 void reset() throw (TipcException);
02218
02219 };
02220
02221
02222 #if 1
02223
02224
02244 template <class OutputStream>
02245 inline OutputStream& operator << (OutputStream& os,
02246 const TipcMsg& msgArg )
02247 {
02248 T_IPC_BUF buf = TutBufCreate(0);
02249
02250 int1 integerFormat = (int1)System::getIntFormat();
02251 os.write ((const char*)&integerFormat, sizeof (integerFormat));
02252
02253 try {
02254
02255 T_INT4 size;
02256 char *data;
02257 T_IPC_MSG msg = (T_IPC_MSG) msgArg;
02258 T_BOOL result = T_FALSE;
02259
02260 if (NULL != buf) {
02261 result = TmsgBufMsgSerializeEx(buf, msgArg, NULL, 0,
02262 (T_PTR*)&data, &size);
02263 }
02264
02265 if (result == T_TRUE) {
02266 os.write((const char*)&size, sizeof (size));
02267 os.write(data, size);
02268 }
02269 else {
02270 os.clear(os.badbit);
02271 }
02272 }
02273 catch (...) {
02274 os.clear(os.badbit);
02275 }
02276
02277 TutBufDestroy(buf);
02278 return os;
02279 }
02280
02281
02282
02283
02284
02303 template <class InputStream>
02304 inline InputStream& operator >> (InputStream& is,
02305 TipcMsg& msgArg )
02306 {
02307 int1 integerFormat = 0;
02308
02309 is.read ((char*)&integerFormat, sizeof(integerFormat));
02310
02311
02312 bool samePlatform = ((int1)System::getIntFormat() == integerFormat);
02313
02314 uint4 size = 0;
02315 is.read ((char*)&size, sizeof(size));
02316
02317
02318 if (!samePlatform) {
02319 char tmp_val;
02320
02321 tmp_val = ((char*)(&size))[0];
02322 ((char*)(&size))[0] = ((char*)(&size))[3];
02323 ((char*)(&size))[3] = tmp_val;
02324
02325 tmp_val = ((char*)(&size))[1];
02326 ((char*)(&size))[1] = ((char*)(&size))[2];
02327 ((char*)(&size))[2] = tmp_val;
02328
02329 }
02330
02331 char * buff = new char [size];
02332
02333 if (buff) {
02334 is.read(buff,size);
02335 }
02336 if (!is.bad()) {
02337
02338
02339 T_IPC_BUF tmp = TutBufCreateStatic(buff, size);
02340 if (NULL != tmp) {
02341 TutBufSetSize (tmp, size);
02342 T_IPC_MSG msg = TipcBufMsgNext(tmp);
02343
02344 if (!msg) {
02345 is.clear(is.badbit);
02346 }
02347 else {
02348 msgArg = msg;
02349 TipcMsgDestroy(msg);
02350 }
02351
02352 TutBufDestroy(tmp);
02353 }
02354 }
02355
02356 delete [] buff;
02357
02358 return is;
02359 }
02360
02361
02362 inline const TipcMsg& operator >> (const TipcMsg & msg, TipcMsg & msgArg)
02363 {
02364 return (msg.operator >> (msgArg));
02365 }
02366
02367 inline TipcMsg & operator >> (TipcMsg & msg,
02368 TipcMsg & msgArg)
02369 {
02370 return const_cast <TipcMsg &> (msg.operator >> (msgArg));
02371 }
02372
02373 #endif
02374
02375 }
02376
02377
02378
02379
02380 #endif //_T_MSG_HH_
02381
02382