GEGELATI
Loading...
Searching...
No Matches
tpgEdge.h
1
37#ifndef TPG_EDGE_H
38#define TPG_EDGE_H
39
40#include <memory>
41
42#include "program/program.h"
43
44struct CounterReset;
45
46namespace TPG {
47 // Declare class to make it usable as an attribute.
48 class TPGVertex;
49
53 class TPGEdge
54 {
55 public:
57 virtual ~TPGEdge() = default;
58
70 TPGEdge(const TPGVertex* src, const TPGVertex* dest,
71 const std::shared_ptr<Program::Program> prog)
73 program{prog} {};
74
81
92 void setProgram(const std::shared_ptr<Program::Program> prog) const;
93
102 std::shared_ptr<Program::Program> getProgramSharedPointer();
103
109 const TPGVertex* getSource() const;
110
116 void setSource(TPGVertex* newSource);
117
123 virtual const TPGVertex* getDestination() const;
124
131 virtual void setDestination(TPGVertex* newDestination);
132
138 virtual uint64_t getEdgeID() const;
139
145 virtual void setEdgeID(uint64_t newID);
146
155 static uint64_t getEdgeIDCounter();
156
157 protected:
160
163
168 mutable std::shared_ptr<Program::Program> program;
169
173 uint64_t edgeID;
174
178 static uint64_t incrementeCounter();
179
186 static void resetEdgeIDCounter();
187 friend struct ::CounterReset;
188
190 TPGEdge() = delete;
191 };
192
197 bool operator<(const TPGEdge& a, const TPGEdge& b);
198
199}; // namespace TPG
200
201#endif
The Program class contains a list of program lines that can be executed within a well defined Environ...
Definition program.h:57
Class representing edges of the Tangled Program Graphs.
Definition tpgEdge.h:54
std::shared_ptr< Program::Program > program
Definition tpgEdge.h:168
TPGEdge()=delete
Delete the default constructor.
virtual ~TPGEdge()=default
Default virtual destructor (for polymorphism)
const TPGVertex * source
Pointer to the source TPGVertex of this TPGEdge.
Definition tpgEdge.h:159
virtual const TPGVertex * getDestination() const
Get the destination TPGVertex of the TPGEdge.
Definition tpgEdge.cpp:94
virtual void setDestination(TPGVertex *newDestination)
Set a new destination TPGVertex to the TPGEdge.
Definition tpgEdge.cpp:99
static void resetEdgeIDCounter()
Reset the edge ID counter.
Definition tpgEdge.cpp:53
const TPGVertex * getSource() const
Get the source TPGVertex of the TPGEdge.
Definition tpgEdge.cpp:84
const TPGVertex * destination
Pointer to the destination TPGVertex of this TPGEdge.
Definition tpgEdge.h:162
Program::Program & getProgram() const
Get a const reference to the Program of the TPGEdge.
Definition tpgEdge.cpp:68
virtual uint64_t getEdgeID() const
Get the unique identifier of the TPGEdge.
Definition tpgEdge.cpp:104
static uint64_t incrementeCounter()
Incremente the edge ID counter and return the new value.
Definition tpgEdge.cpp:43
void setSource(TPGVertex *newSource)
Set a new source TPGVertex to the TPGEdge.
Definition tpgEdge.cpp:89
std::shared_ptr< Program::Program > getProgramSharedPointer()
Get the shared_pointer to the Program.
Definition tpgEdge.cpp:79
virtual void setEdgeID(uint64_t newID)
Set a new unique identifier to the TPGEdge.
Definition tpgEdge.cpp:58
static uint64_t getEdgeIDCounter()
Get the current value of the edge ID counter.
Definition tpgEdge.cpp:48
TPGEdge(const TPGVertex *src, const TPGVertex *dest, const std::shared_ptr< Program::Program > prog)
Main constructor of the TPGEdge class.
Definition tpgEdge.h:70
uint64_t edgeID
Unique identifier of the TPGEdge.
Definition tpgEdge.h:173
void setProgram(const std::shared_ptr< Program::Program > prog) const
Set a new Program for the TPGEdge.
Definition tpgEdge.cpp:73
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
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