GEGELATI

Loading...
Searching...
No Matches
tpgVertex.h
1
37#ifndef TPG_VERTEX_H
38#define TPG_VERTEX_H
39
40#include <cinttypes>
41#include <iostream>
42#include <list>
43#include <set>
44
45struct CounterReset;
46
47namespace TPG {
48 // Declare class to make it usable as an attribute.
49 class TPGEdge;
50
54 class TPGVertex
55 {
56 public:
58 virtual ~TPGVertex() = default;
59
63 const std::list<TPGEdge*>& getIncomingEdges() const;
64
68 const std::list<TPGEdge*>& getOutgoingEdges() const;
69
81 virtual void addIncomingEdge(TPG::TPGEdge* edge);
82
92 virtual void removeIncomingEdge(TPG::TPGEdge* edge);
93
105 virtual void addOutgoingEdge(TPG::TPGEdge* edge);
106
116 virtual void removeOutgoingEdge(TPG::TPGEdge* edge);
117
121 virtual const std::set<uint64_t>& getAssessedActions() const;
122
126 virtual void updateAssessedActions();
127
133 virtual bool hasSameAssessedActions(std::set<uint64_t> actions) const;
134
140 virtual uint64_t getVertexID() const;
141
147 virtual void setVertexID(uint64_t newID);
148
157 static uint64_t getVertexIDCounter();
158
159 protected:
164 TPGVertex() : vertexID(incrementeCounter()){};
165
169 std::list<TPG::TPGEdge*> incomingEdges;
170
174 std::list<TPG::TPGEdge*> outgoingEdges;
175
179 std::set<uint64_t> assessedActions;
180
184 uint64_t vertexID;
185
189 static uint64_t incrementeCounter();
190
197 static void resetVertexIDCounter();
198 friend struct ::CounterReset;
199 };
200
205 bool operator<(const TPGVertex& a, const TPGVertex& b);
206
207}; // namespace TPG
208
209#endif
TPG::TPGEdge
Class representing edges of the Tangled Program Graphs.
Definition tpgEdge.h:54
TPG::TPGVertex
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
TPG::TPGVertex::getVertexIDCounter
static uint64_t getVertexIDCounter()
Get the current value of the vertex ID counter.
Definition tpgVertex.cpp:52
TPG::TPGVertex::hasSameAssessedActions
virtual bool hasSameAssessedActions(std::set< uint64_t > actions) const
compare the set given and the assessed actions of the vertex
Definition tpgVertex.cpp:130
TPG::TPGVertex::resetVertexIDCounter
static void resetVertexIDCounter()
Reset the vertex ID counter.
Definition tpgVertex.cpp:57
TPG::TPGVertex::addIncomingEdge
virtual void addIncomingEdge(TPG::TPGEdge *edge)
Method to add an incoming TPGEdge to the TPGVertex.
Definition tpgVertex.cpp:72
TPG::TPGVertex::updateAssessedActions
virtual void updateAssessedActions()
Update the assessed actions.
Definition tpgVertex.cpp:112
TPG::TPGVertex::incrementeCounter
static uint64_t incrementeCounter()
Incremente the vertex ID counter and return the new value.
Definition tpgVertex.cpp:47
TPG::TPGVertex::getIncomingEdges
const std::list< TPGEdge * > & getIncomingEdges() const
Get a const reference to incoming edges of this TPGVertex.
Definition tpgVertex.cpp:62
TPG::TPGVertex::assessedActions
std::set< uint64_t > assessedActions
Set of assessed actions by the team.
Definition tpgVertex.h:179
TPG::TPGVertex::outgoingEdges
std::list< TPG::TPGEdge * > outgoingEdges
Set of outgoing TPGEdge of the TPGVertex.
Definition tpgVertex.h:174
TPG::TPGVertex::incomingEdges
std::list< TPG::TPGEdge * > incomingEdges
Set of incoming TPGEdge of the TPGVertex.
Definition tpgVertex.h:169
TPG::TPGVertex::getOutgoingEdges
const std::list< TPGEdge * > & getOutgoingEdges() const
Get a const reference to outgoing edges of this TPGVertex.
Definition tpgVertex.cpp:67
TPG::TPGVertex::removeOutgoingEdge
virtual void removeOutgoingEdge(TPG::TPGEdge *edge)
Removes the given outgoing edge from the TPGVertex.
Definition tpgVertex.cpp:102
TPG::TPGVertex::TPGVertex
TPGVertex()
Protected default constructor to forbid the instanciation of object of this abstract class.
Definition tpgVertex.h:164
TPG::TPGVertex::~TPGVertex
virtual ~TPGVertex()=default
Default polymorphic destructor.
TPG::TPGVertex::setVertexID
virtual void setVertexID(uint64_t newID)
Set a new unique identifier to the TPGVertex.
Definition tpgVertex.cpp:150
TPG::TPGVertex::addOutgoingEdge
virtual void addOutgoingEdge(TPG::TPGEdge *edge)
Method to add an outgoing TPGEdge to the TPGVertex.
Definition tpgVertex.cpp:91
TPG::TPGVertex::getAssessedActions
virtual const std::set< uint64_t > & getAssessedActions() const
return assessed actions
Definition tpgVertex.cpp:107
TPG::TPGVertex::removeIncomingEdge
virtual void removeIncomingEdge(TPG::TPGEdge *edge)
Removes the given incoming edge from the TPGVertex.
Definition tpgVertex.cpp:84
TPG::TPGVertex::vertexID
uint64_t vertexID
Unique identifier of the TPGVertex.
Definition tpgVertex.h:184
TPG::TPGVertex::getVertexID
virtual uint64_t getVertexID() const
Get the unique identifier of the TPGVertex.
Definition tpgVertex.cpp:145
TPG
Definition executionStats.h:44
TPG::operator<
bool operator<(const TPGEdge &a, const TPGEdge &b)
Comparison function to enable sorting of TPGVertex with STL.
Definition tpgEdge.cpp:109
CounterReset
Struct to reset static counters in classes.
Definition counterReset.h:14