#include <ScribeGroup.h>
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< NodeHandle > | children |
bool | subscription |
bool | amISource |
ScribeTimer * | parentTimer |
ScribeTimer * | heartbeatTimer |
ScribeGroup::ScribeGroup | ( | OverlayKey | id | ) |
Creates a new ScribeGroup.
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 | ( | ) |
pair< set< NodeHandle >::iterator, bool > ScribeGroup::addChild | ( | const NodeHandle & | node | ) |
Adds a new child to the multicast tree.
node | The nodeHandle of the child |
00050 { 00051 return children.insert(node); 00052 }
void ScribeGroup::removeChild | ( | const NodeHandle & | node | ) |
Removes a child from the multicast tree.
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.
00061 { 00062 return children.begin(); 00063 }
set< NodeHandle >::iterator ScribeGroup::getChildrenEnd | ( | ) |
Returns an iterator to the end of the children list.
00066 { 00067 return children.end(); 00068 }
int ScribeGroup::numChildren | ( | ) | const [inline] |
bool ScribeGroup::isForwarder | ( | ) | const |
Return whether the node is forwarder for a group.
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
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
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.
00132 { return subscription; }
void ScribeGroup::setSubscription | ( | bool | subscribe | ) | [inline] |
Set the subscription status.
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.
00146 { return parent; }
void ScribeGroup::setParent | ( | NodeHandle & | _parent | ) | [inline] |
Sets a new parent for the multicast tree.
_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.
00160 { return rendezvousPoint; }
void ScribeGroup::setRendezvousPoint | ( | const NodeHandle & | _rendezvousPoint | ) | [inline] |
Sets the rendevouzPoint (root) of the multicast tree for the group.
_rendezvousPoint | The root of the tree |
00167 { rendezvousPoint = _rendezvousPoint; }
OverlayKey ScribeGroup::getGroupId | ( | ) | const [inline] |
ScribeTimer* ScribeGroup::getParentTimer | ( | ) | [inline] |
Returns the parent timer.
The parent timer is supposed to expire if the parent fails to send heartbeat messages.
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.
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.
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.
t | The heartbeatTimer |
00214 { heartbeatTimer = t; }
bool ScribeGroup::operator== | ( | const OverlayKey & | id | ) | const [inline] |
Checks whether the group has a certain groupId.
id | The groupId to check |
00222 { return id == groupId; };
bool ScribeGroup::operator== | ( | const ScribeGroup & | a | ) | const [inline] |
Checks whether two groups have the same ID.
a | The group to compare |
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.
id | The key to compare |
00238 { return id < groupId; };
bool ScribeGroup::operator< | ( | const ScribeGroup & | a | ) | const [inline] |
Checks whether the group has a smaller ID than another group.
a | the group to compare |
00246 { return groupId < a.getGroupId(); };
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] |