Savarese Software Research Corporation

sava::spread::BaseMessage Class Reference

#include <BaseMessage.h>

Inheritance diagram for sava::spread::BaseMessage:

Inheritance graph
[legend]

List of all members.


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 59 of file BaseMessage.h.


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_TYPE_DISCARD, ReliableSelfDiscard = Reliable | SelfDiscard, FIFOSelfDiscard = FIFO | SelfDiscard, CausalSelfDiscard = Causal | SelfDiscard,
  AgreedSelfDiscard = Agreed | SelfDiscard, SafeSelfDiscard = Safe | SelfDiscard
}
 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 throw ()
 Returns the number of bytes in the message.
virtual void clear ()=0
 Clears the message for reuse, resetting its size to zero.
void get_membership_info (MembershipInfo &info) const throw (Error)
 Extracts the membership information contained in this message and stores it in the supplied MembershipInfo object.
void set_service (const service_type service) throw ()
 Sets the service type of the message.
service_type service () const throw ()
 Returns the service type requested (for sends) or sent under (for receives) of the message.
void set_type (const message_type type) throw ()
 Sets the message type identifier.
message_type type () const throw ()
 Returns the type of the message.
void set_sender (const string &sender)
 Sets the message sender.
const string & sender () const throw ()
 Returns the message sender.
void set_endian_mismatch (const bool mismatch=true) throw ()
 Sets the endian mismatch flag to the specified value.
bool endian_mismatch () const throw ()
 Returns true if there is an endian mismatch between sender and receiver, false otherwise.
void set_agreed () throw ()
 Sets the service type to BaseMessage::Agreed.
bool is_agreed () const throw ()
 Returns true if service type is BaseMessage::Agreed, false otherwise.
void set_causal () throw ()
 Sets the service type to BaseMessage::Causal.
bool is_causal () const throw ()
 Returns true if service type is BaseMessage::Causal, false otherwise.
void set_fifo () throw ()
 Sets the service type to BaseMessage::FIFO.
bool is_fifo () const throw ()
 Returns true if service type is BaseMessage::FIFO, false otherwise.
void set_reliable () throw ()
 Sets the service type to BaseMessage::Reliable.
bool is_reliable () const throw ()
 Returns true if service type is BaseMessage::Reliable, false otherwise.
void set_unreliable () throw ()
 Sets the service type to BaseMessage::Unreliable.
bool is_unreliable () const throw ()
 Returns true if service type is BaseMessage::Unreliable, false otherwise.
void set_safe () throw ()
 Sets the service type to BaseMessage::Safe.
bool is_safe () const throw ()
 Returns true if service type is BaseMessage::Safe, false otherwise.
void set_self_discard (const bool discard=true) throw ()
 Adds or removes the BaseMessage::SelfDiscard flag to or from the service type.
bool is_self_discard () const throw ()
 Returns true if service type has the BaseMessage::SelfDiscard flag set, false otherwise.
bool is_regular () const throw ()
 Returns true if this is a regular data (as opposed to membership) message, false otherwise.
bool is_membership () const throw ()
 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.
virtual int sp_get_membership_info (Spread::membership_info *info) const =0
virtual int sp_get_vs_set_members (const Spread::vs_set_info *vs_set, Spread::group_type member_names[], unsigned int member_names_count) const =0
virtual int sp_get_vs_sets_info (Spread::vs_set_info *vs_sets, unsigned int num_vs_sets, unsigned int *index) const =0

Protected Attributes

message_type _type
service_type _service_type
bool _endian_mismatch
string _sender

Member Typedef Documentation

typedef Spread::int16 sava::spread::BaseMessage::message_type

Defines the type for 16-bit message type identifiers.

Definition at line 62 of file BaseMessage.h.

typedef Spread::service sava::spread::BaseMessage::service_type

Defines the type for specifying service types.

Definition at line 65 of file BaseMessage.h.


Member Enumeration Documentation

enum sava::spread::BaseMessage::Service

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 
SERVICE_TYPE_DISCARD 
ReliableSelfDiscard 
FIFOSelfDiscard 
CausalSelfDiscard 
AgreedSelfDiscard 
SafeSelfDiscard 

Definition at line 80 of file BaseMessage.h.


Constructor & Destructor Documentation

sava::spread::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 122 of file BaseMessage.h.

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

Virtual destructor.

Definition at line 143 of file BaseMessage.h.


Member Function Documentation

virtual int sava::spread::BaseMessage::sp_get_membership_info ( Spread::membership_info *  info  )  const [protected, pure virtual]

Implemented in sava::spread::Message, and sava::spread::ScatterMessage.

virtual int sava::spread::BaseMessage::sp_get_vs_set_members ( const Spread::vs_set_info *  vs_set,
Spread::group_type  member_names[],
unsigned int  member_names_count 
) const [protected, pure virtual]

Implemented in sava::spread::Message, and sava::spread::ScatterMessage.

virtual int sava::spread::BaseMessage::sp_get_vs_sets_info ( Spread::vs_set_info *  vs_sets,
unsigned int  num_vs_sets,
unsigned int *  index 
) const [protected, pure virtual]

Implemented in sava::spread::Message, and sava::spread::ScatterMessage.

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

Returns the number of bytes in the message.

Returns:
The number of bytes in the message.

Implemented in sava::spread::Message, and sava::spread::ScatterMessage.

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

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

Implemented in sava::spread::Message, and sava::spread::ScatterMessage.

void sava::spread::BaseMessage::get_membership_info ( MembershipInfo info  )  const throw (Error)

Extracts the membership information contained in this message and stores it in the supplied MembershipInfo object.

Only call this method if the message is a membership message.

Warning: This method is available only when compiled against Spread 4.x and greater.

Parameters:
info A reference to a MembershipInfo that will store the membership information.
Exceptions:
Error If the structure of the message or its service type does not comprise a valid membership message.

Definition at line 71 of file BaseMessage.cc.

References sava::spread::detail::Buffer< type >::resize(), and sava::spread::detail::Buffer< type >::size().

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

Sets the service type of the message.

Parameters:
service The service type of the message.

Definition at line 166 of file BaseMessage.h.

service_type sava::spread::BaseMessage::service (  )  const throw () [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 176 of file BaseMessage.h.

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

Sets the message type identifier.

Parameters:
type The new message type.

Definition at line 184 of file BaseMessage.h.

message_type sava::spread::BaseMessage::type (  )  const throw () [inline]

Returns the type of the message.

Returns:
The type of the message.

Definition at line 192 of file BaseMessage.h.

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

Sets the message sender.

Parameters:
sender The message sender.

Definition at line 200 of file BaseMessage.h.

const string& sava::spread::BaseMessage::sender (  )  const throw () [inline]

Returns the message sender.

This only has meaning for received messages.

Returns:
The message sender.

Definition at line 208 of file BaseMessage.h.

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

Sets the endian mismatch flag to the specified value.

Parameters:
mismatch The mismatch value.

Definition at line 216 of file BaseMessage.h.

bool sava::spread::BaseMessage::endian_mismatch (  )  const throw () [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 226 of file BaseMessage.h.

void sava::spread::BaseMessage::set_agreed (  )  throw () [inline]

Sets the service type to BaseMessage::Agreed.

Definition at line 231 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_agreed (  )  const throw () [inline]

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

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

Definition at line 239 of file BaseMessage.h.

void sava::spread::BaseMessage::set_causal (  )  throw () [inline]

Sets the service type to BaseMessage::Causal.

Definition at line 244 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_causal (  )  const throw () [inline]

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

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

Definition at line 252 of file BaseMessage.h.

void sava::spread::BaseMessage::set_fifo (  )  throw () [inline]

Sets the service type to BaseMessage::FIFO.

Definition at line 257 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_fifo (  )  const throw () [inline]

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

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

Definition at line 265 of file BaseMessage.h.

void sava::spread::BaseMessage::set_reliable (  )  throw () [inline]

Sets the service type to BaseMessage::Reliable.

Definition at line 270 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_reliable (  )  const throw () [inline]

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

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

Definition at line 278 of file BaseMessage.h.

void sava::spread::BaseMessage::set_unreliable (  )  throw () [inline]

Sets the service type to BaseMessage::Unreliable.

Definition at line 283 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_unreliable (  )  const throw () [inline]

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

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

Definition at line 291 of file BaseMessage.h.

void sava::spread::BaseMessage::set_safe (  )  throw () [inline]

Sets the service type to BaseMessage::Safe.

Definition at line 296 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_safe (  )  const throw () [inline]

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

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

Definition at line 304 of file BaseMessage.h.

void sava::spread::BaseMessage::set_self_discard ( const bool  discard = true  )  throw () [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 315 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_self_discard (  )  const throw () [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 327 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_regular (  )  const throw () [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 336 of file BaseMessage.h.

bool sava::spread::BaseMessage::is_membership (  )  const throw () [inline]

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

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

Definition at line 344 of file BaseMessage.h.


Member Data Documentation

message_type sava::spread::BaseMessage::_type [protected]

Definition at line 112 of file BaseMessage.h.

service_type sava::spread::BaseMessage::_service_type [protected]

Definition at line 113 of file BaseMessage.h.

bool sava::spread::BaseMessage::_endian_mismatch [protected]

Definition at line 114 of file BaseMessage.h.

string sava::spread::BaseMessage::_sender [protected]

Definition at line 115 of file BaseMessage.h.


The documentation for this class was generated from the following files:
Savarese Software Research Corporation
Copyright © 2006-2008 Savarese Software Research Corporation. All rights reserved.