1 #ifndef GRAPH_ANALYSIS_GRAPH_ELEMENT_HPP 2 #define GRAPH_ANALYSIS_GRAPH_ELEMENT_HPP 7 #include <boost/uuid/uuid.hpp> 8 #include <boost/uuid/uuid_io.hpp> 9 #include <boost/uuid/uuid_generators.hpp> 46 typedef shared_ptr< GraphElement >
Ptr;
53 virtual void setLabel(
const std::string& label) { mLabel = label; }
58 virtual const std::string&
getLabel()
const {
return mLabel; }
62 virtual std::string
getClassName()
const {
return "graph_analysis::GraphElement"; }
68 virtual std::string
toString(uint32_t indent)
const {
return std::string(indent,
' ') + getClassName(); }
79 bool associated(GraphId graph)
const {
return mGraphElementMap.count(graph); }
85 void associate(GraphId graph, GraphElementId elementId) { mGraphElementMap[graph] = elementId; }
90 void disassociate(GraphId graph) { mGraphElementMap.erase(graph); }
95 GraphElementId getId(GraphId graph)
const;
101 GraphElementUuid
getUid()
const {
return mUuid; }
107 GraphElementUuid
getUuid()
const {
return mUuid; }
118 GraphIdList getGraphAssociations()
const;
123 std::string toPrefixedString(GraphId graph)
const;
138 void setUuid(
const GraphElementUuid& uuid) { mUuid = uuid; }
140 void setUuid(
const std::string& uuid);
151 #endif // GRAPH_ANALYSIS_GRAPH_ELEMENT_HPP GraphElement is the base class for all element in a graph, i.e. for edges and vertices.
Definition: GraphElement.hpp:34
uint32_t GraphElementId
Definition: GraphElement.hpp:21
GraphElementUuid getUuid() const
Definition: GraphElement.hpp:107
std::string mLabel
Definition: GraphElement.hpp:147
GraphElementUuid getUid() const
Definition: GraphElement.hpp:101
GraphElementUuid mUuid
Definition: GraphElement.hpp:144
void disassociate(GraphId graph)
Definition: GraphElement.hpp:90
static std::map< GraphElementUuid, function< GraphElement::Ptr()> > msGraphElements
Definition: GraphElement.hpp:146
std::vector< Ptr > PtrList
Definition: GraphElement.hpp:48
weak_ptr< GraphElement > WeakPtr
Definition: GraphElement.hpp:47
Interface for Reader implementation that perform custom graph deserialization.
Definition: GraphIO.hpp:56
void disassociateFromAll()
Definition: GraphElement.hpp:132
std::vector< GraphId > GraphIdList
Definition: GraphElement.hpp:24
GraphElementMap mGraphElementMap
Definition: GraphElement.hpp:142
static boost::uuids::random_generator msUuidGenerator
Definition: GraphElement.hpp:145
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
shared_ptr< GraphElement > Ptr
Definition: GraphElement.hpp:46
virtual void setLabel(const std::string &label)
Definition: GraphElement.hpp:53
virtual std::string toString(uint32_t indent) const
Definition: GraphElement.hpp:68
GraphElement::Ptr getSharedFromThis()
Definition: GraphElement.hpp:130
void setUuid(const GraphElement::Ptr &element, const std::string &uuid) const
Definition: GraphIO.hpp:70
void associate(GraphId graph, GraphElementId elementId)
Definition: GraphElement.hpp:85
virtual const std::string & getLabel() const
Definition: GraphElement.hpp:58
virtual std::string getClassName() const
Definition: GraphElement.hpp:62
std::map< GraphId, GraphElementId > GraphElementMap
Definition: GraphElement.hpp:23
boost::uuids::uuid GraphElementUuid
Definition: GraphElement.hpp:20
void setUuid(const GraphElementUuid &uuid)
Definition: GraphElement.hpp:138
bool associated(GraphId graph) const
Definition: GraphElement.hpp:79
virtual std::string toString() const
Definition: GraphElement.hpp:73
uint32_t GraphId
Definition: GraphElement.hpp:22