MessageLog Class Reference
[Services]

This class provides an interface to the message logging system. More...

#include <MessageLog.h>

Inheritance diagram for MessageLog:

Inheritance graph

List of all members.

Public Types

typedef std::vector< Message * >
::iterator 
iterator
typedef std::vector< Message * >
::const_iterator 
const_iterator
typedef ::size_t size_t

Public Member Functions

virtual MessagecreateMessage (const std::string &action, const std::string &component, const std::string &key, bool finalizeOnCreate=false, bool recurse=true)=0
virtual StepcreateStep (const std::string &action, const std::string &component, const std::string &key, bool recurse=true)=0
virtual const std::string & getLogName () const =0
virtual MessageLog::size_t size () const =0
virtual MessageLog::iterator begin ()=0
virtual MessageLog::const_iterator begin () const =0
virtual MessageLog::iterator end ()=0
virtual MessageLog::const_iterator end () const =0
virtual Messageoperator[] (MessageLog::size_t i)=0
virtual const Messageoperator[] (MessageLog::size_t i) const =0

Static Public Member Functions

static const std::string & signalMessageAdded ()
static const std::string & signalMessageModified ()
static const std::string & signalMessageHidden ()
static const std::string & signalMessageDeleted ()
static const std::string & signalMessageDetached ()

Protected Member Functions

virtual ~MessageLog ()


Detailed Description

This class provides an interface to the message logging system.

A message log is displayed as a tab in the message log window and saved to a file of the same name. New messages and steps can be added with this interface. This interface can also be attached to receive Subject/Observer messages as data is added to the message log.

This subclass of Subject will notify upon the following conditions:

Definition at line 46 of file MessageLog.h.


Member Typedef Documentation

typedef std::vector<Message*>::iterator MessageLog::iterator

An STL iterator type.

Has the semantics of an std::vector

Definition at line 52 of file MessageLog.h.

An STL iterator type.

Has the semantics of an std::vector

Definition at line 57 of file MessageLog.h.

A type representing sizes and indices.

Definition at line 62 of file MessageLog.h.


Constructor & Destructor Documentation

virtual MessageLog::~MessageLog (  )  [protected, virtual]

This will be cleaned up during application close.

Plug-ins do not need to destroy it.

Definition at line 234 of file MessageLog.h.


Member Function Documentation

static const std::string& MessageLog::signalMessageAdded (  )  [static]

Emitted with any<Message*> when a message is added to the log.

Definition at line 68 of file MessageLog.h.

static const std::string& MessageLog::signalMessageModified (  )  [static]

Emitted with any<Message*> when a message in the log changes.

Definition at line 72 of file MessageLog.h.

static const std::string& MessageLog::signalMessageHidden (  )  [static]

Emitted with any<Message*> when a message in the log is finalized.

Definition at line 76 of file MessageLog.h.

static const std::string& MessageLog::signalMessageDeleted (  )  [static]

Emitted with any<Message*> when a message is deleted from the log.

Definition at line 80 of file MessageLog.h.

static const std::string& MessageLog::signalMessageDetached (  )  [static]

Emitted with any<Message*> when a message is detached from the log.

Definition at line 84 of file MessageLog.h.

virtual Message* MessageLog::createMessage ( const std::string &  action,
const std::string &  component,
const std::string &  key,
bool  finalizeOnCreate = false,
bool  recurse = true 
) [pure virtual]

Creates a new message to be added to a log.

Properties can be added to the message until it is finalized. Messages should be used to log information that is not necessary to repeat a process, but is informative only. This could include intermediate results from an algorithm or detailed information about a failure. A component and key must be provided to uniquely identify a message. The purpose of the component and key is to allow messages to be uniquely identified between versions of the software, so that any code that may subscribe to messages or parses the message log does not need to be regularly updated.

Parameters:
action A string describing the nature of the event that triggered the message.
component A string specifying the component that is requesting a message be created, for example the name of the plug-in suite logging the message.
key A string that specifies a identifier for this message being created. The key combined with the component shall uniquely identify a message.
finalizeOnCreate If this is true, the Message will be automatically finalized.
recurse If this is true, steps are recursed and the Message is added to the deepest un-finalized step.
Returns:
A pointer to the message created. This pointer will be valid until it is finalized.
Subject Notifications:
This method will notify signalMessageAdded() with boost::any<Message*>.
See also:
Message::finalize()

virtual Step* MessageLog::createStep ( const std::string &  action,
const std::string &  component,
const std::string &  key,
bool  recurse = true 
) [pure virtual]

Creates a new 'step' message to be added to a log.

Properties can be added to the message until it is finalized. 'Step' messages should be used to log information that is necessary to repeat a process. Steps can have sub-steps. After creating a 'step' message, all properties necessary to duplicate that step should be added to the message. A component and key must be provided to uniquely identify a step. The purpose of the component and key is to allow steps to be uniquely identified between versions of the software, so that any code that may subscribe to steps or parses the message log does not need to be regularly updated.

Parameters:
action A string describing the nature of the event that triggered the message.
component A string specifying the component that is requesting a step be created, for example the name of the plug-in suite logging the step.
key A string that specifies a identifier for this step being created. The key combined with the component shall uniquely identify a step.
recurse If this is true, steps are recursed and the new Step is added to the deepest un-finalized step.
Returns:
A pointer to the message created. This pointer will be valid until it is finalized.
Subject Notifications:
This method will notify signalMessageAdded() with boost::any<Message*>.
See also:
Step::finalize()

virtual const std::string& MessageLog::getLogName (  )  const [pure virtual]

Get the name of this message log.

Returns:
The name of this log

virtual MessageLog::size_t MessageLog::size (  )  const [pure virtual]

Obtain the count of Messages in this MessageLog.

Returns:
the number of Messages

virtual MessageLog::iterator MessageLog::begin (  )  [pure virtual]

Obtain an STL iterator over Messages in this MessageLog starting at the begining of the vector.

This iterator has the behavior of a std::vector::iterator

Returns:
an iterator over the MessageLog's Messages

virtual MessageLog::const_iterator MessageLog::begin (  )  const [pure virtual]

Obtain an STL const_iterator over Messages in this MessageLog starting at the begining of the vector.

This iterator has the behavior of a std::vector::const_iterator

Returns:
a const_iterator over the MessageLog's Messages

virtual MessageLog::iterator MessageLog::end (  )  [pure virtual]

Obtain an STL iterator over Messages in this MessageLog starting at the end of the vector.

This iterator has the behavior of a std::vector::iterator

Returns:
an iterator over the MessageLog's Messages

virtual MessageLog::const_iterator MessageLog::end (  )  const [pure virtual]

Obtain an STL const_iterator over Messages in this MessageLog starting at the end of the vector.

This iterator has the behavior of a std::vector::const_iterator

Returns:
a const_iterator over the MessageLog's Messages

virtual Message* MessageLog::operator[] ( MessageLog::size_t  i  )  [pure virtual]

Get the Message at index i.

This function has the same semantics as std::vector::operator[]. It does not ensure that i is a valid index.

Parameters:
i The index to return.
Returns:
The Message requested

virtual const Message* MessageLog::operator[] ( MessageLog::size_t  i  )  const [pure virtual]


Software Development Kit - Opticks 4.9.0 Build 16218