GestureRecognitionToolkit  Version: 0.2.5
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
Log Class Reference

The Log class provides the base class for all GRT logging functionality. More...

#include <Log.h>

Inheritance diagram for Log:
DebugLog ErrorLog InfoLog TestingLog TrainingLog

Public Types

typedef std::basic_ostream< char, std::char_traits< char > > CoutType
 this is the type of std::cout
 
typedef CoutType &(* StandardEndLine) (CoutType &)
 this is the function signature of std::endl
 

Public Member Functions

 Log (const std::string &key="")
 defines the log default constructor More...
 
 Log (const Log &rhs)
 defines the log copy constructor More...
 
Logoperator= (const Log &rhs)
 defines the log equals operator More...
 
template<class T >
const Logoperator<< (const T &val) const
 defines an operator<< to write a value to std::endl, this updates the message
 
const Logoperator<< (const StandardEndLine manip) const
 defines an operator<< to take in std::endl, this ends a message and triggers the mesaage callback
 
virtual bool getInstanceLoggingEnabled () const
 returns true if logging is enabled for this specific instance More...
 
virtual std::string getKey () const
 returns the key that gets written at the start of each message More...
 
virtual std::string getLastMessage () const
 returns the last message written by the log More...
 
virtual bool setKey (const std::string &key)
 sets the key that gets written at the start of each message, this will be written in the format 'key message'. The key can be empty. More...
 
virtual bool getInstanceLoggingEnabled ()
 returns if logging is enabled for this specific instance More...
 
virtual bool setInstanceLoggingEnabled (const bool loggingEnabled)
 sets if logging is enabled for this specific instance More...
 
 GRT_DEPRECATED_MSG ("setProceedingText is deprecated, use setKey instead", void setProceedingText(std::string proceedingText))
 
 GRT_DEPRECATED_MSG ("getProceedingText is deprecated, use getKey instead", std::string getProceedingText() const )
 
 GRT_DEPRECATED_MSG ("setEnableInstanceLogging is deprecated, use setInstanceLoggingEnabled instead", bool setEnableInstanceLogging(const bool loggingEnabled))
 

Static Public Member Functions

static bool getLoggingEnabled ()
 returns true if logging is enabled for this class, this supersedes the specific instance logging More...
 
static bool setLoggingEnabled (const bool enabled)
 sets if logging is enabled for this class, this supersedes the specific instance logging More...
 

Protected Member Functions

virtual void triggerCallback (const std::string &message) const
 This callback can be used to propagate messages to other interfaces (e.g., a GUI built on top of the GRT). It gets triggered anytime a message is ended (with std::endl), the message will contain the full message + the log key. To use this, inherit from the log base class and overwrite the contents of this virtual function. More...
 

Protected Attributes

std::string key
 The key that will be written at the start of each log.
 
std::string lastMessage
 The last message written.
 
bool writeKey
 If true, then the key will be written at the start of each log message.
 
bool instanceLoggingEnabled
 If true, then this instance should log messages.
 
bool * loggingEnabledPtr
 This is a hack that enables variables to be updated inside const methods.
 
bool * writeKeyPtr
 This is a hack that enables variables to be updated inside const methods.
 
std::string * lastMessagePtr
 This is a hack that enables variables to be updated inside const methods.
 

Static Protected Attributes

static bool baseLoggingEnabled = true
 This controls logging across all Log instances, as opposed to a single instance. More...
 

Detailed Description

The Log class provides the base class for all GRT logging functionality.

Definition at line 37 of file Log.h.

Constructor & Destructor Documentation

Log::Log ( const std::string &  key = "")
inline

defines the log default constructor

Parameters
keythe key that will written to the start of every log message, can be empty

Definition at line 46 of file Log.h.

Log::Log ( const Log rhs)
inline

defines the log copy constructor

Parameters
rhsthe rhs log instance that will be copied to this instance

Definition at line 59 of file Log.h.

Member Function Documentation

virtual bool Log::getInstanceLoggingEnabled ( ) const
inlinevirtual

returns true if logging is enabled for this specific instance

Returns
returns true if logging is enabled for this specific instance, false otherwise

Definition at line 141 of file Log.h.

virtual bool Log::getInstanceLoggingEnabled ( )
inlinevirtual

returns if logging is enabled for this specific instance

Returns
returns true if logging is enabled for this specific instance, false otherwise

Definition at line 184 of file Log.h.

virtual std::string Log::getKey ( ) const
inlinevirtual

returns the key that gets written at the start of each message

Returns
returns the key used to tag each message

Definition at line 149 of file Log.h.

virtual std::string Log::getLastMessage ( ) const
inlinevirtual

returns the last message written by the log

Returns
returns a string containing the last message written by the log

Definition at line 157 of file Log.h.

static bool Log::getLoggingEnabled ( )
inlinestatic

returns true if logging is enabled for this class, this supersedes the specific instance logging

Returns
returns true if logging is enabled for this class, false otherwise

Definition at line 176 of file Log.h.

Log& Log::operator= ( const Log rhs)
inline

defines the log equals operator

Parameters
rhsthe rhs log instance that will be copied to this instance
Returns
returns a reference to this instance

Definition at line 76 of file Log.h.

virtual bool Log::setInstanceLoggingEnabled ( const bool  loggingEnabled)
inlinevirtual

sets if logging is enabled for this specific instance

Returns
returns true if the parameter was updated successfully, false otherwise

Definition at line 201 of file Log.h.

virtual bool Log::setKey ( const std::string &  key)
inlinevirtual

sets the key that gets written at the start of each message, this will be written in the format 'key message'. The key can be empty.

Parameters
keythe new key, this can be empty
Returns
returns true if the key was updated

Definition at line 166 of file Log.h.

static bool Log::setLoggingEnabled ( const bool  enabled)
inlinestatic

sets if logging is enabled for this class, this supersedes the specific instance logging

Returns
returns true if the parameter was updated successfully, false otherwise

Definition at line 192 of file Log.h.

virtual void Log::triggerCallback ( const std::string &  message) const
inlineprotectedvirtual

This callback can be used to propagate messages to other interfaces (e.g., a GUI built on top of the GRT). It gets triggered anytime a message is ended (with std::endl), the message will contain the full message + the log key. To use this, inherit from the log base class and overwrite the contents of this virtual function.

Parameters
messagethe message from the latest log

Reimplemented in DebugLog, InfoLog, TestingLog, ErrorLog, and TrainingLog.

Definition at line 217 of file Log.h.

Member Data Documentation

GRT_BEGIN_NAMESPACE bool Log::baseLoggingEnabled = true
staticprotected

This controls logging across all Log instances, as opposed to a single instance.

Global logging for base class.

Definition at line 228 of file Log.h.


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