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
45 struct CounterReset;
46
47 namespace 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
141 virtual void setToBeDeleted(bool status);
142
146 virtual bool isToBeDeleted() const;
147
153 virtual uint64_t getVertexID() const;
154
160 virtual void setVertexID(uint64_t newID);
161
170 static uint64_t getVertexIDCounter();
171
172 protected:
177 TPGVertex() : vertexID(incrementeCounter()){};
178
180 bool toBeDeleted = false;
181
185 std::list<TPG::TPGEdge*> incomingEdges;
186
190 std::list<TPG::TPGEdge*> outgoingEdges;
191
195 std::set<uint64_t> assessedActions;
196
200 uint64_t vertexID;
201
205 static uint64_t incrementeCounter();
206
213 static void resetVertexIDCounter();
214 friend struct ::CounterReset;
215 };
216
221 bool operator<(const TPGVertex& a, const TPGVertex& b);
222
223}; // namespace TPG
224
225#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::isToBeDeleted
virtual bool isToBeDeleted() const
Definition tpgVertex.cpp:150
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::setToBeDeleted
virtual void setToBeDeleted(bool status)
Definition tpgVertex.cpp:145
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:195
TPG::TPGVertex::outgoingEdges
std::list< TPG::TPGEdge * > outgoingEdges
Set of outgoing TPGEdge of the TPGVertex.
Definition tpgVertex.h:190
TPG::TPGVertex::incomingEdges
std::list< TPG::TPGEdge * > incomingEdges
Set of incoming TPGEdge of the TPGVertex.
Definition tpgVertex.h:185
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:177
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:160
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::toBeDeleted
bool toBeDeleted
True if the vertex should be deleted during evolution process.
Definition tpgVertex.h:180
TPG::TPGVertex::vertexID
uint64_t vertexID
Unique identifier of the TPGVertex.
Definition tpgVertex.h:200
TPG::TPGVertex::getVertexID
virtual uint64_t getVertexID() const
Get the unique identifier of the TPGVertex.
Definition tpgVertex.cpp:155
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