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)
72 : edgeID(incrementeCounter()), source{src}, destination{dest},
73 program{prog} {};
74
80 Program::Program& getProgram() const;
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:
159 const TPGVertex* source;
160
162 const TPGVertex* destination;
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
Program::Program
The Program class contains a list of program lines that can be executed within a well defined Environ...
Definition program.h:57
TPG::TPGEdge
Class representing edges of the Tangled Program Graphs.
Definition tpgEdge.h:54
TPG::TPGEdge::program
std::shared_ptr< Program::Program > program
Definition tpgEdge.h:168
TPG::TPGEdge::TPGEdge
TPGEdge()=delete
Delete the default constructor.
TPG::TPGEdge::~TPGEdge
virtual ~TPGEdge()=default
Default virtual destructor (for polymorphism)
TPG::TPGEdge::source
const TPGVertex * source
Pointer to the source TPGVertex of this TPGEdge.
Definition tpgEdge.h:159
TPG::TPGEdge::getDestination
virtual const TPGVertex * getDestination() const
Get the destination TPGVertex of the TPGEdge.
Definition tpgEdge.cpp:94
TPG::TPGEdge::setDestination
virtual void setDestination(TPGVertex *newDestination)
Set a new destination TPGVertex to the TPGEdge.
Definition tpgEdge.cpp:99
TPG::TPGEdge::resetEdgeIDCounter
static void resetEdgeIDCounter()
Reset the edge ID counter.
Definition tpgEdge.cpp:53
TPG::TPGEdge::getSource
const TPGVertex * getSource() const
Get the source TPGVertex of the TPGEdge.
Definition tpgEdge.cpp:84
TPG::TPGEdge::destination
const TPGVertex * destination
Pointer to the destination TPGVertex of this TPGEdge.
Definition tpgEdge.h:162
TPG::TPGEdge::getProgram
Program::Program & getProgram() const
Get a const reference to the Program of the TPGEdge.
Definition tpgEdge.cpp:68
TPG::TPGEdge::getEdgeID
virtual uint64_t getEdgeID() const
Get the unique identifier of the TPGEdge.
Definition tpgEdge.cpp:104
TPG::TPGEdge::incrementeCounter
static uint64_t incrementeCounter()
Incremente the edge ID counter and return the new value.
Definition tpgEdge.cpp:43
TPG::TPGEdge::setSource
void setSource(TPGVertex *newSource)
Set a new source TPGVertex to the TPGEdge.
Definition tpgEdge.cpp:89
TPG::TPGEdge::getProgramSharedPointer
std::shared_ptr< Program::Program > getProgramSharedPointer()
Get the shared_pointer to the Program.
Definition tpgEdge.cpp:79
TPG::TPGEdge::setEdgeID
virtual void setEdgeID(uint64_t newID)
Set a new unique identifier to the TPGEdge.
Definition tpgEdge.cpp:58
TPG::TPGEdge::getEdgeIDCounter
static uint64_t getEdgeIDCounter()
Get the current value of the edge ID counter.
Definition tpgEdge.cpp:48
TPG::TPGEdge::TPGEdge
TPGEdge(const TPGVertex *src, const TPGVertex *dest, const std::shared_ptr< Program::Program > prog)
Main constructor of the TPGEdge class.
Definition tpgEdge.h:70
TPG::TPGEdge::edgeID
uint64_t edgeID
Unique identifier of the TPGEdge.
Definition tpgEdge.h:173
TPG::TPGEdge::setProgram
void setProgram(const std::shared_ptr< Program::Program > prog) const
Set a new Program for the TPGEdge.
Definition tpgEdge.cpp:73
TPG::TPGVertex
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
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