FREEDM DGI
CGlobalPeerList.hpp
Go to the documentation of this file.
1 
23 #ifndef CGLOBALPEERLIST_HPP
24 #define CGLOBALPEERLIST_HPP
25 
26 #include <map>
27 #include <string>
28 
29 #include <boost/noncopyable.hpp>
30 
31 namespace freedm {
32 
33 namespace broker {
34 
35 // We have to forward declare GMAgent (and its namespace!) to make it a friend.
36 namespace gm {
37 
38 class GMAgent;
39 
40 }
41 
42 class CPeerNode;
43 
45  : private boost::noncopyable
46 {
47  public:
50  typedef std::map<std::string, CPeerNode> PeerSet;
52  typedef PeerSet::iterator PeerSetIterator;
55  {
56  static CGlobalPeerList inst;
57  return inst;
58  }
60  CPeerNode GetPeer(const std::string& uuid);
62  int Count(const std::string& uuid);
64  PeerSetIterator Find(const std::string& uuid);
66  PeerSetIterator begin();
68  PeerSetIterator end();
70  PeerSet& PeerList();
72  CPeerNode Create(std::string uuid);
74  void Insert(CPeerNode p);
75  private:
77  PeerSet m_peerlist;
78 
79 };
80 
81 }
82 
83 }
84 
85 #endif
PeerSet m_peerlist
The set of peers to present.
Definition: CGlobalPeerList.hpp:77
ModuleMessage PeerList(std::string requester="all")
Generates a peer list.
Definition: GroupManagement.cpp:300
Base interface for agents/broker modules.
Definition: CPeerNode.hpp:37
static CGlobalPeerList & instance()
Provides the global instance.
Definition: CGlobalPeerList.hpp:54
Declaration of Garcia-Molina Invitation Leader Election algorithm.
Definition: GroupManagement.hpp:45
PeerSet::iterator PeerSetIterator
Provides and Iterator.
Definition: CGlobalPeerList.hpp:52
CPeerNode GetPeer(const std::string &uuid)
Gets a pointer to a peer from UUID.
Definition: GroupManagement.cpp:1294
Definition: CGlobalPeerList.hpp:44
General FREEDM Namespace.
Definition: CBroker.cpp:53
std::map< std::string, CPeerNode > PeerSet
The peerset type.
Definition: CGlobalPeerList.hpp:50