diff --git a/fpga/include/villas/directed_graph.hpp b/fpga/include/villas/directed_graph.hpp index d7752a9f0..ca0f763a9 100644 --- a/fpga/include/villas/directed_graph.hpp +++ b/fpga/include/villas/directed_graph.hpp @@ -15,8 +15,6 @@ namespace villas { namespace graph { // use vector indices as identifiers -using VertexIdentifier = std::size_t; -using EdgeIdentifier = std::size_t; // forward declarations class Edge; @@ -28,13 +26,16 @@ class Vertex { friend class DirectedGraph; public: + using Identifier = std::size_t; + bool operator==(const Vertex& other) { return this->id == other.id; } private: - VertexIdentifier id; - std::list edges; + Identifier id; + // HACK: how to resolve this circular type dependency? + std::list edges; }; @@ -43,14 +44,16 @@ class Edge { friend class DirectedGraph; public: + using Identifier = std::size_t; + bool operator==(const Edge& other) { return this->id == other.id; } private: - EdgeIdentifier id; - VertexIdentifier from; - VertexIdentifier to; + Identifier id; + Vertex::Identifier from; + Vertex::Identifier to; }; @@ -58,6 +61,9 @@ template class DirectedGraph { public: + using VertexIdentifier = Vertex::Identifier; + using EdgeIdentifier = Edge::Identifier; + DirectedGraph(const std::string& name = "DirectedGraph") : lastVertexId(0), lastEdgeId(0) {