Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_MODELBUILDERBASE_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_MODELBUILDERBASE_HPP
49 auto ends_with = [](std::string
const& value, std::string
const& ending) {
50 if (ending.size() > value.size())
52 return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
55 if (ends_with(file_name,
"scxml")) {
56 std::ofstream out(file_name);
58 }
else if (ends_with(file_name,
"smcat")) {
59 std::ofstream out(file_name);
61 }
else if (ends_with(file_name,
"debug")) {
62 std::ofstream out(file_name);
65 CII_THROW(
RtctkException,
"Unsupported export format: '" + file_name +
"'");
71 using Layer = std::tuple<std::string, LayerOptions>;
75 std::ostringstream msg;
76 msg <<
"Applying Layer '" << std::get<0>(layer) <<
"' with Options:";
77 for (
const auto& [key, value] : std::get<1>(layer)) {
78 msg <<
" " << key <<
":" << value;
82 layers.push_back(layer);
Export the state machine model in various formats.
std::tuple< std::string, LayerOptions > Layer
Definition: modelBuilderBase.hpp:71
void RegisterModel(const std::string &name, const std::string &model)
Register a new state machine model.
Definition: stateMachineEngine.cpp:52
Wrapper around the SCXML State Machine Engine.
virtual ~ModelBuilderBase()=default
StateMachine sm
Definition: modelBuilderBase.hpp:85
void RegisterModel()
Definition: modelBuilderBase.hpp:39
void ExportModel(std::string const &file_name)
Definition: modelBuilderBase.hpp:48
ModelManipulator mm
Definition: modelBuilderBase.hpp:86
In-memory representation of the state machine model.
Definition: commandReplier.cpp:20
Manipulate the in-memory state machine model.
The RtctkException class is the base class for all Rtctk exceptions.
Definition: exceptions.hpp:207
Definition: stateMachineEngine.hpp:31
Class that provides methods to manipulate the state machine model.
Definition: modelManipulator.hpp:24
Base class of the ModelBuilder.
Definition: modelBuilderBase.hpp:32
log4cplus::Logger & GetLogger(const std::string &name="")
Get handle to a specific logger (used with logging macros)
std::stringstream Export(StateMachine &sm, std::string const &format)
Export the in-memory state machine model in various formats.
Definition: modelExport.cpp:536
std::vector< Layer > Layers
Definition: modelBuilderBase.hpp:72
void RegisterLayer(Layer layer)
Definition: modelBuilderBase.hpp:74
StateMachineEngine & m_engine
Definition: modelBuilderBase.hpp:87
Logging Support Library based on log4cplus.
ModelBuilderBase(StateMachineEngine &engine)
Definition: modelBuilderBase.hpp:34
std::map< std::string, bool > LayerOptions
Definition: modelBuilderBase.hpp:70