ScribeGroup Class Reference

#include <ScribeGroup.h>

List of all members.


Detailed Description

Capsulates the informations of a scribe multicast group.

Public Member Functions

 ScribeGroup (OverlayKey id)
 Creates a new ScribeGroup.
 ~ScribeGroup ()
pair< set
< NodeHandle >
::iterator, bool > 
addChild (const NodeHandle &node)
 Adds a new child to the multicast tree.
void removeChild (const NodeHandle &node)
 Removes a child from the multicast tree.
set< NodeHandle >
::iterator 
getChildrenBegin ()
 Returns an iterator to the begin of the children list.
set< NodeHandle >
::iterator 
getChildrenEnd ()
 Returns an iterator to the end of the children list.
int numChildren () const
 Get the number of children.
bool isForwarder () const
 Return whether the node is forwarder for a group.
bool getAmISource () const
 Returns the amISource status.
void setAmISource (bool source)
 Set the amISource status.
bool getSubscription () const
 Returns whether the local node is subscriber of the group.
void setSubscription (bool subscribe)
 Set the subscription status.
NodeHandle getParent () const
 Return the parent in the multicast tree.
void setParent (NodeHandle &_parent)
 Sets a new parent for the multicast tree.
NodeHandle getRendezvousPoint () const
 Returns the rendevouzPoint (root) of the multicast tree for the group.
void setRendezvousPoint (const NodeHandle &_rendezvousPoint)
 Sets the rendevouzPoint (root) of the multicast tree for the group.
OverlayKey getGroupId () const
 Returns the groupId of the group.
ScribeTimer * getParentTimer ()
 Returns the parent timer.
void setParentTimer (ScribeTimer *t)
 Sets the parent timer.
ScribeTimer * getHeartbeatTimer ()
 Returns the heartbeat timer.
void setHeartbeatTimer (ScribeTimer *t)
 Sets the heartbeat timer.
bool operator== (const OverlayKey &id) const
 Checks whether the group has a certain groupId.
bool operator== (const ScribeGroup &a) const
 Checks whether two groups have the same ID.
bool operator< (const OverlayKey &id) const
 Checks whether the group has a smaller ID than the given key.
bool operator< (const ScribeGroup &a) const
 Checks whether the group has a smaller ID than another group.

Private Attributes

OverlayKey groupId
NodeHandle rendezvousPoint
NodeHandle parent
set< NodeHandlechildren
bool subscription
bool amISource
ScribeTimer * parentTimer
ScribeTimer * heartbeatTimer

Constructor & Destructor Documentation

ScribeGroup::ScribeGroup ( OverlayKey  id  ) 

Creates a new ScribeGroup.

Parameters:
id The group ID of the new group
00029                                         : groupId(id)
00030 {
00031     parent = NodeHandle::UNSPECIFIED_NODE;
00032     rendezvousPoint = NodeHandle::UNSPECIFIED_NODE;
00033     subscription = false;
00034     amISource = false;
00035     parentTimer = NULL;
00036     heartbeatTimer = NULL;
00037 }

ScribeGroup::~ScribeGroup (  ) 

00040 {
00041     children.clear();
00042 }


Member Function Documentation

pair< set< NodeHandle >::iterator, bool > ScribeGroup::addChild ( const NodeHandle node  ) 

Adds a new child to the multicast tree.

Parameters:
node The nodeHandle of the child
Returns:
An iterator to the inserted child and a boolean value (true = new child, false = child was already present)
00050 {
00051     return children.insert(node);
00052 }

void ScribeGroup::removeChild ( const NodeHandle node  ) 

Removes a child from the multicast tree.

Parameters:
node The nodeHandle of the child
00055 {
00056     children.erase(node);
00057 }

set< NodeHandle >::iterator ScribeGroup::getChildrenBegin (  ) 

Returns an iterator to the begin of the children list.

Returns:
the iterator
00061 {
00062     return children.begin();
00063 }

set< NodeHandle >::iterator ScribeGroup::getChildrenEnd (  ) 

Returns an iterator to the end of the children list.

Returns:
the iterator
00066 {
00067     return children.end();
00068 }

int ScribeGroup::numChildren (  )  const [inline]

Get the number of children.

Returns:
The number of children
00096 { return children.size(); }

bool ScribeGroup::isForwarder (  )  const

Return whether the node is forwarder for a group.

Returns:
True if there are any children, false else.
00045 {
00046     return !children.empty();
00047 }

bool ScribeGroup::getAmISource (  )  const [inline]

Returns the amISource status.

This status indicates if the node is a source of the multicastgroup FIXME: currently the flag is only be set to true if the node is not also a member (i.e. subscriber) of the group

Returns:
True if the node is sending in multicast messages to the group
00114 { return amISource; }

void ScribeGroup::setAmISource ( bool  source  )  [inline]

Set the amISource status.

This status indicates if the node is a source of the multicastgroup FIXME: currently the flag is only be set to true if the node is not also a member (i.e. subscriber) of the group

Parameters:
source True if the node is sending in multicast messages to the group
00125 { amISource = source; }

bool ScribeGroup::getSubscription (  )  const [inline]

Returns whether the local node is subscriber of the group.

Returns:
True if the local node is interested in multicast messages for the group, false else
00132 { return subscription; }

void ScribeGroup::setSubscription ( bool  subscribe  )  [inline]

Set the subscription status.

Parameters:
subscribe True if the node is interested in multicast messages for the group, false else
00139 { subscription = subscribe; }

NodeHandle ScribeGroup::getParent (  )  const [inline]

Return the parent in the multicast tree.

Returns:
The parent. thisNode if the node is root of the tree
00146 { return parent; }

void ScribeGroup::setParent ( NodeHandle _parent  )  [inline]

Sets a new parent for the multicast tree.

Parameters:
_parent The new Parent. Set to thisNode if node should be root of the tree
00153 { parent = _parent; }

NodeHandle ScribeGroup::getRendezvousPoint (  )  const [inline]

Returns the rendevouzPoint (root) of the multicast tree for the group.

Returns:
The root of the multicast tree if known. UNSPECIFIED_NODE else
00160 { return rendezvousPoint; }

void ScribeGroup::setRendezvousPoint ( const NodeHandle _rendezvousPoint  )  [inline]

Sets the rendevouzPoint (root) of the multicast tree for the group.

Parameters:
_rendezvousPoint The root of the tree
00167 { rendezvousPoint = _rendezvousPoint; }

OverlayKey ScribeGroup::getGroupId (  )  const [inline]

Returns the groupId of the group.

Returns:
The group ID
00174 { return groupId; }

ScribeTimer* ScribeGroup::getParentTimer (  )  [inline]

Returns the parent timer.

The parent timer is supposed to expire if the parent fails to send heartbeat messages.

Returns:
The parentTimer
00184 { return parentTimer; }

void ScribeGroup::setParentTimer ( ScribeTimer *  t  )  [inline]

Sets the parent timer.

The parent timer is supposed to expire if the parent fails to send heartbeat messages.

Parameters:
t The parentTimer
00194 { parentTimer = t; }

ScribeTimer* ScribeGroup::getHeartbeatTimer (  )  [inline]

Returns the heartbeat timer.

If the timer expires, the node is supposed to send heartbeat messages to all children.

Returns:
The heratbetTimer
00204 { return heartbeatTimer; }

void ScribeGroup::setHeartbeatTimer ( ScribeTimer *  t  )  [inline]

Sets the heartbeat timer.

If the timer expires, the node is supposed to send heartbeat messages to all children.

Parameters:
t The heartbeatTimer
00214 { heartbeatTimer = t; }

bool ScribeGroup::operator== ( const OverlayKey id  )  const [inline]

Checks whether the group has a certain groupId.

Parameters:
id The groupId to check
Returns:
True if id == groupId, false else
00222 { return id == groupId; };

bool ScribeGroup::operator== ( const ScribeGroup a  )  const [inline]

Checks whether two groups have the same ID.

Parameters:
a The group to compare
Returns:
True if the groups have the same ID, false else.
00230 { return a.getGroupId() == groupId; };

bool ScribeGroup::operator< ( const OverlayKey id  )  const [inline]

Checks whether the group has a smaller ID than the given key.

Parameters:
id The key to compare
Returns:
True if the group id is smaller than the key, false else.
00238 { return id < groupId; };

bool ScribeGroup::operator< ( const ScribeGroup a  )  const [inline]

Checks whether the group has a smaller ID than another group.

Parameters:
a the group to compare
Returns:
True if the (local) group id is smaller than the a's groupId, false else.
00246 { return groupId < a.getGroupId(); };


Member Data Documentation

OverlayKey ScribeGroup::groupId [private]

NodeHandle ScribeGroup::rendezvousPoint [private]

NodeHandle ScribeGroup::parent [private]

set<NodeHandle> ScribeGroup::children [private]

bool ScribeGroup::subscription [private]

bool ScribeGroup::amISource [private]

ScribeTimer* ScribeGroup::parentTimer [private]

ScribeTimer* ScribeGroup::heartbeatTimer [private]


The documentation for this class was generated from the following files:
Generated on Thu Apr 17 13:19:30 2008 for ITM OverSim by  doxygen 1.5.3