38 template <
typename GUM_SCALAR >
40 m_filename = filename;
44 template <
typename GUM_SCALAR >
51 template <
typename GUM_SCALAR >
53 for (
Idx i =
Size(m_imports.size()); i > 0; i--)
54 delete m_imports[i - 1];
56 for (
Size i =
Size(m_sessions.size()); i > 0; i--)
57 delete m_sessions[i - 1];
60 template <
typename GUM_SCALAR >
65 template <
typename GUM_SCALAR >
70 template <
typename GUM_SCALAR >
75 template <
typename GUM_SCALAR >
78 for (
Idx i =
Size(m_imports.size()); i > 0; i--)
79 if (m_imports[i - 1]->alias == alias)
return m_imports[i - 1]->value;
84 template <
typename GUM_SCALAR >
89 template <
typename GUM_SCALAR >
91 const std::string&
import,
92 const std::string& alias) {
95 if (alias ==
"default") m_mainImport = m_imports.back();
98 template <
typename GUM_SCALAR >
100 const std::string&
import,
102 m_imports.push_back(
new ImportCommand(line,
import,
import));
104 if (ismain) m_mainImport = m_imports.back();
107 template <
typename GUM_SCALAR >
108 std::vector< O3prmrSession< GUM_SCALAR >* >
113 template <
typename GUM_SCALAR >
119 template <
typename GUM_SCALAR >
123 if (!m_package.empty()) {
124 output +=
"package " + m_package +
";\n";
128 for (
auto i = m_imports.begin(); i < m_imports.end(); i++)
129 output += (*i)->toString() +
"\n";
133 for (
auto i = m_sessions.begin(); i < m_sessions.end(); i++)
134 output += (*i)->toString() +
"\n";
139 template <
typename GUM_SCALAR >
142 const std::vector< ImportCommand* >& imports = c.
imports();
144 for (std::vector< ImportCommand* >::const_iterator i = imports.begin();
149 const std::vector< O3prmrSession< GUM_SCALAR >* >& sessions = c.
sessions();
151 if (sessions.size() == 1 && sessions.back()->name() ==
"default") {
152 *(this->m_sessions.back()) += *(sessions.back());
154 for (
auto i = sessions.begin(); i != sessions.end(); i++)
162 template <
typename GUM_SCALAR >
167 template <
typename GUM_SCALAR >
174 template <
typename GUM_SCALAR >
176 for (
Idx i =
Size(m_commands.size()); i >= 1; i--)
177 delete m_commands[i - 1];
182 template <
typename GUM_SCALAR >
187 template <
typename GUM_SCALAR >
192 template <
typename GUM_SCALAR >
194 m_commands.push_back(command);
197 template <
typename GUM_SCALAR >
199 const std::string& leftValue,
200 const std::string& rightValue) {
204 template <
typename GUM_SCALAR >
206 const std::string& value) {
210 template <
typename GUM_SCALAR >
212 const std::string& value) {
216 template <
typename GUM_SCALAR >
218 const std::string& value) {
222 template <
typename GUM_SCALAR >
224 const std::string& value) {
228 template <
typename GUM_SCALAR >
230 switch (command->
type()) {
232 m_commands.push_back(
237 m_commands.push_back(
258 template <
typename GUM_SCALAR >
262 output +=
"request " + m_name +
" {\n";
264 for (std::vector< O3prmrCommand* >::const_iterator i = m_commands.begin();
265 i < m_commands.end();
267 output +=
"\t" + (*i)->toString() +
"\n";
274 template <
typename GUM_SCALAR >
277 for (std::vector< O3prmrCommand* >::const_iterator i =
void addObserve(int line, const std::string &leftValue, const std::string &rightValue)
void addSession(const O3prmrSession< GUM_SCALAR > &session)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual std::string toString() const
std::vector< ImportCommand *> imports() const
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::vector< O3prmrCommand *> commands() const
std::string filename() const
std::string aliasToImport(const std::string &alias)
void addImport(int line, const std::string &import, const std::string &alias)
O3prmrSession(const std::string &name=std::string())
void addUnobserve(int line, const std::string &value)
O3prmrContext(const std::string &filename=std::string())
O3prmrContext & operator+=(const O3prmrContext &c)
void setPackage(const std::string &package)
This is an abstract class.
Represent a o3prmr context, with an import, and some sequencials commands.
std::vector< O3prmrSession< GUM_SCALAR > *> sessions() const
This class contains a o3prmr session.
ImportCommand * m_mainImport
void addQuery(int line, const std::string &value)
void addSetGndEngine(int line, const std::string &value)
Size Idx
Type for indexes.
virtual std::string toString() const
std::size_t Size
In aGrUM, hashed values are unsigned long int.
std::vector< O3prmrCommand *> m_commands
A sequence of commands.
std::string package() const
void addSetEngine(int line, const std::string &value)
virtual RequestType type() const =0
std::string m_name
The session name;.
void addCommand(const O3prmrCommand *command)
O3prmrSession & operator+=(const O3prmrSession &c)