CVS update: /common/container/pub/

CVS update: /common/container/pub/

jbloedow at helixcommunity.org jbloedow at helixcommunity.org
Wed Dec 11 18:39:34 PST 2002


User: jbloedowDate: 02/12/11 10:39:34
Modified
 /common/container/pub/
  hxbuffer.h

Log
 Added CHXBufferFragment class that let's one reuse an existing buffer if one just wants to pass on a subset of an existing buffer, rather than allocate memory for a new buffer.

File Changes:

Directory: /common/container/pub/
=================================

File [changed]: hxbuffer.h
Url: https://common.helixcommunity.org/source/browse/common/container/pub/hxbuffer.h.diff?r1=1.1.1.1&r2=1.2
Delta lines:  +22 -1
--------------------
--- hxbuffer.h	18 Oct 2002 01:40:48 -0000	1.1.1.1
+++ hxbuffer.h	11 Dec 2002 18:39:34 -0000	1.2
@@ -69,6 +69,7 @@
         LONG32					m_lRefCount;
 
 		//ULONG32				m_ulAllocLength;
+ 	BOOL m_bJustPointToExistingData;
 
         // Interface for optional allocator
         static 	IMalloc*		m_zMallocInterface;
@@ -111,7 +112,7 @@
 
 public:
         CHXBuffer();
-        CHXBuffer(UCHAR* pData, UINT32 ulLength);
+        CHXBuffer(UCHAR* pData, UINT32 ulLength, BOOL bOwnBuffer = TRUE);
 
 #if 0
 #ifndef __MWERKS__
@@ -196,5 +197,25 @@
         Set((const unsigned char*)(const char *)str, str.GetLength()+1);
         return(*this);
 }
+
+
+// This class was created in order to be able to have a buffer that consists of
+// a subset of another existing buffer without allocating any new data or 
+// copying data over. The way to use this class is to instantiate it with 3 
+// parameters: 
+// 1) A pointer to the superset buffer, 
+// 2) The pointer to the point in the the buffer that represents the start of 
+//    the subset buffer, and 
+// 3) The length of the subset buffer.
+//
+class CHXBufferFragment : public CHXBuffer
+{
+public :
+    CHXBufferFragment(IHXBuffer * pWrappedBuffer, UCHAR* pModFrameStart, ULONG32 ulFragLen) : CHXBuffer( pModFrameStart, ulFragLen, FALSE ), m_pHXBufferPointedTo(pWrappedBuffer){ if(pWrappedBuffer) {pWrappedBuffer->AddRef();} };
+    ~CHXBufferFragment(){ HX_RELEASE(m_pHXBufferPointedTo);}
+
+protected :
+    IHXBuffer * m_pHXBufferPointedTo;
+};
 
 #endif




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at common.helixcommunity.org
For additional commands, e-mail: cvs-help at common.helixcommunity.org




More information about the Common-cvs mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.