Back to the WFC main page
$Revision: 9 $
This class allows you to handle unknown data in an orderly way.
It is patterned after the RIFF idea. RIFF is used in WAV files
and AVI files. It is a very simple way of handling data. You
have a four byte identifier followed by a four byte length
followed by the length number of bytes. Very simple. Very effective.
This contains the four byte identifier.
This contains the payload.
CDataChunk( const CDataChunk& source )
Constructs the object.
inline void Copy( const CDataChunk& source )
Copies the contents of another CDataChunk into this one.
inline void Copy( DWORD identifier, const CByteArray& payload )
Sets the Identifier to
identifier and copies the
payload into Payload.
static void GetIdentifier( DWORD identifier, CString& string )
Translates the four byte
identifier into a string. This makes
it easier for humans to decipher the identifier.
inline CDataChunk& operator = ( const CDataChunk& source )
This class breaks all of the object oriented rules. No members
are virtual therefore they are useless when it comes to reuse.
The reason I did this was speed. If you're passing data in an
orderly way, I assume you need to do it quickly (at least at this
level of your design).
Copyright, 2000, Samuel R. Blackburn
void send_SLVL_chunk( const CByteArray& data, CDataSocket& socket )
data_chunk.Identifier = MAKE_DATA_CHUNK_ID( 'S', 'L', 'V', 'L' );
data_chunk.Copy( data );
// Transmit the chunk out of the socket
socket.AddData( data_chunk );
$Workfile: CDataChunk.cpp $
$Modtime: 1/04/00 5:11a $