Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

InMemory Class Reference

An PhysicalInStream that reads the data from a memory region. More...

#include <InStreams.h>

Inheritance diagram for InMemory:

Inheritance graph
[legend]
Collaboration diagram for InMemory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 InMemory ()
 Default constructor.

virtual bool exists () const
 The function states whether the stream actually exists.

virtual bool getEof () const
 The function states whether the end of the file has been reached.


Protected Member Functions

void open (const void *mem, unsigned size=0)
 Opens the stream.

virtual void readFromStream (void *p, int size)
 The function reads a number of bytes from memory.

virtual void skipInStream (int size)
 The function skips a number of bytes.


Private Attributes

const char * memory
 Points to the next byte to read from memory.

const char * end
 Points to the end of the memory block.


Detailed Description

An PhysicalInStream that reads the data from a memory region.

Definition at line 693 of file InStreams.h.


Constructor & Destructor Documentation

InMemory::InMemory  )  [inline]
 

Default constructor.

Definition at line 701 of file InStreams.h.

References end, and memory.


Member Function Documentation

virtual bool InMemory::exists  )  const [inline, virtual]
 

The function states whether the stream actually exists.

Returns:
Does the stream exist? This is always true for memory streams.

Reimplemented from PhysicalInStream.

Definition at line 707 of file InStreams.h.

References memory.

virtual bool InMemory::getEof  )  const [inline, virtual]
 

The function states whether the end of the file has been reached.

It will only work if the correct size of the memory block was specified during the construction of the stream.

Returns:
End of file reached?

Implements PhysicalInStream.

Definition at line 715 of file InStreams.h.

References end, and memory.

void InMemory::open const void *  mem,
unsigned  size = 0
[inline, protected]
 

Opens the stream.

Parameters:
mem The address of the memory block from which is read.
size The size of the memory block. It is only used to implement the function eof(). If the size is not specified, eof() will always return true, but reading from the stream is still possible.

Definition at line 727 of file InStreams.h.

References end, and memory.

Referenced by InBinaryMemory::InBinaryMemory(), InConfigMemory::InConfigMemory(), and InTextMemory::InTextMemory().

void InMemory::readFromStream void *  p,
int  size
[protected, virtual]
 

The function reads a number of bytes from memory.

Parameters:
p The address the data is written to. Note that p must point to a memory area that is at least "size" bytes large.
size The number of bytes to be read.

Implements PhysicalInStream.

Definition at line 140 of file InStreams.cpp.

References memory.

virtual void InMemory::skipInStream int  size  )  [inline, protected, virtual]
 

The function skips a number of bytes.

Parameters:
size The number of bytes to be skipped.

Reimplemented from PhysicalInStream.

Definition at line 743 of file InStreams.h.

References memory.


Member Data Documentation

const char* InMemory::memory [private]
 

Points to the next byte to read from memory.

Definition at line 696 of file InStreams.h.

Referenced by exists(), getEof(), InMemory(), open(), readFromStream(), and skipInStream().

const char * InMemory::end [private]
 

Points to the end of the memory block.

Definition at line 696 of file InStreams.h.

Referenced by getEof(), InMemory(), and open().


The documentation for this class was generated from the following files:
Generated on Thu Sep 23 20:08:43 2004 for GT2004 by doxygen 1.3.6