1 #ifndef GRAPH_ANALYSIS_EDGE_TYPE_MANAGER_HPP 2 #define GRAPH_ANALYSIS_EDGE_TYPE_MANAGER_HPP 8 #include <base-logging/Singleton.hpp> 33 typedef std::map<edge::Type, Edge::Ptr>
TypeMap;
39 std::set<std::string> mRegisteredTypes;
41 std::map<std::string, std::set<std::string> > mTypeHierarchy;
43 std::string mDefaultType;
45 typedef std::map<std::string, io::AttributeSerializationCallbacks> AttributeSerializationCallbackMap;
46 std::map<std::string, AttributeSerializationCallbackMap > mRegisteredCallbacks;
62 template<
typename T,
typename P = graph_analysis::Edge>
67 if( std::is_base_of<P,T>::value )
69 if(!std::is_same<graph_analysis::Edge, P>::value)
71 parents.push_back( make_shared<P>() );
75 std::invalid_argument(
"graph_analysis::EdgeTypeManager::registerType:" 76 " invalid registration since '" + std::string(
typeid(T).name()) +
"' " 77 "is not derived from '" + std::string(
typeid(P).name()) +
"'");
79 registerType(edge, parents, throwOnAlreadyRegistered );
80 edge->registerAttributes(
this);
92 bool throwOnAlreadyRegistered =
false);
105 bool throwOnAlreadyRegistered =
false);
110 void setDefaultType(
const std::string& type);
125 const std::string& label =
"",
126 bool throwOnMissing =
false);
131 const std::string& label =
"",
132 bool throwOnMissing =
false);
134 std::set<std::string> getSupportedTypes()
const;
142 std::vector<std::string> getTypeHierarchy(
const edge::Type& type)
const;
144 std::vector<Attribute> getKnownAttributes(
145 const std::set<std::string>& classnames = std::set<std::string>())
const;
152 std::vector<Attribute> getAttributes(
const edge::Type& type,
153 bool includeLegacySupport =
false)
const;
158 std::vector< std::pair<Attribute::Id, std::string> >
159 getAttributeValues(
const Edge::Ptr& edge)
const;
Factory for Edge subclasses.
Definition: EdgeTypeManager.hpp:30
const std::string & getDefaultType() const
Definition: EdgeTypeManager.hpp:115
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
Manage object (vertex/edge) attributes and allow them to be serialized, e.g., using GEXF or GraphML...
Definition: AttributeManager.hpp:13
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
std::string Type
Definition: EdgeTypeManager.hpp:19
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
void registerType(bool throwOnAlreadyRegistered=false)
Definition: EdgeTypeManager.hpp:63
std::vector< Ptr > PtrList
Definition: Edge.hpp:23
std::map< edge::Type, Edge::Ptr > TypeMap
Definition: EdgeTypeManager.hpp:33