Go to the documentation of this file. 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()) +
"'");
80 edge->registerAttributes(
this);
92 bool throwOnAlreadyRegistered =
false);
105 bool throwOnAlreadyRegistered =
false);
125 const std::string& label =
"",
126 bool throwOnMissing =
false);
131 const std::string& label =
"",
132 bool throwOnMissing =
false);
145 const std::set<std::string>& classnames = std::set<std::string>())
const;
153 bool includeLegacySupport =
false)
const;
158 std::vector< std::pair<Attribute::Id, std::string> >
std::string Type
Definition: EdgeTypeManager.hpp:19
Manage object (vertex/edge) attributes and allow them to be serialized, e.g., using GEXF or GraphML.
Definition: AttributeManager.hpp:13
std::vector< std::string > getTypeHierarchy(const edge::Type &type) const
Definition: EdgeTypeManager.cpp:111
std::vector< Attribute > getAttributes(const edge::Type &type, bool includeLegacySupport=false) const
Definition: EdgeTypeManager.cpp:133
std::set< std::string > getSupportedTypes() const
lists the registered types
Definition: EdgeTypeManager.cpp:106
Factory for Edge subclasses.
Definition: EdgeTypeManager.hpp:30
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
void registerType(bool throwOnAlreadyRegistered=false)
Definition: EdgeTypeManager.hpp:63
EdgeTypeManager()
constructor
Definition: EdgeTypeManager.cpp:7
std::map< edge::Type, Edge::Ptr > TypeMap
Definition: EdgeTypeManager.hpp:33
std::vector< std::pair< Attribute::Id, std::string > > getAttributeValues(const Edge::Ptr &edge) const
Definition: EdgeTypeManager.cpp:195
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
const std::string & getDefaultType() const
Definition: EdgeTypeManager.hpp:115
void setDefaultType(const std::string &type)
Definition: EdgeTypeManager.cpp:78
std::vector< Attribute > getKnownAttributes(const std::set< std::string > &classnames=std::set< std::string >()) const
Definition: EdgeTypeManager.cpp:173
Edge::Ptr createEdge(const edge::Type &type, const std::string &label="", bool throwOnMissing=false)
clones a new edge of a specified type
Definition: EdgeTypeManager.cpp:88
std::vector< Ptr > PtrList
Definition: Edge.hpp:23