logog
logger optimized for games
logog Namespace Reference

[Thread] More...

Classes

class  Allocator
 
class  Cerr
 
class  Checkpoint
 
class  Cout
 
class  Filter
 
class  FilterDefault
 
class  Formatter
 
class  FormatterGCC
 
class  FormatterMSVC
 
struct  INIT_PARAMS
 [INIT_PARAMS] More...
 
class  LockableNodesType
 
class  LogBuffer
 
class  LogFile
 
class  Message
 
class  Mutex
 [Mutex] More...
 
class  Node
 
class  Object
 
class  OutputDebug
 
class  ScopedLock
 
class  Socket
 
class  SocketServer
 
class  Statics
 
class  String
 
class  Target
 
class  TestSignup
 
class  Thread
 
class  Timer
 
class  TimeStamp
 
class  Topic
 
class  TopicGroup
 
class  TopicLevel
 
class  TopicSink
 
class  TopicSource
 
class  UnitTest
 

Typedefs

typedef LOGOG_SET< Node *, std::less< Node * >, Allocator< Node * > > NodesType
 
typedef void * PointerType
 
typedef LOGOG_UNORDERED_MAP< PointerType, size_t > AllocationsType
 
typedef double LOGOG_TIME
 
typedef const char * TestNameType
 
typedef LOGOG_LIST< UnitTest * > TestRegistryType
 

Functions

void Initialize (INIT_PARAMS *params=NULL)
 [INIT_PARAMS] More...
 
void Shutdown ()
 
FormatterGetDefaultFormatter ()
 
void DestroyDefaultFormatter ()
 
MutexGetMessageCreationMutex ()
 
void DestroyMessageCreationMutex ()
 
void LockAllocationsMutex ()
 
void UnlockAllocationsMutex ()
 
MutexGetStringSearchMutex ()
 
void DestroyStringSearchMutex ()
 
LockableNodesTypeGetStaticNodes (void **pvLocation)
 
LockableNodesTypeAllNodes ()
 
LockableNodesTypeAllSubscriberNodes ()
 
LockableNodesTypeAllFilters ()
 
LockableNodesTypeAllTargets ()
 
void DestroyNodesList (void **pvList)
 
void DestroyAllNodes ()
 
template<class T1 , class T2 >
bool operator== (const Allocator< T1 > &, const Allocator< T2 > &)
 
template<class T1 , class T2 >
bool operator!= (const Allocator< T1 > &, const Allocator< T2 > &)
 
int MemoryAllocations ()
 
int ReportMemoryAllocations ()
 
void DestroyGlobalTimer ()
 
StaticsStatic ()
 
void DestroyStatic ()
 
TimerGetGlobalTimer ()
 
FilterDefaultGetFilterDefault ()
 
void SetDefaultLevel (LOGOG_LEVEL_TYPE level)
 
TestRegistryTypeLogogTestRegistry ()
 
int RunAllTests ()
 
void ShutdownTests ()
 

Variables

Mutex s_AllocationsMutex
 
AllocationsType s_Allocations
 

Detailed Description

[Thread]

Todo:
Socket support is unfinished and is not working yet. Please review socket.hpp if you'd like to implement a cross-platform socket abstraction.

[Thread]

Typedef Documentation

A type describing the currently outstanding memory allocations. Note that this type does not inherit from Object, because to do so would create an infinite recursion when memory is allocated.

typedef double LOGOG_TIME

A value for a high resolution timer on this platform. Time representations are in seconds.

typedef LOGOG_SET< Node *, std::less< Node * >, Allocator< Node * > > NodesType

An aggregation of nodes. Internally, we choose a set representation because we want to be able to traverse the aggregation quickly while still looking up entries quickly.

typedef void* PointerType

Iteration over an unordered map is slow, but we only do it at shutdown time. Access to a lookup or insert is very fast. Additionally, we do not allocate leak detection records from our own heap; it saves us from doing a recursive allocation.

typedef const char* TestNameType

A standard string type, used for labelling a test. We don't use LOGOG_STRING here because that class is mutable and it allocates memory.

A registry for all tests. All tests are instanced using the UNITTEST() macro and stored in the LogogTestRegistry. UNITTEST

Function Documentation

LockableNodesType& logog::AllFilters ( )

Returns a reference to the group of nodes that are capable of both subscribing as well as publishing. Allocates a new global subscriber node group if one does not already exist.

LockableNodesType& logog::AllNodes ( )

Returns a reference to the global nodes group. Allocates a new global node group if one does not already exist.

LockableNodesType& logog::AllSubscriberNodes ( )

Returns a reference to the group of nodes that are capable of subscribing. Allocates a new global subscriber node group if one does not already exist.

LockableNodesType& logog::AllTargets ( )

Returns a reference to the group of nodes that represent terminals in the graph, i.e. nodes that can't publish.

void DestroyAllNodes ( )

Destroys all nodes currently recorded. This happens at shutdown time. NOTE! If you have allocated your own logog items and free them yourself AFTER this call, exciting crashes will occur.

void DestroyDefaultFormatter ( )
void DestroyGlobalTimer ( )
void DestroyMessageCreationMutex ( )
void logog::DestroyNodesList ( void **  pvList)
void logog::DestroyStatic ( )

Destroys the Static() structure. Calls to Static() after calling DestroyStatic() will probably crash your program.

void DestroyStringSearchMutex ( )
Formatter& logog::GetDefaultFormatter ( )
FilterDefault& logog::GetFilterDefault ( )

Returns a reference to the unique default filter instantiated with logog.

Timer& logog::GetGlobalTimer ( )
Mutex& logog::GetMessageCreationMutex ( )
LockableNodesType& logog::GetStaticNodes ( void **  pvLocation)
Mutex& logog::GetStringSearchMutex ( )
void logog::Initialize ( INIT_PARAMS params = NULL)

[INIT_PARAMS]

Initializes the logog system. No logog calls or allocations may be made before calling this function; expect crashes if you haven't called this at the top of your program. Furthermore, this function is not thread safe. Only call it once, at the start of your program thread.

Parameters
paramsThe address of an INIT_PARAMS structure you have already allocated on the heap, or NULL to use default values.
See also
INIT_PARAMS
void LockAllocationsMutex ( )

A global function to lock the global allocations mutex. We must do this as a static void because Mutexes depend on Objects. This should probably belong in a class, but then we get recursive class definitions.

TestRegistryType& logog::LogogTestRegistry ( )

All unit tests are registered in here at program initialization time.

int logog::MemoryAllocations ( )

Returns the current number of outstanding memory allocations in logog. Returns -1 iff LOGOG_LEAK_DETECTION has not been defined at compile time.

bool logog::operator!= ( const Allocator< T1 > &  ,
const Allocator< T2 > &   
)
bool logog::operator== ( const Allocator< T1 > &  ,
const Allocator< T2 > &   
)
int logog::ReportMemoryAllocations ( )

Sends a report to cout describing the current memory allocations that exist. Returns the outstanding number of memory allocations, or -1 iff LOGOG_LEAK_DETECTION is defined.

int logog::RunAllTests ( )

Executes all currently registered tests and prints a report of success or failure.

void logog::SetDefaultLevel ( LOGOG_LEVEL_TYPE  level)

Sets the current reporting level for the default filter. All messages connected to the filter after this point should obey this default level setting.

void logog::Shutdown ( )

Shuts down the logog system and frees all memory allocated by logog. Memory still allocated by the logog system after Shutdown() indicates a bug. This function is not thread safe. Call it once at the conclusion of your program.

void logog::ShutdownTests ( )

Should remove all memory allocated during unit testing.

Statics& logog::Static ( )
void UnlockAllocationsMutex ( )

A global function to unlock the global allocations mutex. We must do this as a static void because Mutexes depend on Objects.

Variable Documentation

AllocationsType s_Allocations

All currently outstanding memory allocations, including their size.

Mutex s_AllocationsMutex