Implemented a method to access the inner array pointer, this is necessary for memory...
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Sun, 21 Aug 2011 01:07:06 +0000 (22:07 -0300)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Sun, 21 Aug 2011 01:07:06 +0000 (22:07 -0300)
src/host/messagepayload.cpp
src/host/messagepayload.h

index 1626301..d6cc358 100644 (file)
@@ -111,6 +111,16 @@ uint8_t& MessagePayload::operator[]( size_t offset )
 }
 
 /**
+ * @brief Get a pointer to the underlying array.
+ *
+ * @return a pointer to the array encapsulated by this class.
+ */
+uint8_t* MessagePayload::get() const
+{
+    return Payload.get();
+}
+
+/**
  * @brief Retrieve 16 bits from the payload buffer.
  *
  * @param left_byte the index of the left byte
index 5b66a0a..85a226b 100644 (file)
 //-----------------------------------------------------------------------------
 
 /**
- * @brief This class represents the contents of a network message. It provides
- * means to encode and to decode data to network format (i.e. deal with
- * endianness), and also can be treated like an ordinary array.
+ * @brief This class represents the contents of a network message.
+ *
+ * It provides means to encode and to decode data to network format (i.e. deal
+ * with endianness), and also can be treated like an ordinary array.
  */
 class MessagePayload
 {
@@ -35,6 +36,8 @@ public:
     const uint8_t& operator[]( std::size_t offset ) const;
     uint8_t& operator[]( std::size_t offset );
 
+    uint8_t* get() const;
+
     uint16_t decode16(
             const int left_byte,
             const int right_byte