logog
logger optimized for games
LogBuffer Class Reference

#include <target.hpp>

+ Inheritance diagram for LogBuffer:

Public Member Functions

 LogBuffer (Target *pTarget=NULL, size_t s=LOGOG_DEFAULT_LOG_BUFFER_SIZE)
 
virtual ~LogBuffer ()
 
virtual void SetTarget (Target &t)
 
virtual int Insert (const LOGOG_CHAR *pChars, size_t size)
 
virtual int Dump ()
 
virtual int Output (const LOGOG_STRING &data)
 
- Public Member Functions inherited from Target
 Target ()
 
virtual ~Target ()
 
void SetFormatter (Formatter &formatter)
 
FormatterGetFormatter () const
 
virtual int Receive (const Topic &topic)
 
bool GetNullTerminatesStrings () const
 
void SetNullTerminatesStrings (bool val)
 
- Public Member Functions inherited from TopicSink
virtual bool IsTopic () const
 
virtual void Initialize ()
 
virtual bool PublishTo (Node &)
 
virtual bool UnpublishTo (Node &)
 
virtual bool CanPublish () const
 
- Public Member Functions inherited from Topic
 Topic (const LOGOG_LEVEL_TYPE level=LOGOG_LEVEL_ALL, const LOGOG_CHAR *sFileName=NULL, const int nLineNumber=0, const LOGOG_CHAR *sGroup=NULL, const LOGOG_CHAR *sCategory=NULL, const LOGOG_CHAR *sMessage=NULL, const double dTimestamp=0.0f)
 
virtual int Send (const Topic &node)
 
virtual int Transmit ()
 
virtual bool CanSubscribeTo (const Node &otherNode)
 
virtual bool CanSubscribeCheckTopic (const Topic &other)
 
virtual void Format (const LOGOG_CHAR *cFormatMessage,...)
 
const LOGOG_STRINGFileName () const
 
void FileName (const LOGOG_STRING &s)
 
const LOGOG_STRINGMessage () const
 
void Message (const LOGOG_STRING &s)
 
const LOGOG_STRINGCategory () const
 
void Category (const LOGOG_STRING &s)
 
const LOGOG_STRINGGroup () const
 
void Group (const LOGOG_STRING &s)
 
int LineNumber () const
 
void LineNumber (const int num)
 
LOGOG_LEVEL_TYPE Level () const
 
void Level (LOGOG_LEVEL_TYPE level)
 
LOGOG_TIME Timestamp () const
 
void Timestamp (const LOGOG_TIME t)
 
TOPIC_FLAGS GetTopicFlags () const
 
- Public Member Functions inherited from Node
 Node ()
 
 ~Node ()
 
virtual bool CanSubscribe () const
 
virtual bool PublishToMultiple (LockableNodesType &nodes)
 
virtual bool UnpublishToMultiple (LockableNodesType &nodes)
 
virtual bool SubscribeTo (Node &publisher)
 
virtual bool SubscribeToMultiple (LockableNodesType &nodes)
 
virtual bool UnsubscribeTo (Node &publisher)
 
virtual bool UnsubscribeToMultiple (LockableNodesType &nodes)
 
void Clear ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
void * operator new (size_t nSize)
 
void * operator new[] (size_t nSize)
 
void operator delete (void *ptr)
 
void operator delete[] (void *ptr)
 

Protected Member Functions

virtual void Allocate (size_t size)
 
virtual void Deallocate ()
 

Protected Attributes

LOGOG_CHARm_pStart
 
LOGOG_CHARm_pCurrent
 
LOGOG_CHARm_pEnd
 
size_t m_nSize
 
Targetm_pOutputTarget
 
- Protected Attributes inherited from Target
Formatterm_pFormatter
 
Mutex m_MutexReceive
 
bool m_bNullTerminatesStrings
 
- Protected Attributes inherited from Topic
LOGOG_STRING m_vStringProps [TOPIC_STRING_COUNT]
 
int m_vIntProps [TOPIC_INT_COUNT]
 
LOGOG_TIME m_tTime
 
TOPIC_FLAGS m_TopicFlags
 
- Protected Attributes inherited from Node
LockableNodesType m_Subscribers
 
LockableNodesType m_Publishers
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void * Allocate (size_t nSize)
 
static void Deallocate (void *ptr)
 
- Public Attributes inherited from Node
void * m_pUserData1
 
void * m_pUserData2
 

Detailed Description

A buffering target. Stores up to a fixed buffer size of output and then renders that output to another target. Can be used for buffering log output in memory and then storing it to a log file upon program completion. To use, create another target (such as a LogFile) and then create a LogBuffer, providing the other target as a parameter to the creation function.

Constructor & Destructor Documentation

LogBuffer ( Target pTarget = NULL,
size_t  s = LOGOG_DEFAULT_LOG_BUFFER_SIZE 
)
virtual ~LogBuffer ( )
virtual

Member Function Documentation

virtual void Allocate ( size_t  size)
protectedvirtual
virtual void Deallocate ( )
protectedvirtual
virtual int Dump ( )
virtual

Dumps the current contents of the buffer to the output target.

virtual int Insert ( const LOGOG_CHAR pChars,
size_t  size 
)
virtual

Inserts a range of LOGOG_CHAR objects into this buffer. The characters should consist of a null-terminated string of length size. Providing anything else as input creates undefined behavior.

virtual int Output ( const LOGOG_STRING data)
virtual

All targets must implement the Output function. This function outputs the provided string to the output that the target represents.

Returns
Zero if no error has occurred; an error code (generally propagated from the operating system) if an error has occurred.

Implements Target.

virtual void SetTarget ( Target t)
virtual

Changes the current rendering target. NOTE: This function does no locking on either the target or this object. Program accordingly.

Member Data Documentation

size_t m_nSize
protected

The size of the buffer in LOGOG_CHAR primitives.

LOGOG_CHAR* m_pCurrent
protected

The current write offset into the buffer.

LOGOG_CHAR* m_pEnd
protected

The position in the buffer after which no data may be written.

Target* m_pOutputTarget
protected

A pointer to the target to which the buffer will be rendered upon calling Dump().

LOGOG_CHAR* m_pStart
protected

The non-changing pointer to the basic buffer.


The documentation for this class was generated from the following file: