|
AGX Dynamics 2.42.3.1
|
Class for polling messages from the LOGGER system in a Subscriber pattern. More...
#include <LoggerSubscriber.h>
Inheritance diagram for agx::LoggerSubscriber:Classes | |
| class | LogCallback |
Public Types | |
| typedef std::pair< int, agx::String > | Message |
| typedef agx::Vector< Message > | MessageVector |
Public Member Functions | |
| LoggerSubscriber (int levelMask=agx::Notify::NOTIFY_INFO|agx::Notify::NOTIFY_WARNING|agx::Notify::NOTIFY_ERROR) | |
| Constructor for a logger mailbox. | |
| void | clear (int levelMask=ALL_LEVELS) |
| Remove all messages. | |
| bool | empty (int levelMask=ALL_LEVELS) const |
| bool | getEnable () const |
| bool | getMessages (MessageVector &messages, bool clearMessages, int levelMask=ALL_LEVELS) |
Get a copy of all messages matching the specified notify level levelMask in the message queue. | |
| size_t | pop (agx::StringVector &outMessages, int levelMask=ALL_LEVELS) |
| Get all available messages and then remove them. | |
| std::string | pop (int levelMask=ALL_LEVELS) |
| Get all available messages and then remove them. | |
| void | setEnable (bool flag) |
| Enable/disable the capturing of messages. | |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Static Public Attributes | |
| static int | ALL_LEVELS |
Protected Member Functions | |
| virtual | ~LoggerSubscriber () |
| Destructor. | |
| void | message (const agx::String &msg, int notifyLevel) |
| Callback that will be called when a new message is present. | |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Additional Inherited Members | |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
Class for polling messages from the LOGGER system in a Subscriber pattern.
Messages is stored until the message pop() is called. The class is reentrant thread safe.
There are a message queue for each NotifyLevel. So all methods can use a bitmask to filter out which queue that is requested.
Definition at line 33 of file LoggerSubscriber.h.
| typedef std::pair<int, agx::String> agx::LoggerSubscriber::Message |
Definition at line 87 of file LoggerSubscriber.h.
Definition at line 88 of file LoggerSubscriber.h.
| agx::LoggerSubscriber::LoggerSubscriber | ( | int | levelMask = agx::Notify::NOTIFY_INFO|agx::Notify::NOTIFY_WARNING|agx::Notify::NOTIFY_ERROR | ) |
Constructor for a logger mailbox.
| levelMask | - Specifies which levels of messages that will be captured. Default is all messages with equal or higher level that NOTIFY_INFO. |
|
protectedvirtual |
Destructor.
| void agx::LoggerSubscriber::clear | ( | int | levelMask = ALL_LEVELS | ) |
Remove all messages.
| levelMask | - Specifies which levels of messages that should be cleared, by default all levels |
| bool agx::LoggerSubscriber::empty | ( | int | levelMask = ALL_LEVELS | ) | const |
| levelMask | - Specifies which levels of messages that should be checked for, by default all levels |
| bool agx::LoggerSubscriber::getEnable | ( | ) | const |
| bool agx::LoggerSubscriber::getMessages | ( | MessageVector & | messages, |
| bool | clearMessages, | ||
| int | levelMask = ALL_LEVELS |
||
| ) |
Get a copy of all messages matching the specified notify level levelMask in the message queue.
Each message contains a pair of: NOTIFY level (INFO, WARNING, ERROR) and the message string in chronological order
| messages | - Reference to a message queue that will be populated with all the matching messages |
| clearMessages | - If true, the message queue will be cleared from the matching messages |
|
protected |
Callback that will be called when a new message is present.
| size_t agx::LoggerSubscriber::pop | ( | agx::StringVector & | outMessages, |
| int | levelMask = ALL_LEVELS |
||
| ) |
Get all available messages and then remove them.
| [out] | outMessages | - Where messages will be stored |
| levelMask | - Specifies which levels of messages that should be captured. |
| std::string agx::LoggerSubscriber::pop | ( | int | levelMask = ALL_LEVELS | ) |
Get all available messages and then remove them.
| levelMask | - Specifies which levels of messages that should be checked for. |
| void agx::LoggerSubscriber::setEnable | ( | bool | flag | ) |
Enable/disable the capturing of messages.
| flag | - If true messages will be captured |
|
static |
Definition at line 38 of file LoggerSubscriber.h.