Changeset 7535 for source/ariba/DataMessage.h
- Timestamp:
- Feb 5, 2010, 9:08:33 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/DataMessage.h
r7500 r7535 33 33 class DataMessage { 34 34 private: 35 void* data; 36 size_t size; 35 void* data; //< internal buffer pointer 36 size_t size; //< internal buffer pointer size 37 37 public: 38 static const DataMessage UNSPECIFIED; 38 static const DataMessage UNSPECIFIED; //< default implementation of a data message 39 39 40 /** 41 * Default constructor for a data message 42 */ 40 43 inline DataMessage() { 41 44 this->data = NULL; … … 43 46 } 44 47 48 /** 49 * Constructor for a data message 50 * @param data Data buffer to carry in the message 51 * @param size Size of the buffer pointed to 52 */ 45 53 inline DataMessage( const void* data, const size_t size ) { 46 54 this->data = const_cast<void*>(data); … … 48 56 } 49 57 58 /** 59 * Copy constructor for a data message 60 * @param message The other message to copy from 61 */ 50 62 inline DataMessage(const DataMessage& message){ 51 63 this->data = message.data; … … 54 66 55 67 #ifdef USE_MESSAGE_UTILITY 68 /** 69 * Construct a data message from a normal message 70 * @param message The normal message to store 71 */ 56 72 inline DataMessage( const Message* message ) { 57 73 this->data = (void*)const_cast<Message*>(message); … … 59 75 } 60 76 77 /** 78 * Construct a data message from a normal message 79 * @param message The normal message to store 80 */ 61 81 inline DataMessage( const Message& message ) { 62 82 this->data = (void*)const_cast<Message*>(&message); … … 64 84 } 65 85 86 /** 87 * Get the internal message when constructued through one 88 * @return pointer to the message 89 */ 66 90 inline Message* getMessage() const { 67 91 if (isData()) { … … 71 95 } 72 96 97 /** 98 * Conversion function to convert to Message* 99 * @return internal message 100 */ 73 101 inline operator Message* () const { 74 102 return getMessage(); … … 76 104 #endif 77 105 106 /** 107 * Is the data message a normal message? 108 * @return true, if the data message is a normal message 109 */ 78 110 inline bool isMessage() const { 79 111 return size == ~(size_t)0; 80 112 } 81 113 114 /** 115 * Is the data message a data message 116 * @return true, if the data message is not a normal message 117 */ 82 118 inline bool isData() const { 83 119 return !isMessage(); 84 120 } 85 121 122 /** 123 * Directly access the internal data pointer 124 * @return internal data pointer 125 */ 86 126 inline void* getData() const { 87 127 return data; 88 128 } 89 129 130 /** 131 * Get the size of the internal buffer 132 * @return internal buffer size 133 */ 90 134 inline size_t getSize() const { 91 135 return size; 92 136 } 93 137 138 /** 139 * Is the data message invalid? 140 * @return true, if data message is invalid 141 */ 94 142 inline bool isUnspecified() const { 95 143 return data == NULL; 96 144 } 145 97 146 }; 98 147
Note:
See TracChangeset
for help on using the changeset viewer.