ScribeGroup Class Reference

Capsulates the informations of a scribe multicast group. More...

#include <ScribeGroup.h>

List of all members.

Public Member Functions

 ScribeGroup (OverlayKey id)
 Creates a new ScribeGroup.
 ~ScribeGroup ()
std::pair< std::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.
std::set< NodeHandle >::iterator getChildrenBegin ()
 Returns an iterator to the begin of the children list.
std::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
std::set< NodeHandlechildren
bool subscription
bool amISource
ScribeTimer * parentTimer
ScribeTimer * heartbeatTimer

Detailed Description

Capsulates the informations of a scribe multicast group.

Definition at line 40 of file ScribeGroup.h.


Constructor & Destructor Documentation

ScribeGroup::ScribeGroup ( OverlayKey  id  ) 

Creates a new ScribeGroup.

Parameters:
id The group ID of the new group

Definition at line 29 of file ScribeGroup.cc.

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 (  ) 

Definition at line 39 of file ScribeGroup.cc.

00040 {
00041     children.clear();
00042 }


Member Function Documentation

std::pair< std::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)

Definition at line 49 of file ScribeGroup.cc.

Referenced by Scribe::addChildToGroup().

00050 {
00051     return children.insert(node);
00052 }

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

Definition at line 114 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

00114 { return amISource; }

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

Returns an iterator to the begin of the children list.

Returns:
the iterator

Definition at line 60 of file ScribeGroup.cc.

00061 {
00062     return children.begin();
00063 }

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

Returns an iterator to the end of the children list.

Returns:
the iterator

Definition at line 65 of file ScribeGroup.cc.

00066 {
00067     return children.end();
00068 }

OverlayKey ScribeGroup::getGroupId (  )  const [inline]

Returns the groupId of the group.

Returns:
The group ID

Definition at line 174 of file ScribeGroup.h.

Referenced by Scribe::addChildToGroup(), Scribe::checkGroupEmpty(), operator<(), and operator==().

00174 { return groupId; }

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

Definition at line 204 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

00204 { return heartbeatTimer; }

NodeHandle ScribeGroup::getParent (  )  const [inline]

Return the parent in the multicast tree.

Returns:
The parent. thisNode if the node is root of the tree

Definition at line 146 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

00146 { return parent; }

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

Definition at line 184 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

00184 { return parentTimer; }

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

Definition at line 160 of file ScribeGroup.h.

00160 { return rendezvousPoint; }

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

Definition at line 132 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

00132 { return subscription; }

bool ScribeGroup::isForwarder (  )  const

Return whether the node is forwarder for a group.

Returns:
True if there are any children, false else.

Definition at line 44 of file ScribeGroup.cc.

Referenced by Scribe::checkGroupEmpty().

00045 {
00046     return !children.empty();
00047 }

int ScribeGroup::numChildren (  )  const [inline]

Get the number of children.

Returns:
The number of children

Definition at line 96 of file ScribeGroup.h.

00096 { return children.size(); }

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.

Definition at line 246 of file ScribeGroup.h.

00246 { return groupId < a.getGroupId(); };

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.

Definition at line 238 of file ScribeGroup.h.

00238 { 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.

Definition at line 230 of file ScribeGroup.h.

00230 { return a.getGroupId() == groupId; };

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

Definition at line 222 of file ScribeGroup.h.

00222 { return id == groupId; };

void ScribeGroup::removeChild ( const NodeHandle node  ) 

Removes a child from the multicast tree.

Parameters:
node The nodeHandle of the child

Definition at line 54 of file ScribeGroup.cc.

Referenced by Scribe::removeChildFromGroup().

00055 {
00056     children.erase(node);
00057 }

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

Definition at line 125 of file ScribeGroup.h.

00125 { amISource = source; }

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

Definition at line 214 of file ScribeGroup.h.

00214 { heartbeatTimer = t; }

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

Definition at line 153 of file ScribeGroup.h.

00153 { parent = _parent; }

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

Definition at line 194 of file ScribeGroup.h.

00194 { parentTimer = t; }

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

Definition at line 167 of file ScribeGroup.h.

00167 { rendezvousPoint = _rendezvousPoint; }

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

Definition at line 139 of file ScribeGroup.h.

00139 { subscription = subscribe; }


Member Data Documentation

bool ScribeGroup::amISource [private]

Definition at line 48 of file ScribeGroup.h.

Referenced by getAmISource(), ScribeGroup(), and setAmISource().

std::set<NodeHandle> ScribeGroup::children [private]

Definition at line 43 of file ScribeGroup.h.

Referenced by getGroupId(), operator<(), and operator==().

ScribeTimer* ScribeGroup::heartbeatTimer [private]

Definition at line 51 of file ScribeGroup.h.

Referenced by getHeartbeatTimer(), ScribeGroup(), and setHeartbeatTimer().

Definition at line 45 of file ScribeGroup.h.

Referenced by getParent(), ScribeGroup(), and setParent().

ScribeTimer* ScribeGroup::parentTimer [private]

Definition at line 50 of file ScribeGroup.h.

Referenced by getParentTimer(), ScribeGroup(), and setParentTimer().

Definition at line 44 of file ScribeGroup.h.

Referenced by getRendezvousPoint(), ScribeGroup(), and setRendezvousPoint().

bool ScribeGroup::subscription [private]

Definition at line 47 of file ScribeGroup.h.

Referenced by getSubscription(), ScribeGroup(), and setSubscription().


The documentation for this class was generated from the following files:
Generated on Wed May 26 16:21:19 2010 for OverSim by  doxygen 1.6.3