Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

zeitgeist::LogServerStreamBuf Class Reference

#include <logserverstreambuf.h>

List of all members.

Public Member Functions

 LogServerStreamBuf (unsigned int size)
virtual ~LogServerStreamBuf ()
void AddStream (std::ostream *stream, unsigned int mask)
bool RemoveStream (const std::ostream *stream)
bool SetPriorityMask (const std::ostream *stream, unsigned int mask)
unsigned int GetPriorityMask (const std::ostream *stream) const
void SetCurrentPriority (unsigned int priority)

Protected Types

typedef std::char_traits<
char > 
TTraitsType
typedef traits_type::int_type TIntType

Protected Member Functions

TIntType overflow (TIntType c)
int sync ()

Private Types

typedef std::pair< unsigned
int, std::ostream * > 
TMaskStream
typedef std::vector< TMaskStreamTMaskStreams

Private Member Functions

 LogServerStreamBuf (const LogServerStreamBuf &obj)
LogServerStreamBufoperator= (const LogServerStreamBuf &obj)
void Forward (const char *buffer, unsigned int length)
 multiplex to all registered streams
void PutBuffer ()
 stream out complete internal buffer
void PutChar (TIntType chr)
 stream out a single character

Private Attributes

unsigned int mSize
 size of the internal buffer to use
unsigned int mCurrentPriority
TMaskStreams mStreams

Classes

class  MaskStreamEQ
 A predicate to compare streams in a MaskStream list (or vector). More...


Detailed Description

Definition at line 55 of file logserverstreambuf.h.


Member Typedef Documentation

typedef traits_type::int_type zeitgeist::LogServerStreamBuf::TIntType [protected]
 

Definition at line 61 of file logserverstreambuf.h.

typedef std::pair<unsigned int, std::ostream*> zeitgeist::LogServerStreamBuf::TMaskStream [private]
 

Definition at line 64 of file logserverstreambuf.h.

typedef std::vector<TMaskStream> zeitgeist::LogServerStreamBuf::TMaskStreams [private]
 

Definition at line 65 of file logserverstreambuf.h.

typedef std::char_traits<char> zeitgeist::LogServerStreamBuf::TTraitsType [protected]
 

Definition at line 60 of file logserverstreambuf.h.


Constructor & Destructor Documentation

LogServerStreamBuf::LogServerStreamBuf unsigned int  size  ) 
 

Definition at line 8 of file logserverstreambuf.cpp.

References mSize.

LogServerStreamBuf::~LogServerStreamBuf  )  [virtual]
 

Definition at line 26 of file logserverstreambuf.cpp.

References mStreams, and sync().

Here is the call graph for this function:

zeitgeist::LogServerStreamBuf::LogServerStreamBuf const LogServerStreamBuf obj  )  [private]
 


Member Function Documentation

void LogServerStreamBuf::AddStream std::ostream *  stream,
unsigned int  mask
 

Add a stream to the list of streams.

First, it is checked if the stream is already in. If the stream is found, we only add a new priority mask to the existing ones, so no stream can be added twice.

Parameters:
stream the stream to add
mask the (new) priority mask for the stream

Definition at line 43 of file logserverstreambuf.cpp.

References mStreams.

Referenced by zeitgeist::LogServer::AddStream().

void LogServerStreamBuf::Forward const char *  buffer,
unsigned int  length
[private]
 

multiplex to all registered streams

Definition at line 148 of file logserverstreambuf.cpp.

References mCurrentPriority, and mStreams.

Referenced by PutBuffer(), and PutChar().

unsigned int LogServerStreamBuf::GetPriorityMask const std::ostream *  stream  )  const
 

Get priority mask of a stream in the list.

Parameters:
stream the stream for which we want to set the priority mask
Returns:
the priority mask; 0 if stream was not found

Definition at line 92 of file logserverstreambuf.cpp.

References mStreams.

Referenced by zeitgeist::LogServer::GetPriorityMask().

LogServerStreamBuf& zeitgeist::LogServerStreamBuf::operator= const LogServerStreamBuf obj  )  [private]
 

LogServerStreamBuf::TIntType LogServerStreamBuf::overflow TIntType  c  )  [protected]
 

This routine is called by the iostream library if our internal buffer is overflowing (the put area is full).

Definition at line 114 of file logserverstreambuf.cpp.

References PutBuffer(), and PutChar().

Here is the call graph for this function:

void LogServerStreamBuf::PutBuffer  )  [private]
 

stream out complete internal buffer

Definition at line 160 of file logserverstreambuf.cpp.

References Forward().

Referenced by overflow(), and sync().

Here is the call graph for this function:

void LogServerStreamBuf::PutChar TIntType  chr  )  [private]
 

stream out a single character

Definition at line 176 of file logserverstreambuf.cpp.

References Forward().

Referenced by overflow().

Here is the call graph for this function:

bool LogServerStreamBuf::RemoveStream const std::ostream *  stream  ) 
 

Remove a stream from the list of streams.

Parameters:
stream the stream to remove
Returns:
true if the stream was found (and thus removed)

Definition at line 59 of file logserverstreambuf.cpp.

References mStreams, and sync().

Referenced by zeitgeist::LogServer::RemoveStream().

Here is the call graph for this function:

void LogServerStreamBuf::SetCurrentPriority unsigned int  priority  ) 
 

Set the current priority level.

All data which is streamed into the forwarder after this point will use the current priority level. Before the priority level is adjusted, all buffered data is flushed.

Parameters:
priority current priority level (see EPriorityLevel)

Definition at line 104 of file logserverstreambuf.cpp.

References mCurrentPriority, and sync().

Referenced by zeitgeist::LogServer::Priority().

Here is the call graph for this function:

bool LogServerStreamBuf::SetPriorityMask const std::ostream *  stream,
unsigned int  mask
 

Set priority mask of a stream in the list.

Parameters:
stream the stream for which we want to set the priority mask
mask the new priority mask
Returns:
true if the stream was found

Definition at line 76 of file logserverstreambuf.cpp.

References mStreams, and sync().

Referenced by zeitgeist::LogServer::SetPriorityMask().

Here is the call graph for this function:

int LogServerStreamBuf::sync  )  [protected]
 

This routine synchronizes the internal state with the external state. It is used to flush the streambuf object.

Definition at line 141 of file logserverstreambuf.cpp.

References PutBuffer().

Referenced by RemoveStream(), SetCurrentPriority(), SetPriorityMask(), and ~LogServerStreamBuf().

Here is the call graph for this function:


Member Data Documentation

unsigned int zeitgeist::LogServerStreamBuf::mCurrentPriority [private]
 

Definition at line 142 of file logserverstreambuf.h.

Referenced by Forward(), and SetCurrentPriority().

unsigned int zeitgeist::LogServerStreamBuf::mSize [private]
 

size of the internal buffer to use

Definition at line 141 of file logserverstreambuf.h.

Referenced by LogServerStreamBuf().

TMaskStreams zeitgeist::LogServerStreamBuf::mStreams [private]
 

Definition at line 143 of file logserverstreambuf.h.

Referenced by AddStream(), Forward(), GetPriorityMask(), RemoveStream(), SetPriorityMask(), and ~LogServerStreamBuf().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:50:35 2006 for rcssserver3d by  doxygen 1.4.4