1 #ifndef GRAPH_ANALYSIS_VERTEX_TYPE_MANAGER_HPP 2 #define GRAPH_ANALYSIS_VERTEX_TYPE_MANAGER_HPP 8 #include <base-logging/Singleton.hpp> 32 typedef std::map<vertex::Type, Vertex::Ptr>
TypeMap;
39 std::set<std::string> mRegisteredTypes;
41 std::map<std::string, std::set<std::string> > mTypeHierarchy;
43 std::string mDefaultVertexType;
62 void setDefaultType(
const std::string& type);
69 template<
typename T,
typename P = graph_analysis::Vertex>
74 if( std::is_base_of<P,T>::value )
76 if(!std::is_same<graph_analysis::Vertex, P>::value)
78 parents.push_back( make_shared<P>() );
82 std::invalid_argument(
"graph_analysis::VertexTypeManager::registerType:" 83 " invalid registration since '" + std::string(
typeid(T).name()) +
"' " 84 "is not derived from '" + std::string(
typeid(P).name()) +
"'");
86 registerType(vertex, parents, throwOnAlreadyRegistered );
87 vertex->registerAttributes(
this);
99 bool throwOnAlreadyRegistered =
false);
112 bool throwOnAlreadyRegistered =
false);
123 bool throwOnMissing =
false);
129 std::set<std::string> getSupportedTypes()
const;
137 std::vector<std::string> getTypeHierarchy(
const vertex::Type& type)
const;
146 std::vector<Attribute> getKnownAttributes(
const std::set<std::string>& classnames = std::set<std::string>())
const;
155 std::vector<Attribute> getAttributes(
const vertex::Type& classname,
156 bool includeLegacySupport =
false)
const;
162 std::vector< std::pair<Attribute::Id, std::string> >
163 getAttributeValues(
const Vertex::Ptr& vertex)
const;
const std::string & getDefaultType() const
Definition: VertexTypeManager.hpp:67
std::map< vertex::Type, Vertex::Ptr > TypeMap
Definition: VertexTypeManager.hpp:32
Manage object (vertex/edge) attributes and allow them to be serialized, e.g., using GEXF or GraphML...
Definition: AttributeManager.hpp:13
std::vector< Ptr > PtrList
Definition: Vertex.hpp:24
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
void registerType(bool throwOnAlreadyRegistered=false)
Definition: VertexTypeManager.hpp:70
Factory for Vertex subclasses.
Definition: VertexTypeManager.hpp:29
std::string Type
Definition: VertexTypeManager.hpp:17