logog
logger optimized for games
Topic Class Reference

#include <topic.hpp>

+ Inheritance diagram for Topic:

Public Member Functions

 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 bool IsTopic () const
 
virtual int Send (const Topic &node)
 
virtual int Transmit ()
 
virtual int Receive (const Topic &node)
 
virtual bool CanSubscribeTo (const Node &otherNode)
 
virtual bool CanSubscribeCheckTopic (const Topic &other)
 
virtual bool PublishTo (Node &subscriber)
 
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 void Initialize ()
 
virtual bool CanPublish () const
 
virtual bool CanSubscribe () const
 
virtual bool PublishToMultiple (LockableNodesType &nodes)
 
virtual bool UnpublishTo (Node &subscriber)
 
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

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 TopicLevel
 
class TopicGroup
 
class FilterDefault
 

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 subject that nodes can choose to discuss with one another. Subscribers generally have very general topics, while publishers generally have very specific topics.

Constructor & Destructor Documentation

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 
)

Creates a topic. Note the defaults for creating a topic – these defaults are equivalent to "no setting" for those fields.

Member Function Documentation

virtual bool CanSubscribeCheckTopic ( const Topic other)
virtual

Reimplemented in TopicLevel, and TopicGroup.

virtual bool CanSubscribeTo ( const Node otherNode)
virtual

Is this topic interested in receiving notifications from another topic? This function implements a generic (slow) test that should work for all topic types. This function only checks fields that have previously been set on this topic – fields that have not been set will not limit this topic's ability to subscribe. If any of the previously set fields does not "match" the other topic, this function will return false. The matching function behaves slightly differently from field to field.

  • In the topic level case, this function rejects a publisher with a lower topic level than our own.
  • In the group, category, file name and message case, this function rejects a publisher if our own group/category/file name or message cannot be found as a substring in the possible publisher. This functionality permits very simple pattern matching functionality (i.e. show me all the message lines that have the word "upload" in them, regardless of their log level.)
  • In the line number case, this function rejects a publisher unless the line number matches exactly.
  • In the timestamp case, this function rejects a publisher if their timestamp is before our own.
    Parameters
    otherNodeThe topic which we are considering subscribing to

Reimplemented from Node.

const LOGOG_STRING& Category ( ) const
void Category ( const LOGOG_STRING s)
const LOGOG_STRING& FileName ( ) const
void FileName ( const LOGOG_STRING s)
virtual void Format ( const LOGOG_CHAR cFormatMessage,
  ... 
)
virtual

Formats the message in this topic given a sprintf-style set of arguments. This function can be used to set the current message in this topic to a string with a variable number of parameters.

TOPIC_FLAGS GetTopicFlags ( ) const
const LOGOG_STRING& Group ( ) const
void Group ( const LOGOG_STRING s)
virtual bool IsTopic ( ) const
virtual

Topics are always topics. We use this to avoid any RTTI dependence.

Reimplemented from Node.

Reimplemented in TopicSink.

LOGOG_LEVEL_TYPE Level ( ) const
void Level ( LOGOG_LEVEL_TYPE  level)
int LineNumber ( ) const
void LineNumber ( const int  num)
const LOGOG_STRING& Message ( ) const
void Message ( const LOGOG_STRING s)
virtual bool PublishTo ( Node subscriber)
virtual

Causes this topic to begin publishing events to the given subscriber.

Parameters
subscriberThe node to receive published events
Returns
true if the request was successful, false if the subscriber was already subscribed

Reimplemented from Node.

Reimplemented in TopicSink.

virtual int Receive ( const Topic node)
virtual

Permits this node to receive a publication from another node, and act upon it.

Parameters
nodeThe node constituting the publication
Returns
0 if successful, non-zero if this node failed to process the publication

Reimplemented in FilterDefault, and Target.

virtual int Send ( const Topic node)
virtual

Causes this topic to publish another topic to all its subscribers.

Returns
0 if successful, non-zero if this topic failed to send the publication to all subscribers

Reimplemented in Checkpoint.

LOGOG_TIME Timestamp ( ) const
void Timestamp ( const LOGOG_TIME  t)
virtual int Transmit ( )
virtual

Causes this topic to publish itself to all its subscribers.

Friends And Related Function Documentation

friend class FilterDefault
friend
friend class TopicGroup
friend
friend class TopicLevel
friend

Member Data Documentation

TOPIC_FLAGS m_TopicFlags
protected

A bitfield representing the "important" fields in this topic. Not all fields are considered to contain important information all the time. A logical OR of the TOPIC_*_FLAG fields.

See also
TopicBitsType
LOGOG_TIME m_tTime
protected

The time associated with this topic. Usually this field is updated when a topic is triggered. Times need not be associated with a particular topic, in which case this value is zero.

int m_vIntProps[TOPIC_INT_COUNT]
protected

An array (not an STL vector) of integer properties for this topic.

LOGOG_STRING m_vStringProps[TOPIC_STRING_COUNT]
protected

An array (not an STL vector) of string properties for this topic.


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