logog
logger optimized for games
Target Class Referenceabstract

#include <target.hpp>

+ Inheritance diagram for Target:

Public Member Functions

 Target ()
 
virtual ~Target ()
 
void SetFormatter (Formatter &formatter)
 
FormatterGetFormatter () const
 
virtual int Output (const LOGOG_STRING &data)=0
 
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 Attributes

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
 

Friends

class LogBuffer
 

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 target is abstraction representing an output stream from logog. cerr, cout, and syslog, and other logging formats are supported. Targets do not validate their received data. Their only job is to render it on a call to Receive() to their supported target type. Targets should generally make sure to handle calls on multiple threads – they should make sure to avoid overlapping outputs from multiple threads correctly. This base class handles this serialization in the Receive() function. Children of this class are expected to implement the Output() function to do the actual output.

Constructor & Destructor Documentation

Target ( )
virtual ~Target ( )
virtual

Member Function Documentation

Formatter& GetFormatter ( ) const

Returns a reference to the current formatter for this target.

bool GetNullTerminatesStrings ( ) const
inline

Does this target want its formatter to null terminate its strings?

virtual int Output ( const LOGOG_STRING data)
pure 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.

Implemented in LogBuffer, Socket, and LogFile.

virtual int Receive ( const Topic topic)
virtual

Receives a topic on behalf of this target. A mutex prevents race conditions from occurring when multiple threads attempt to write to this target at the same time.

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

Reimplemented from Topic.

void SetFormatter ( Formatter formatter)

Sets the current formatter for this target.

void SetNullTerminatesStrings ( bool  val)
inline

Tells this target whether to request its formatter to null terminate its strings.

Friends And Related Function Documentation

friend class LogBuffer
friend

Member Data Documentation

bool m_bNullTerminatesStrings
protected

Does this target cause its formatter to null-terminate its output strings? File and buffer outputs don't require null terminated strings, but line outputs do.

Mutex m_MutexReceive
protected

A mutex on the Receive() function.

Formatter* m_pFormatter
protected

A pointer to the formatter used for this output.


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