GEGELATI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
TPG::TPGEdge Class Reference

Class representing edges of the Tangled Program Graphs. More...

#include <tpgEdge.h>

Inheritance diagram for TPG::TPGEdge:
TPG::TPGActionEdge TPG::TPGEdgeInstrumented

Public Member Functions

virtual ~TPGEdge ()=default
 Default virtual destructor (for polymorphism)
 
 TPGEdge (const TPGVertex *src, const TPGVertex *dest, const std::shared_ptr< Program::Program > prog)
 Main constructor of the TPGEdge class.
 
Program::ProgramgetProgram () const
 Get a const reference to the Program of the TPGEdge.
 
void setProgram (const std::shared_ptr< Program::Program > prog) const
 Set a new Program for the TPGEdge.
 
std::shared_ptr< Program::ProgramgetProgramSharedPointer ()
 Get the shared_pointer to the Program.
 
const TPGVertexgetSource () const
 Get the source TPGVertex of the TPGEdge.
 
void setSource (TPGVertex *newSource)
 Set a new source TPGVertex to the TPGEdge.
 
virtual const TPGVertexgetDestination () const
 Get the destination TPGVertex of the TPGEdge.
 
virtual void setDestination (TPGVertex *newDestination)
 Set a new destination TPGVertex to the TPGEdge.
 
virtual uint64_t getEdgeID () const
 Get the unique identifier of the TPGEdge.
 
virtual void setEdgeID (uint64_t newID)
 Set a new unique identifier to the TPGEdge.
 

Static Public Member Functions

static uint64_t getEdgeIDCounter ()
 Get the current value of the edge ID counter.
 

Protected Member Functions

 TPGEdge ()=delete
 Delete the default constructor.
 

Static Protected Member Functions

static uint64_t incrementeCounter ()
 Incremente the edge ID counter and return the new value.
 
static void resetEdgeIDCounter ()
 Reset the edge ID counter.
 

Protected Attributes

const TPGVertexsource
 Pointer to the source TPGVertex of this TPGEdge.
 
const TPGVertexdestination
 Pointer to the destination TPGVertex of this TPGEdge.
 
std::shared_ptr< Program::Programprogram
 
uint64_t edgeID
 Unique identifier of the TPGEdge.
 

Friends

struct ::CounterReset
 

Detailed Description

Class representing edges of the Tangled Program Graphs.

Constructor & Destructor Documentation

◆ TPGEdge()

TPG::TPGEdge::TPGEdge ( const TPGVertex * src,
const TPGVertex * dest,
const std::shared_ptr< Program::Program > prog )
inline

Main constructor of the TPGEdge class.

This constructor does not register the created TPGEdge in the list of incoming or outgoing edges of the given TPGVertex.

Parameters
[in]srcpointer to the source TPGVertex of the edge.
[in]destpointer to the destination TPGVertex of the edge.
[in]progthe shared pointer to the Program associated to the edge.

Member Function Documentation

◆ getDestination()

const TPG::TPGVertex * TPG::TPGEdge::getDestination ( ) const
virtual

Get the destination TPGVertex of the TPGEdge.

Returns
a const pointer to the destination TPGVertex.

Reimplemented in TPG::TPGActionEdge.

◆ getEdgeID()

uint64_t TPG::TPGEdge::getEdgeID ( ) const
virtual

Get the unique identifier of the TPGEdge.

Returns
the integer ID of the TPGEdge..

◆ getEdgeIDCounter()

uint64_t TPG::TPGEdge::getEdgeIDCounter ( )
static

Get the current value of the edge ID counter.

This method is mainly used for testing purpose to ensure that edge IDs are predictable.

Returns
the current value of the edge ID counter.

◆ getProgram()

Program::Program & TPG::TPGEdge::getProgram ( ) const

Get a const reference to the Program of the TPGEdge.

Returns
a const reference to the Program of the TPGEdge.

◆ getProgramSharedPointer()

std::shared_ptr< Program::Program > TPG::TPGEdge::getProgramSharedPointer ( )

Get the shared_pointer to the Program.

This method is voluntarily non-const to make sure that only the TPGGraph containing the edge can use it.

Returns
a copy of the program attribute.

◆ getSource()

const TPG::TPGVertex * TPG::TPGEdge::getSource ( ) const

Get the source TPGVertex of the TPGEdge.

Returns
a const pointer to the source TPGVertex.

◆ resetEdgeIDCounter()

void TPG::TPGEdge::resetEdgeIDCounter ( )
staticprotected

Reset the edge ID counter.

This method set the ID counter to a new value. It can quickly lead to segmentation fault if not used carefully.

◆ setDestination()

void TPG::TPGEdge::setDestination ( TPGVertex * newDestination)
virtual

Set a new destination TPGVertex to the TPGEdge.

Parameters
[in]newDestinationthe new TPGVertex to register as the destination.

Reimplemented in TPG::TPGActionEdge.

◆ setEdgeID()

void TPG::TPGEdge::setEdgeID ( uint64_t newID)
virtual

Set a new unique identifier to the TPGEdge.

Parameters
[in]newIDthe new integer ID to set to the TPGEdge.

◆ setProgram()

void TPG::TPGEdge::setProgram ( const std::shared_ptr< Program::Program > prog) const

Set a new Program for the TPGEdge.

This method is const to enable use outside of the TPGGraph which is the only class accessing the non-const TPGEdge. Since the program pointer attribute is mutable, this method can successfully be used to alter the program.

Parameters
[in]progthe new shared pointer to a Program.

◆ setSource()

void TPG::TPGEdge::setSource ( TPGVertex * newSource)

Set a new source TPGVertex to the TPGEdge.

Parameters
[in]newSourcethe new TPGVertex to register as the source.

Member Data Documentation

◆ program

std::shared_ptr<Program::Program> TPG::TPGEdge::program
mutableprotected

Shared pointer to the Program to execute when evaluating the bid of this TPGEdge. This attribute is mutable to enable its modification during mutations.


The documentation for this class was generated from the following files: