BALL::VIEW::Message Class Reference
[Messages]

#include <BALL/VIEW/KERNEL/message.h>

Inheritance diagram for BALL::VIEW::Message:
Inheritance graph
[legend]

List of all members.

Public Member Functions

Constructors and Destructor

 Message ()
 Message (const Message &message)
virtual ~Message ()
Accessors: inspectors and mutators

void setSender (const ConnectionObject *sender)
const ConnectionObjectgetSender () const
void setDeletable (bool flag=true)
bool isDeletable () const
boost::any & data ()

Private Attributes

const ConnectionObjectconnection_object_
bool deletable_
boost::any data_

Detailed Description

General Message class. Message is the base class of all message classes and provides a base interface. Message classes will be sent through the ConnectionObject tree for the purpose of communication between several ConnectionObject classes. Each ConnectionObject handels in its onNotify() method messages that are relevant for that class by means of RTTI. This class can be given a sender object that is a pointer to the ConnectionObject that has initially sent the message. This methods concerning the sender object are internally used and no user interaction is necessary. A message can be deletable or not. If a message is deletable it will be deleted after all ConnectionObject objects has been informed of this message. Therefore a deletable message must be created with the new command. All messages should be created with the new command, since they will be automatically deleted after all ConnectionObjects have been notified. See ConnectionObject for further information concerning message handling. and message posting.

Definition at line 52 of file message.h.


Constructor & Destructor Documentation

BALL::VIEW::Message::Message (  ) 

Default Constructor. The state of this message is:

  • sender - set to 0
  • deletable - set to false
BALL::VIEW::Message::Message ( const Message message  ) 

Copy constructor.

virtual BALL::VIEW::Message::~Message (  )  [virtual]

Destructor.


Member Function Documentation

boost::any& BALL::VIEW::Message::data (  )  [inline]

Access the optional data stored in this message. The data is stored as a boost::any to allow any kind of data sets.

Returns:
a mutable reference to the data

Definition at line 115 of file message.h.

const ConnectionObject* BALL::VIEW::Message::getSender (  )  const

Non-mutable inspection of the sender. This method will be used internally by ConnectionObject::onNotify.

See also:
ConnectionObject::onNotify
bool BALL::VIEW::Message::isDeletable (  )  const

Test if this message is deletable.

void BALL::VIEW::Message::setDeletable ( bool  flag = true  ) 

Change the deletable flag. If the parameter flag is set to true the message is set to deletable and will be automatically deleted after all ConnectionObject objects are notified of this message. It is important that the message is created by the new command to avoid segmentation faults.

If the parameter flag is set to false the message will not be automatically deleted.
Avoid creating non-deletable messages because it can result in segmentation faults.
Parameters:
flag the new deletable state of this message
void BALL::VIEW::Message::setSender ( const ConnectionObject sender  ) 

Change the sender. This method will be used internally by ConnectionObject::notify_.

See also:
ConnectionObject::notify_

Member Data Documentation

Definition at line 120 of file message.h.

boost::any BALL::VIEW::Message::data_ [private]

Definition at line 124 of file message.h.

Definition at line 122 of file message.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Generated by  doxygen 1.6.3