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