7 #ifndef GRAPHGEN_GRAPH_CODE_GENERATOR_H_
8 #define GRAPHGEN_GRAPH_CODE_GENERATOR_H_
17 #define BEFORE_AFTER_FUNC(func_name) std::string func_name(size_t index, \
18 const std::string& prefix, \
19 const std::vector<std::vector<size_t>>& mapping, \
78 bool with_gotos =
false,
81 const std::string prefix =
"",
83 const std::vector<std::vector<size_t>> mapping = {},
84 size_t end_group_id = 0);
88 bool with_gotos =
false,
91 const std::string prefix =
"",
93 const std::vector<std::vector<size_t>> mapping = {},
94 size_t end_group_id = 0);
#define BEFORE_AFTER_FUNC(func_name)
Macro used to define the base signature of before and after functions.
std::string BeforeMainShiftOne(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)
std::string AfterEndNoLoop(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)
std::string AfterEnd(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)
std::string BeforeEnd(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)
std::string DefaultEmptyFunc(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)
std::string BeforeMainShiftTwo(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)
size_t GenerateLineForestCode(std::ostream &os, const LineForestHandler &lfh, std::string prefix, size_t start_id, std::string before_main(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)=BeforeMainShiftOne, std::string after_main(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)=DefaultEmptyFunc, std::string before_end(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)=BeforeEnd, std::string after_end(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)=AfterEnd)
Generate the C++ code for the given Forest.
size_t GenerateDragCode(std::ostream &os, const BinaryDrag< conact > &bd, bool with_gotos=false, std::string before(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)=DefaultEmptyFunc, std::string after(size_t index, const std::string &prefix, const std::vector< std::vector< size_t >> &mapping, size_t end_group_id)=DefaultEmptyFunc, const std::string prefix="", size_t start_id=0, const std::vector< std::vector< size_t >> mapping={}, size_t end_group_id=0)
This function generates the code for the given drag reversing the output into the specified stream.
Generates all the forests needed to handle one line of the image.