39#ifndef TPG_GENERATION_ENGINE_H
40#define TPG_GENERATION_ENGINE_H
45#include "codeGen/programGenerationEngine.h"
46#include "tpg/tpgAbstractEngine.h"
47#include "tpg/tpgEdge.h"
48#include "tpg/tpgGraph.h"
49#include "tpg/tpgTeam.h"
135 const std::string& path =
"./",
139 tpg.getEnvironment(),
144 throw std::runtime_error(
145 "error the size of the call stack is equal to 0");
147 this->fileMain.open(path + filename +
".c", std::ofstream::out);
148 this->fileMainH.open(path + filename +
".h", std::ofstream::out);
150 throw std::runtime_error(
151 "Error can't open " + std::string(path + filename) +
152 ".c or " + std::string(path + filename) +
".h");
154 fileMain <<
"#include \"" << filename <<
".h\"" << std::endl;
156 <<
".h\"" << std::endl;
158 fileMainH <<
"#ifndef C_" << filename <<
"_H" << std::endl;
159 fileMainH <<
"#define C_" << filename <<
"_H\n" << std::endl;
Class in charge of generating inference C code for all the Program of a TPG.
Definition: programGenerationEngine.h:63
Class in charge of generating the C code of a TPGGraph.
Definition: tpgGenerationEngine.h:69
void initTpgFile()
function printing generic code in the main file.
Definition: tpgGenerationEngine.cpp:125
TPGGenerationEngine(const std::string &filename, const TPG::TPGGraph &tpg, const std::string &path="./", const uint64_t &stackSize=8)
Main constructor of the class.
Definition: tpgGenerationEngine.h:133
std::ofstream fileMain
File holding the functions in charge of iterating through the TPG.
Definition: tpgGenerationEngine.h:78
void generateEdge(const TPG::TPGEdge &edge)
Method for generating the code for an edge of the graph.
Definition: tpgGenerationEngine.cpp:43
uint64_t stackSize
Size of the stack of visited edges.
Definition: tpgGenerationEngine.h:97
void generateTPGGraph()
function that creates the C files required to execute the TPG without gegelati.
Definition: tpgGenerationEngine.cpp:109
std::ofstream fileMainH
header file for the function that iterates through the TPG.
Definition: tpgGenerationEngine.h:80
void generateTeam(const TPG::TPGTeam &team)
Method for generating the code for a team of the graph.
Definition: tpgGenerationEngine.cpp:64
~TPGGenerationEngine()
destructor of the class.
Definition: tpgGenerationEngine.h:168
static const std::string filenameProg
Definition: tpgGenerationEngine.h:75
void setRoot(const TPG::TPGVertex &root)
define the function pointer root to the vertex given in parameter.
Definition: tpgGenerationEngine.cpp:102
void initHeaderFile()
function printing generic code declaration in the main file header.
Definition: tpgGenerationEngine.cpp:215
void generateAction(const TPG::TPGAction &action)
Method for generating a action of the graph.
Definition: tpgGenerationEngine.cpp:90
CodeGen::ProgramGenerationEngine progGenerationEngine
ProgramGenerationEngine for generating Programs of edges.
Definition: tpgGenerationEngine.h:88
Abstract Class in charge of managing maps to give a unique ID for vertex and a program of a TPGGraph.
Definition: tpgAbstractEngine.h:49
const TPG::TPGGraph & tpg
Reference to the TPGGraph whose content will be used to fill the maps.
Definition: tpgAbstractEngine.h:56
TPGAbstractEngine(const TPG::TPGGraph &tpg)
Constructor for the abstract engine.
Definition: tpgAbstractEngine.h:110
Class representing an Action of a TPGGraph.
Definition: tpgAction.h:52
Class representing edges of the Tangled Program Graphs.
Definition: tpgEdge.h:51
Class for storing a Tangled-Program-Graph.
Definition: tpgGraph.h:54
Abstract class representing the vertices of a TPGGraph.
Definition: tpgVertex.h:49
Definition: programGenerationEngine.h:48