Savarese Software Research Corporation
BaseMessage Class Reference

BaseMessage is an abstract class defining the operations shared in common by Message and ScatterMessage. More...

#include <BaseMessage.h>

Inheritance diagram for BaseMessage:
Inheritance graph
[legend]

List of all members.

Public Types

enum   Service {
  Unreliable = UNRELIABLE_MESS, Reliable = RELIABLE_MESS, FIFO = FIFO_MESS, Causal = CAUSAL_MESS,
  Agreed = AGREED_MESS, Safe = SAFE_MESS, SelfDiscard = SELF_DISCARD, DropReceive = DROP_RECV
}
  Service is not a proper enumeration, but rather a specification of constants corresponding to the Spread service type flags. More...
typedef Spread::int16  message_type
  Defines the type for 16-bit message type identifiers.
typedef Spread::service  service_type
  Defines the type for specifying service types.

Public Member Functions

virtual  ~BaseMessage ()
  Virtual destructor.
virtual unsigned int  size () const =0
  Returns the number of bytes in the message.
virtual void  clear ()=0
  Clears the message for reuse, resetting its size to zero.
void  set_service (const service_type service)
  Sets the service type of the message.
service_type  service () const
  Returns the service type requested (for sends) or sent under (for receives) of the message.
void  set_type (const message_type type)
  Sets the message type identifier.
message_type  type () const
  Returns the type of the message.
void  set_sender (const string &sender)
  Sets the message sender.
const string &  sender () const
  Returns the message sender.
void  set_endian_mismatch (const bool mismatch=true)
  Sets the endian mismatch flag to the specified value.
bool  endian_mismatch () const
  Returns true if there is an endian mismatch between sender and receiver, false otherwise.
void  set_agreed ()
  Sets the service type to BaseMessage::Agreed.
bool  is_agreed () const
  Returns true if service type is BaseMessage::Agreed, false otherwise.
void  set_causal ()
  Sets the service type to BaseMessage::Causal.
bool  is_causal () const
  Returns true if service type is BaseMessage::Causal, false otherwise.
void  set_fifo ()
  Sets the service type to BaseMessage::FIFO.
bool  is_fifo () const
  Returns true if service type is BaseMessage::FIFO, false otherwise.
void  set_reliable ()
  Sets the service type to BaseMessage::Reliable.
bool  is_reliable () const
  Returns true if service type is BaseMessage::Reliable, false otherwise.
void  set_unreliable ()
  Sets the service type to BaseMessage::Unreliable.
bool  is_unreliable () const
  Returns true if service type is BaseMessage::Unreliable, false otherwise.
void  set_safe ()
  Sets the service type to BaseMessage::Safe.
bool  is_safe () const
  Returns true if service type is BaseMessage::Safe, false otherwise.
void  set_self_discard (const bool discard=true)
  Adds or removes the BaseMessage::SelfDiscard flag to or from the service type.
bool  is_self_discard () const
  Returns true if service type has the BaseMessage::SelfDiscard flag set, false otherwise.
bool  is_regular () const
  Returns true if this is a regular data (as opposed to membership) message, false otherwise.
bool  is_membership () const
  Returns true if this is a membership message, false otherwise.

Protected Member Functions

  BaseMessage ()
  Initializes the class with a message type equal to 0, service type equal to Safe, endian mismatch equal to false, and a zero-length string for the sender.

Protected Attributes

message_type  _type
service_type  _service_type
bool  _endian_mismatch
string  _sender

Detailed Description

BaseMessage is an abstract class defining the operations shared in common by Message and ScatterMessage.

We do not document its protected members because they are intended only for internal library use.

Definition at line 58 of file BaseMessage.h.


Member Typedef Documentation

typedef Spread::int16 BaseMessage::message_type

Defines the type for 16-bit message type identifiers.

Definition at line 61 of file BaseMessage.h.

typedef Spread::service BaseMessage::service_type

Defines the type for specifying service types.

Definition at line 64 of file BaseMessage.h.


Member Enumeration Documentation

Service is not a proper enumeration, but rather a specification of constants corresponding to the Spread service type flags.

We do not document the meaning of these flags here. See the Spread C API documentation to understand their meaning. We will note, however, that DropReceive is not a service type, but rather a flag instructing the Spread receive functions to truncate messages and group lists if the buffers are too small. There should be no need to use this constant in the API as it is handled by Mailbox::set_drop_receive.

Enumerator:
Unreliable 
Reliable 
FIFO 
Causal 
Agreed 
Safe 
SelfDiscard 
DropReceive 

Definition at line 79 of file BaseMessage.h.


Constructor & Destructor Documentation

BaseMessage::BaseMessage ( ) [inline, protected]

Initializes the class with a message type equal to 0, service type equal to Safe, endian mismatch equal to false, and a zero-length string for the sender.

Definition at line 121 of file BaseMessage.h.

virtual BaseMessage::~BaseMessage ( ) [inline, virtual]

Virtual destructor.

Definition at line 142 of file BaseMessage.h.


Member Function Documentation

virtual void BaseMessage::clear ( ) [pure virtual]

Clears the message for reuse, resetting its size to zero.

Implemented in Message, and ScatterMessage.

bool BaseMessage::endian_mismatch ( ) const [inline]

Returns true if there is an endian mismatch between sender and receiver, false otherwise.

This only has meaning for received messages.

Returns:
true if there is an endian mismatch between sender and receiver, false otherwise.

Definition at line 225 of file BaseMessage.h.

References _endian_mismatch.

bool BaseMessage::is_agreed ( ) const [inline]

Returns true if service type is BaseMessage::Agreed, false otherwise.

Returns:
true if service type is BaseMessage::Agreed, false otherwise.

Definition at line 238 of file BaseMessage.h.

References service().

bool BaseMessage::is_causal ( ) const [inline]

Returns true if service type is BaseMessage::Causal, false otherwise.

Returns:
true if service type is BaseMessage::Causal, false otherwise.

Definition at line 251 of file BaseMessage.h.

References service().

bool BaseMessage::is_fifo ( ) const [inline]

Returns true if service type is BaseMessage::FIFO, false otherwise.

Returns:
true if service type is BaseMessage::FIFO, false otherwise.

Definition at line 264 of file BaseMessage.h.

References service().

bool BaseMessage::is_membership ( ) const [inline]

Returns true if this is a membership message, false otherwise.

Returns:
true if this is a membership message, false otherwise.

Definition at line 343 of file BaseMessage.h.

References service().

bool BaseMessage::is_regular ( ) const [inline]

Returns true if this is a regular data (as opposed to membership) message, false otherwise.

Returns:
true if this is a regular message, false otherwise.

Definition at line 335 of file BaseMessage.h.

References service().

bool BaseMessage::is_reliable ( ) const [inline]

Returns true if service type is BaseMessage::Reliable, false otherwise.

Returns:
true if service type is BaseMessage::Reliable, false otherwise.

Definition at line 277 of file BaseMessage.h.

References service().

bool BaseMessage::is_safe ( ) const [inline]

Returns true if service type is BaseMessage::Safe, false otherwise.

Returns:
true if service type is BaseMessage::Safe, false otherwise.

Definition at line 303 of file BaseMessage.h.

References service().

bool BaseMessage::is_self_discard ( ) const [inline]

Returns true if service type has the BaseMessage::SelfDiscard flag set, false otherwise.

Returns:
true if service type has the BaseMessage::SelfDiscard flag set, false otherwise.

Definition at line 326 of file BaseMessage.h.

References service().

bool BaseMessage::is_unreliable ( ) const [inline]

Returns true if service type is BaseMessage::Unreliable, false otherwise.

Returns:
true if service type is BaseMessage::Unreliable, false otherwise.

Definition at line 290 of file BaseMessage.h.

References service().

const string& BaseMessage::sender ( ) const [inline]

Returns the message sender.

This only has meaning for received messages.

Returns:
The message sender.

Definition at line 207 of file BaseMessage.h.

References _sender.

Referenced by set_sender().

service_type BaseMessage::service ( ) const [inline]

Returns the service type requested (for sends) or sent under (for receives) of the message.

Returns:
The service type of the message.

Definition at line 175 of file BaseMessage.h.

References _service_type.

Referenced by is_agreed(), is_causal(), is_fifo(), is_membership(), is_regular(), is_reliable(), is_safe(), is_self_discard(), is_unreliable(), and set_service().

void BaseMessage::set_agreed ( ) [inline]

Sets the service type to BaseMessage::Agreed.

Definition at line 230 of file BaseMessage.h.

References Agreed, and set_service().

void BaseMessage::set_causal ( ) [inline]

Sets the service type to BaseMessage::Causal.

Definition at line 243 of file BaseMessage.h.

References Causal, and set_service().

void BaseMessage::set_endian_mismatch ( const bool  mismatch = true ) [inline]

Sets the endian mismatch flag to the specified value.

Parameters:
mismatch The mismatch value.

Definition at line 215 of file BaseMessage.h.

References _endian_mismatch.

void BaseMessage::set_fifo ( ) [inline]

Sets the service type to BaseMessage::FIFO.

Definition at line 256 of file BaseMessage.h.

References FIFO, and set_service().

void BaseMessage::set_reliable ( ) [inline]

Sets the service type to BaseMessage::Reliable.

Definition at line 269 of file BaseMessage.h.

References Reliable, and set_service().

void BaseMessage::set_safe ( ) [inline]

Sets the service type to BaseMessage::Safe.

Definition at line 295 of file BaseMessage.h.

References Safe, and set_service().

void BaseMessage::set_self_discard ( const bool  discard = true ) [inline]

Adds or removes the BaseMessage::SelfDiscard flag to or from the service type.

Parameters:
discard true to set the BaseMessage::SelfDiscard flag, false to remove it.

Definition at line 314 of file BaseMessage.h.

References _service_type, and SelfDiscard.

void BaseMessage::set_sender ( const string &  sender ) [inline]

Sets the message sender.

Parameters:
sender The message sender.

Definition at line 199 of file BaseMessage.h.

References _sender, and sender().

void BaseMessage::set_service ( const service_type  service ) [inline]

Sets the service type of the message.

Parameters:
service The service type of the message.

Definition at line 165 of file BaseMessage.h.

References _service_type, and service().

Referenced by Mailbox::send(), set_agreed(), set_causal(), set_fifo(), set_reliable(), set_safe(), and set_unreliable().

void BaseMessage::set_type ( const message_type  type ) [inline]

Sets the message type identifier.

Parameters:
type The new message type.

Definition at line 183 of file BaseMessage.h.

References _type, and type().

Referenced by Mailbox::send().

void BaseMessage::set_unreliable ( ) [inline]

Sets the service type to BaseMessage::Unreliable.

Definition at line 282 of file BaseMessage.h.

References set_service(), and Unreliable.

virtual unsigned int BaseMessage::size ( ) const [pure virtual]

Returns the number of bytes in the message.

Returns:
The number of bytes in the message.

Implemented in Message, and ScatterMessage.

message_type BaseMessage::type ( ) const [inline]

Returns the type of the message.

Returns:
The type of the message.

Definition at line 191 of file BaseMessage.h.

References _type.

Referenced by set_type().


Member Data Documentation

Definition at line 113 of file BaseMessage.h.

Referenced by endian_mismatch(), and set_endian_mismatch().

string BaseMessage::_sender [protected]

Definition at line 114 of file BaseMessage.h.

Referenced by sender(), and set_sender().

Definition at line 112 of file BaseMessage.h.

Referenced by service(), set_self_discard(), and set_service().

Definition at line 111 of file BaseMessage.h.

Referenced by set_type(), and type().


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

Savarese Software Research Corporation
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.