AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agx::Notify Class Referenceabstract

Class for handling logging of messages. More...

#include <Notify.h>

+ Inheritance diagram for agx::Notify:

Public Types

enum  NotifyLevel {
  NOTIFY_DEBUG = 1 << 0, NOTIFY_INFO = 1 << 1, NOTIFY_WARNING = 1 << 2, NOTIFY_ERROR = 1 << 3,
  NOTIFY_END = 1 << 4, NOTIFY_CLEAR = 1 << 5, NOTIFY_PUSH = 1 << 6, NOTIFY_LOGONLY = 1 << 7
}
 
enum  NotifySelection {
  PRINT_NONE = 0, PRINT_FILE = 1, PRINT_TAG = 2, PRINT_LINE = 4,
  PRINT_FUNCTION = 8, PRINT_SELECTION_END = 8, PRINT_DEFAULT = PRINT_TAG | PRINT_FUNCTION, PRINT_ALL = PRINT_FILE | PRINT_TAG | PRINT_LINE | PRINT_FUNCTION
}
 
enum  Priority { HIGHEST_PRIORITY = 2147483647, LOWEST_PRIORITY = 10000, DEFAULT_PRIORITY = 1073741824 }
 Specifies the ranges of the priority which can be assigned to a singleton at the time of creation. More...
 

Public Member Functions

 Notify (std::ostream &out_stream=std::cerr)
 Constructor. More...
 
virtual ~Notify ()
 
void addCallback (NotifyCallback *callback, NotifyLevel l)
 Add a callback class that will be printed to if the notify level less or equal to l. More...
 
void addStream (std::ostream *stream, NotifyLevel l)
 Add a stream that will be printed to if the notify level less or equal to l, the memory will NOT be managed by this class. More...
 
agx::String buildString ()
 
bool getBreakOnError () const
 
virtual std::string getClassName () const =0
 
NotifyLevel getNotifyLevel () const
 
NotifyLevel getOutputMode () const
 
int getPriority () const
 Return the shutdown priority of the singleton instance. More...
 
bool getThrowOnError () const
 
bool getToLogOnly () const
 
agx::LogStream & logStream ()
 
const agx::LogStream & logStream () const
 
bool openLog (const agx::String &filename)
 Open a log file (in the LogStream) More...
 
std::ostream & outStream ()
 
bool removeCallback (NotifyCallback *callback)
 Remove a callback from list of callbacks to report messages to. More...
 
bool removeStream (std::ostream *stream)
 Remove a stream from list of streams to report messages to. More...
 
void setBreakOnError (bool f)
 WIN32 specific: If set to true, a breakpoint will be set in debug build. More...
 
agx::String setDebugStrings (NotifyLevel l, const char *function, int line, const char *file)
 
void setLogNotifyLevel (NotifyLevel l)
 Set the notify level for the LogStream. More...
 
void setNotifyLevel (NotifyLevel level)
 Set the current notify level. More...
 
bool setNotifyLevel (NotifyCallback *callback, NotifyLevel l)
 Set the notify level for a specific callback. More...
 
bool setNotifyLevel (std::ostream *stream, NotifyLevel l)
 Set the notify level for a specific stream. More...
 
void setOutputMode (NotifyLevel l)
 Set the current output mode, do not use! (used internally) More...
 
void setThrowOnError (bool v)
 Specify whether we should Throw an exception upon calling error? More...
 
void setToLogOnly (bool f)
 If f==true, logging will occur only to the LogStream, not to any of the associated ostreams. More...
 
void shutdown () override
 Implement this method to cleanup your Singleton class. More...
 

Static Public Member Functions

static Notify * instance ()
 

Protected Member Functions

void _shutdown ()
 
void clear ()
 
std::string str () const
 
void str (const std::string &text)
 

Protected Attributes

Clear m_clear
 
End m_end
 
LogOnly m_log
 
Push m_push
 

Friends

void agx::setNumThreads (size_t numThreads)
 
void agxCore::init ()
 

Detailed Description

Class for handling logging of messages.

Definition at line 62 of file Notify.h.

Member Enumeration Documentation

Enumerator
NOTIFY_DEBUG 

DEBUG (lowest) level.

NOTIFY_INFO 

INFO level.

NOTIFY_WARNING 

WARNING level.

NOTIFY_ERROR 

ERROR (highest) level.

NOTIFY_END 
NOTIFY_CLEAR 
NOTIFY_PUSH 
NOTIFY_LOGONLY 

Definition at line 66 of file Notify.h.

Enumerator
PRINT_NONE 
PRINT_FILE 
PRINT_TAG 
PRINT_LINE 
PRINT_FUNCTION 
PRINT_SELECTION_END 
PRINT_DEFAULT 
PRINT_ALL 

Definition at line 76 of file Notify.h.

enum agx::Singleton::Priority
inherited

Specifies the ranges of the priority which can be assigned to a singleton at the time of creation.

Enumerator
HIGHEST_PRIORITY 

The highest priority that can be given to a singleton.

LOWEST_PRIORITY 

The lowest priority that can be given to a singleton.

DEFAULT_PRIORITY 

The default priority given to a singleton.

Definition at line 35 of file Singleton.h.

Constructor & Destructor Documentation

agx::Notify::Notify ( std::ostream &  out_stream = std::cerr)

Constructor.

Parameters
out_stream- Connect the default output to a specified stream, default is std::cerr
virtual agx::Notify::~Notify ( )
virtual

Member Function Documentation

void agx::Singleton::_shutdown ( )
protectedinherited
void agx::Notify::addCallback ( NotifyCallback *  callback,
NotifyLevel  l 
)

Add a callback class that will be printed to if the notify level less or equal to l.

void agx::Notify::addStream ( std::ostream *  stream,
NotifyLevel  l 
)

Add a stream that will be printed to if the notify level less or equal to l, the memory will NOT be managed by this class.

agx::String agx::Notify::buildString ( )
void agx::Notify::clear ( )
protected
bool agx::Notify::getBreakOnError ( ) const
Returns
true if an a breakpoint should be set upon calling error
virtual std::string agx::Singleton::getClassName ( ) const
pure virtualinherited
NotifyLevel agx::Notify::getNotifyLevel ( ) const
Returns
the current notify level
NotifyLevel agx::Notify::getOutputMode ( ) const
Returns
the current notify level
int agx::Singleton::getPriority ( ) const
inherited

Return the shutdown priority of the singleton instance.

bool agx::Notify::getThrowOnError ( ) const
Returns
true if an exception should be thrown upon calling error?
bool agx::Notify::getToLogOnly ( ) const
Returns
true if logging occurs to the LogStream ONLY.
static Notify* agx::Notify::instance ( )
static
Returns
pointer to the singleton instance of a Notify
agx::LogStream& agx::Notify::logStream ( )
Returns
a reference to the LogStream used for streaming messages to function callbacks, files..
const agx::LogStream& agx::Notify::logStream ( ) const
Returns
a reference to the LogStream used for streaming messages to function callbacks, files..
bool agx::Notify::openLog ( const agx::String &  filename)

Open a log file (in the LogStream)

std::ostream& agx::Notify::outStream ( )
bool agx::Notify::removeCallback ( NotifyCallback *  callback)

Remove a callback from list of callbacks to report messages to.

Returns
true if the stream was removed
bool agx::Notify::removeStream ( std::ostream *  stream)

Remove a stream from list of streams to report messages to.

NO memory will be deallocated.

Returns
true if the stream was removed
void agx::Notify::setBreakOnError ( bool  f)

WIN32 specific: If set to true, a breakpoint will be set in debug build.

This makes it easier to debug problems in VisualStudio. A call to this method has effect only if:

  • Built in VisualStudio
  • Build in DEBUG mode

Observe, if this is set to true, NO exception will be generated if the above conditions are met.

agx::String agx::Notify::setDebugStrings ( NotifyLevel  l,
const char *  function,
int  line,
const char *  file 
)
void agx::Notify::setLogNotifyLevel ( NotifyLevel  l)

Set the notify level for the LogStream.

void agx::Notify::setNotifyLevel ( NotifyLevel  level)

Set the current notify level.

bool agx::Notify::setNotifyLevel ( NotifyCallback *  callback,
NotifyLevel  l 
)

Set the notify level for a specific callback.

Returns
true if the stream exists
bool agx::Notify::setNotifyLevel ( std::ostream *  stream,
NotifyLevel  l 
)

Set the notify level for a specific stream.

Returns
true if the stream exists
void agx::Notify::setOutputMode ( NotifyLevel  l)

Set the current output mode, do not use! (used internally)

void agx::Notify::setThrowOnError ( bool  v)

Specify whether we should Throw an exception upon calling error?

void agx::Notify::setToLogOnly ( bool  f)

If f==true, logging will occur only to the LogStream, not to any of the associated ostreams.

void agx::Notify::shutdown ( )
overridevirtual

Implement this method to cleanup your Singleton class.

Reimplemented from agx::Singleton.

std::string agx::Notify::str ( ) const
protected
void agx::Notify::str ( const std::string &  text)
protected

Friends And Related Function Documentation

void agx::setNumThreads ( size_t  numThreads)
friend
void agxCore::init ( )
friend

Member Data Documentation

Clear agx::Notify::m_clear
protected

Definition at line 364 of file Notify.h.

End agx::Notify::m_end
protected

Definition at line 363 of file Notify.h.

LogOnly agx::Notify::m_log
protected

Definition at line 366 of file Notify.h.

Push agx::Notify::m_push
protected

Definition at line 365 of file Notify.h.


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