src/common/buffer.h
changeset 6113 0ce37bf4f1c1
parent 5938 69bcae35bc81
child 6132 cd1902faafb9
--- a/src/common/buffer.h	Mon Mar 08 15:24:22 2010 -0800
+++ b/src/common/buffer.h	Mon Mar 08 21:07:31 2010 -0500
@@ -476,6 +476,33 @@
 
   Buffer CreateFullCopy (void) const;
 
+  /**
+   * \return the number of bytes required for serialization 
+   */
+  uint32_t GetSerializedSize (void) const;
+
+  /**
+   * \return zero if buffer not large enough
+   * \param buffer points to serialization buffer
+   * \param maxSize max number of bytes to write
+   *
+   * This buffer's contents are serialized into the raw 
+   * character buffer parameter. Note: The zero length 
+   * data is not copied entirely. Only the length of 
+   * zero byte data is serialized.
+   */
+  uint32_t Serialize (uint8_t* buffer, uint32_t maxSize) const;
+
+  /**
+   * \return zero if a complete buffer is not deserialized
+   * \param buffer points to buffer for deserialization
+   * \param size number of bytes to deserialize
+   *
+   * The raw character buffer is deserialized and all the 
+   * data is placed into this buffer.
+   */
+  uint32_t Deserialize (uint8_t* buffer, uint32_t size);
+  
   int32_t GetCurrentStartOffset (void) const;
   int32_t GetCurrentEndOffset (void) const;
 
@@ -493,6 +520,7 @@
   Buffer &operator = (Buffer const &o);
   Buffer ();
   Buffer (uint32_t dataSize);
+  Buffer (uint32_t dataSize, bool initialize);
   ~Buffer ();
 private: