rad 8.2.0
Loading...
Searching...
No Matches
SCXMLWriterImpl.h
Go to the documentation of this file.
1
9
10/*
11 * scampl4cpp/parser
12 *
13 * Copyright by European Southern Observatory, 2012
14 * All rights reserved
15 *
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29 * 02111-1307 USA.
30 */
31
32#ifndef SCXML4CPP_SCXMLWRITER_IMPL_H
33#define SCXML4CPP_SCXMLWRITER_IMPL_H
34
36#include "scxml4cpp/Action.h"
37#include "scxml4cpp/Activity.h"
39#include "scxml4cpp/State.h"
43
44#include <boost/property_tree/ptree.hpp>
45#include <boost/property_tree/xml_parser.hpp>
46
47#include <list>
48
49namespace scxml4cpp {
50
56{
57 public:
59 ~SCXMLWriterImpl() override = default;
60
68 std::string write(StateMachine& sm) override;
69
77 void write(const std::string& filename, StateMachine& sm) override;
78
79 private:
80 boost::property_tree::ptree::path_type formatKey(const std::string key);
81
82 std::string getFirstTargetState(Transition* t);
83 std::string getFirstTargetState(std::list<Transition*>& transitions);
84
85 void addActivities(std::list<Activity*>& activities, boost::property_tree::ptree& tree);
86 void addActions(std::list<Action*>& actions, boost::property_tree::ptree& tree);
87 void addEntryActions(std::list<Action*>& actions, boost::property_tree::ptree& tree);
88 void addExitActions(std::list<Action*>& actions, boost::property_tree::ptree& tree);
89 void addTranistion(Transition* t, boost::property_tree::ptree& tree);
90 void addTranistions(std::list<Transition*>& transitions, boost::property_tree::ptree& tree);
91 void addInitialTranistions(std::list<Transition*>& transitions,
92 boost::property_tree::ptree& tree);
93 void addHistoryState(StateHistory* s, boost::property_tree::ptree& tree);
94 void addFinalState(State* s, boost::property_tree::ptree& tree);
95 void addParallelState(State* s, boost::property_tree::ptree& tree);
96 void addState(State* s, boost::property_tree::ptree& tree);
97
98 boost::property_tree::ptree buildTree(StateMachine& sm);
99
100 char m_separator;
101};
102
103} // namespace scxml4cpp
104
105#endif // SCXML4CPP_SCXMLWRITER_IMPL_H
Action header.
Activity header.
ExecutableContent header.
SCXMLWriter header.
StateHistory header.
StateMachine header.
State header.
Transition header.
std::string write(StateMachine &sm) override
Definition SCXMLWriterImpl.cpp:313
SCXMLWriterImpl()
Definition SCXMLWriterImpl.cpp:37
~SCXMLWriterImpl() override=default
Definition SCXMLWriter.h:46
Definition StateHistory.h:57
Definition StateMachine.h:64
Definition State.h:60
Definition Transition.h:68
Definition Action.cpp:36