Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_InStream Class Reference

Inheritance diagram for CP_InStream:

CP_FileInStream CP_HandleBlockInStream CP_PtrBlockInStream CP_SocketInStream List of all members.

Getters

virtual UInt32 GetLength () const =0
UInt16 GetStreamVersion () const
bool HasHeader () const

Positioning

virtual UInt32 GetPosition () const =0
virtual void SetPosition (UInt32 inPosition)=0
virtual bool IsEOF () const

Reading

virtual UInt32 OnReadBytes (void *inDestBuffer, UInt32 inNumberBytes)=0
virtual void ReadHeader ()

Public Member Functions

Constructor / Destructor
 CP_InStream (bool inHasHeader=true, char inDesiredEdian=kCP_StreamData_PlatformEdian)
 Constructor.
 CP_InStream (const CP_InStream &inStream)
virtual ~CP_InStream () throw ()
 Destructor.
Operators
CP_InStreamoperator= (const CP_InStream &inStream)

Protected Attributes

bool fHasReadHeader
bool fNeedsByteSwap
UInt16 fCPLATStreamVersion
bool fHasTaggedData
bool fHasHeader
char fDesiredEdian

Constructor & Destructor Documentation

CP_InStream::CP_InStream bool  inHasHeader = true,
char  inDesiredEdian = kCP_StreamData_PlatformEdian
 

Constructor.

Parameters:
inHasHeader Flag to indicate if the stream has a header. This is true if the stream was written by our out stream classes, otherwise it should be false.
inDesiredEdian The edian value of the streamed data. The default is to pass in kCP_StreamData_PlatformEdian, which will read the edian tag in the stream, and perform byte swapping depending on the edian of the platform the stream is read on. You can pass in kCP_StreamData_LittleEdian, or kCP_StreamData_BitEdian if you want to skip this check.
Exceptions:
none 

CP_InStream::CP_InStream const CP_InStream inStream  ) 
 

Copy constructor.

Parameters:
inStream CP_InStream object to copy fields from.
Exceptions:
none 

CP_InStream::~CP_InStream  )  throw () [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

UInt32 CP_InStream::ReadBytes void *  inDestBuffer,
UInt32  inNumberBytes,
bool  inAllowPartialData = false
[virtual]
 

Reads some data from the stream. Used by the >> operators to read the data, but can also be used in an application.

Parameters:
inDestBuffer Location to read the data into.
inNumberBytes Length of the buffer to hold the data.
inAllowPartialData If true, less than the requested number of bytes may be read. Otherwise, if not enough data is available, an exception is raised.
Exceptions:
CP_OSErrorException(eofErr) raised if inAllowPartialData is false and not enough data can be read.
Returns:
UInt32 The number of bytes actually read. If inAllowPartialData is true, this may be less than the requested number of bytes.

bool CP_InStream::NeedsByteSwap  )  const
 

void CP_InStream::SetNeedsByteSwap bool  doSwap  ) 
 

virtual UInt32 CP_InStream::GetLength  )  const [pure virtual]
 

Implemented in CP_FileInStream, CP_HandleBlockInStream, CP_PtrBlockInStream, and CP_SocketInStream.

UInt16 CP_InStream::GetStreamVersion  )  const
 

bool CP_InStream::HasHeader  )  const
 

virtual UInt32 CP_InStream::GetPosition  )  const [pure virtual]
 

Implemented in CP_FileInStream, CP_HandleBlockInStream, CP_PtrBlockInStream, and CP_SocketInStream.

virtual void CP_InStream::SetPosition UInt32  inPosition  )  [pure virtual]
 

Implemented in CP_FileInStream, CP_HandleBlockInStream, CP_PtrBlockInStream, and CP_SocketInStream.

bool CP_InStream::IsEOF  )  const [virtual]
 

Returns true if the stream has reached the end.

Exceptions:
none 
Returns:
bool const True if the stream is at the end.

Reimplemented in CP_SocketInStream.

CP_InStream & CP_InStream::operator= const CP_InStream inStream  ) 
 

Assignment operator. Copy the data from the passed in inStream to this stream.

Parameters:
inStream CP_InStream object to copy the data from.
Exceptions:
none 
Returns:
CP_InStream& Returns a reference to ourselves.

bool CP_InStream::HasTaggedData  )  const
 

Returns true if the data type is written before each elemement. This is intended in debugging the stream data since it increases the size of the resulting stream.

Exceptions:
none 
Returns:
bool const True, if the stream has tags before each data element.

SInt32 CP_InStream::GetTag  ) 
 

Reads the tag before a data element if the streamed data has tagged data.

Exceptions:
none 
Returns:
SInt32 The tag being read.

virtual UInt32 CP_InStream::OnReadBytes void *  inDestBuffer,
UInt32  inNumberBytes
[protected, pure virtual]
 

Implemented in CP_FileInStream, CP_HandleBlockInStream, CP_PtrBlockInStream, and CP_SocketInStream.

void CP_InStream::ReadHeader  )  [protected, virtual]
 

Reads the header portion of our stream.

Exceptions:
none 
Returns:
void


Member Data Documentation

bool CP_InStream::fHasReadHeader [protected]
 

bool CP_InStream::fNeedsByteSwap [protected]
 

Flag to indicate if we have read the header.

UInt16 CP_InStream::fCPLATStreamVersion [protected]
 

Flag to indicate if we need to byte swap the data.

bool CP_InStream::fHasTaggedData [protected]
 

CPLAT stream version used to write this stream.

bool CP_InStream::fHasHeader [protected]
 

Flag to indicate if the data has its type written out also.

char CP_InStream::fDesiredEdian [protected]
 

Flag to indicate if we are want to read data not created by this framework and therefore won't have a correct header.


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:21:50 2005 for CPLAT_MacOS by  doxygen 1.4.0