FREEDM DGI
CPhysicalTopology.hpp
Go to the documentation of this file.
1 
23 #ifndef FREEDM_PHYSICAL_TOPOLOGY_HPP
24 #define FREEDM_PHYSICAL_TOPOLOGY_HPP
25 
26 #include <boost/noncopyable.hpp>
27 #include <set>
28 #include <map>
29 #include <string>
30 
31 namespace freedm {
32  namespace broker {
33 
43 class CPhysicalTopology : private boost::noncopyable
44 {
45 public:
46  typedef std::pair< std::string, std::string > VertexPair;
47  typedef std::set<std::string> VertexSet;
48  typedef std::map<std::string, VertexSet > AdjacencyListMap;
49  typedef std::multimap<VertexPair, std::string> FIDControlMap;
50  typedef std::map<std::string, bool> FIDState;
51 
53  static CPhysicalTopology& Instance();
54 
56  VertexSet ReachablePeers(std::string source, FIDState fidstate);
57 
59  bool IsAvailable();
60 
61 private:
64 
66  void LoadTopology();
67 
69  std::string RealNameFromVirtual(std::string vname);
70 
71  AdjacencyListMap m_adjlist;
72  FIDControlMap m_fidcontrol;
73  bool m_available;
74  std::map<std::string, std::string> m_strans;
75 };
76 
77  } // namespace broker
78 } // namespace freedm
79 
80 #endif // FREEDM_PHYSICAL_TOPOLOGY_HPP
81 
std::string RealNameFromVirtual(std::string vname)
Gets the realname from the virtual name.
Definition: CPhysicalTopology.cpp:336
void LoadTopology()
Load the topology from a file.
Definition: CPhysicalTopology.cpp:182
std::map< std::string, std::string > m_strans
If a physical topology has been loaded.
Definition: CPhysicalTopology.hpp:74
CPhysicalTopology()
Private constructor for the singleton instance.
Definition: CPhysicalTopology.cpp:61
std::map< std::string, VertexSet > AdjacencyListMap
Definition: CPhysicalTopology.hpp:48
AdjacencyListMap m_adjlist
Definition: CPhysicalTopology.hpp:71
std::multimap< VertexPair, std::string > FIDControlMap
Definition: CPhysicalTopology.hpp:49
VertexSet ReachablePeers(std::string source, FIDState fidstate)
Find the reachable peers.
Definition: CPhysicalTopology.cpp:92
bool IsAvailable()
Returns if the physical topology is available.
Definition: CPhysicalTopology.cpp:75
FIDControlMap m_fidcontrol
Structure of physical layer.
Definition: CPhysicalTopology.hpp:72
std::map< std::string, bool > FIDState
Definition: CPhysicalTopology.hpp:50
bool m_available
Which edges FIDs control.
Definition: CPhysicalTopology.hpp:73
General FREEDM Namespace.
Definition: CBroker.cpp:53
Provides the Physical Topology Architecture.
Definition: CPhysicalTopology.hpp:43
static CPhysicalTopology & Instance()
Get the singleton instance of this class.
Definition: CPhysicalTopology.cpp:49
std::pair< std::string, std::string > VertexPair
Definition: CPhysicalTopology.hpp:46
std::set< std::string > VertexSet
Definition: CPhysicalTopology.hpp:47