OverSim
ScribeGroup.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
25 #ifndef __SCRIBEGROUP_H_
26 #define __SCRIBEGROUP_H_
27 
28 #include <set>
29 #include "OverlayKey.h"
30 #include "NodeHandle.h"
31 
32 class ScribeGroup;
33 
34 #include "ScribeMessage_m.h"
35 
41 {
42  private:
46  std::set<NodeHandle> children;
48  bool amISource;
49 
52 
53  public:
59  ScribeGroup( OverlayKey id );
60  ~ScribeGroup( );
61 
68  std::pair<std::set<NodeHandle>::iterator, bool> addChild( const NodeHandle& node );
69 
75  void removeChild( const NodeHandle& node );
76 
82  std::set<NodeHandle>::iterator getChildrenBegin();
83 
89  std::set<NodeHandle>::iterator getChildrenEnd();
90 
96  int numChildren() const { return children.size(); }
97 
103  bool isForwarder() const;
104 
114  bool getAmISource() const { return amISource; }
115 
125  void setAmISource( bool source ) { amISource = source; }
126 
132  bool getSubscription() const { return subscription; }
133 
139  void setSubscription( bool subscribe ) { subscription = subscribe; }
140 
146  NodeHandle getParent() const { return parent; }
147 
153  void setParent( NodeHandle& _parent ) { parent = _parent; }
154 
161 
167  void setRendezvousPoint( const NodeHandle& _rendezvousPoint ) { rendezvousPoint = _rendezvousPoint; }
168 
174  OverlayKey getGroupId() const { return groupId; }
175 
185 
195 
205 
215 
222  bool operator== (const OverlayKey& id) const { return id == groupId; };
223 
230  bool operator== (const ScribeGroup& a) const { return a.getGroupId() == groupId; };
231 
238  bool operator< (const OverlayKey& id) const { return id < groupId; };
239 
246  bool operator< (const ScribeGroup& a) const { return groupId < a.getGroupId(); };
247 };
248 
249 #endif