graph_analysis
EdgeRegistration.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_EDGE_REGISTRATION_HPP
2 #define GRAPH_ANALYSIS_EDGE_REGISTRATION_HPP
3 
4 #include "EdgeTypeManager.hpp"
5 
6 namespace graph_analysis {
7 
8 template<typename T>
10 {
11  bool mIsRegistered;
12 
13 public:
15  : mIsRegistered(false)
16  {
17  using namespace graph_analysis;
18  EdgeTypeManager* eManager = EdgeTypeManager::getInstance();
19  Edge::Ptr edge(new T());
20  eManager->registerType(edge->getClassName(), edge, true);
21  edge->registerAttributes(eManager);
22  mIsRegistered = true;
23  }
24 
25  bool isRegistered() const { return mIsRegistered; }
26 };
27 
28 } // end namespace graph_analysis
29 #endif // GRAPH_ANALYSIS_EDGE_REGISTRATION_HPP
Factory for Edge subclasses.
Definition: EdgeTypeManager.hpp:29
void registerType(const Edge::Ptr &edge, bool throwOnAlreadyRegistered=false)
Definition: EdgeTypeManager.cpp:14
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
Definition: EdgeRegistration.hpp:9
EdgeRegistration()
Definition: EdgeRegistration.hpp:14
bool isRegistered() const
Definition: EdgeRegistration.hpp:25