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
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:
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
Class representing edges of the Tangled Program Graphs.
Definition tpgEdge.h:54
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
static uint64_t getVertexIDCounter()
Get the current value of the vertex ID counter.
Definition tpgVertex.cpp:52
virtual bool hasSameAssessedActions(std::set< uint64_t > actions) const
compare the set given and the assessed actions of the vertex
Definition tpgVertex.cpp:130
static void resetVertexIDCounter()
Reset the vertex ID counter.
Definition tpgVertex.cpp:57
virtual void addIncomingEdge(TPG::TPGEdge *edge)
Method to add an incoming TPGEdge to the TPGVertex.
Definition tpgVertex.cpp:72
virtual void updateAssessedActions()
Update the assessed actions.
Definition tpgVertex.cpp:112
static uint64_t incrementeCounter()
Incremente the vertex ID counter and return the new value.
Definition tpgVertex.cpp:47
const std::list< TPGEdge * > & getIncomingEdges() const
Get a const reference to incoming edges of this TPGVertex.
Definition tpgVertex.cpp:62
std::set< uint64_t > assessedActions
Set of assessed actions by the team.
Definition tpgVertex.h:179
std::list< TPG::TPGEdge * > outgoingEdges
Set of outgoing TPGEdge of the TPGVertex.
Definition tpgVertex.h:174
std::list< TPG::TPGEdge * > incomingEdges
Set of incoming TPGEdge of the TPGVertex.
Definition tpgVertex.h:169
const std::list< TPGEdge * > & getOutgoingEdges() const
Get a const reference to outgoing edges of this TPGVertex.
Definition tpgVertex.cpp:67
virtual void removeOutgoingEdge(TPG::TPGEdge *edge)
Removes the given outgoing edge from the TPGVertex.
Definition tpgVertex.cpp:102
TPGVertex()
Protected default constructor to forbid the instanciation of object of this abstract class.
Definition tpgVertex.h:164
virtual ~TPGVertex()=default
Default polymorphic destructor.
virtual void setVertexID(uint64_t newID)
Set a new unique identifier to the TPGVertex.
Definition tpgVertex.cpp:150
virtual void addOutgoingEdge(TPG::TPGEdge *edge)
Method to add an outgoing TPGEdge to the TPGVertex.
Definition tpgVertex.cpp:91
virtual const std::set< uint64_t > & getAssessedActions() const
return assessed actions
Definition tpgVertex.cpp:107
virtual void removeIncomingEdge(TPG::TPGEdge *edge)
Removes the given incoming edge from the TPGVertex.
Definition tpgVertex.cpp:84
uint64_t vertexID
Unique identifier of the TPGVertex.
Definition tpgVertex.h:184
virtual uint64_t getVertexID() const
Get the unique identifier of the TPGVertex.
Definition tpgVertex.cpp:145
Definition executionStats.h:44
bool operator<(const TPGEdge &a, const TPGEdge &b)
Comparison function to enable sorting of TPGVertex with STL.
Definition tpgEdge.cpp:109
Struct to reset static counters in classes.
Definition counterReset.h:14