acedia::Message Class Reference

The Message class provides an immutable, fixed-length array. More...

#include <message.hpp>

Inheritance diagram for acedia::Message:
acedia::AnyArray

List of all members.

Public Member Functions

 Message ()
 Message (const ActorRef &sender, const ActorRef &receiver)
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &value)
 Creates a message with one element.
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &v1, const Any &v2)
 Creates a message with two elements.
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &v1, const Any &v2, const Any &v3)
 Creates a message with three elements.
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &v1, const Any &v2, const Any &v3, const Any &v4)
 Creates a message with four elements.
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &v1, const Any &v2, const Any &v3, const Any &v4, const Any &v5)
 Creates a message with five elements.
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &v1, const Any &v2, const Any &v3, const Any &v4, const Any &v5, const Any &v6)
 Creates a message with six elements.
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &v1, const Any &v2, const Any &v3, const Any &v4, const Any &v5, const Any &v6, const Any &v7)
 Creates a message with seven elements.
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &v1, const Any &v2, const Any &v3, const Any &v4, const Any &v5, const Any &v6, const Any &v7, const Any &v8)
 Creates a message with eight elements.
 Message (const ActorRef &sender, const ActorRef &receiver, const Any &v1, const Any &v2, const Any &v3, const Any &v4, const Any &v5, const Any &v6, const Any &v7, const Any &v8, const Any &v9)
 Creates a message with nine elements.
 Message (const Message &other)
 ~Message ()
Messageoperator= (const Message &other)
bool operator== (const Message &other) const
virtual boost::uint32_t length () const
ActorRefsender () const
ActorRefreceiver () const
virtual const Anyat (boost::uint32_t pos) const
String toString (bool verbose=false) const
 Try to display this message as a string.
virtual bool isMessage () const
 Serializes this message to a String.

Detailed Description

The Message class provides an immutable, fixed-length array.

All elements are stored in instances of Any. Messages are implicitly shared and due to their immutable behavior thread safe.

Note:
don't use pointers to messages! Always use its copy constructor which is both fast and safe

Definition at line 68 of file message.hpp.


Constructor & Destructor Documentation

acedia::Message::Message (  ) 

Default constructor (create an empty, invalid message).

Definition at line 107 of file message.cpp.

acedia::Message::Message ( const ActorRef sender,
const ActorRef receiver 
)

Default constructor (create an empty message with sender).

Definition at line 117 of file message.cpp.

acedia::Message::Message ( const Message other  ) 

Copy constructor.

Definition at line 187 of file message.cpp.

acedia::Message::~Message (  ) 

Destructor.

Definition at line 192 of file message.cpp.


Member Function Documentation

const Any & acedia::Message::at ( boost::uint32_t  pos  )  const [virtual]
Returns:
Element on index pos
Exceptions:
IndexOutOfBoundsException if pos >= length()

Implements acedia::AnyArray.

Definition at line 223 of file message.cpp.

bool acedia::Message::isMessage (  )  const [virtual]

Serializes this message to a String.

Returns:
the serialized message Deserialize str and return the deserialized message.
the deserialized message
Exceptions:
NotDeserializableException if str could not be deserialized Overrides AnyArray::isMessage().

Reimplemented from acedia::AnyArray.

Definition at line 321 of file message.cpp.

boost::uint32_t acedia::Message::length (  )  const [virtual]
Returns:
the number of elements in the message

Implements acedia::AnyArray.

Definition at line 218 of file message.cpp.

Message & acedia::Message::operator= ( const Message other  ) 

Assigns all elements from other to this.

Definition at line 210 of file message.cpp.

bool acedia::Message::operator== ( const Message other  )  const
Returns:
true if all elements are equal

Definition at line 229 of file message.cpp.

ActorRef & acedia::Message::receiver (  )  const
Returns:
the receiver of this message

Definition at line 205 of file message.cpp.

ActorRef & acedia::Message::sender (  )  const
Returns:
the sender of this message

Definition at line 200 of file message.cpp.

String acedia::Message::toString ( bool  verbose = false  )  const

Try to display this message as a string.

This method tries to display the message content as a string. This is no serialization! By default this method can convert only a few datatypes to strings (namely: all primitive data types plus String and - of course - tuples). If you want to extend this feature see ToStringConverter.

Returns:
a string that describes the message

Definition at line 299 of file message.cpp.


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

Generated by  doxygen 1.6.2