aGrUM  0.14.1
gum::prm::o3prmr::O3prmrSession< GUM_SCALAR > Class Template Reference

This class contains a o3prmr session. More...

#include <O3prmrContext.h>

Public Member Functions

 O3prmrSession (const std::string &name=std::string())
 
 O3prmrSession (const O3prmrSession &s)
 
virtual ~O3prmrSession ()
 
std::string name () const
 
std::vector< O3prmrCommand *> commands () const
 
void addObserve (int line, const std::string &leftValue, const std::string &rightValue)
 
void addUnobserve (int line, const std::string &value)
 
void addQuery (int line, const std::string &value)
 
void addSetEngine (int line, const std::string &value)
 
void addSetGndEngine (int line, const std::string &value)
 
void addCommand (const O3prmrCommand *command)
 
virtual std::string toString () const
 
O3prmrSessionoperator+= (const O3prmrSession &c)
 

Detailed Description

template<typename GUM_SCALAR>
class gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >

This class contains a o3prmr session.

It have a name and a sequence of commands.

Definition at line 177 of file O3prmrContext.h.

Constructor & Destructor Documentation

◆ O3prmrSession() [1/2]

template<typename GUM_SCALAR >
gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::O3prmrSession ( const std::string &  name = std::string())
explicit

Definition at line 160 of file O3prmrContext_tpl.h.

160  {
161  m_name = name;
162  }
std::string m_name
The session name;.

◆ O3prmrSession() [2/2]

template<typename GUM_SCALAR >
gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::O3prmrSession ( const O3prmrSession< GUM_SCALAR > &  s)

Definition at line 165 of file O3prmrContext_tpl.h.

166  {
167  m_name = s.m_name;
168  *this += s;
169  }
std::string m_name
The session name;.

◆ ~O3prmrSession()

template<typename GUM_SCALAR >
gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::~O3prmrSession ( )
virtual

Definition at line 172 of file O3prmrContext_tpl.h.

172  {
173  for (Idx i = Size(m_commands.size()); i >= 1; i--)
174  delete m_commands[i - 1];
175 
176  m_commands.clear();
177  }
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
std::vector< O3prmrCommand *> m_commands
A sequence of commands.

Member Function Documentation

◆ addCommand() [1/2]

template<typename GUM_SCALAR >
void gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::addCommand ( const O3prmrCommand command)

Definition at line 226 of file O3prmrContext_tpl.h.

Referenced by gum::prm::o3prmr::O3prmrInterpreter::checkSemantic().

226  {
227  switch (command->type()) {
229  m_commands.push_back(
230  new SetEngineCommand(*(SetEngineCommand*)command));
231  break;
232 
234  m_commands.push_back(
235  new SetGndEngineCommand(*(SetGndEngineCommand*)command));
236  break;
237 
239  m_commands.push_back(new ObserveCommand< GUM_SCALAR >(
240  *(ObserveCommand< GUM_SCALAR >*)command));
241  break;
242 
244  m_commands.push_back(new UnobserveCommand< GUM_SCALAR >(
245  *(UnobserveCommand< GUM_SCALAR >*)command));
246  break;
247 
249  m_commands.push_back(new QueryCommand< GUM_SCALAR >(
250  *(QueryCommand< GUM_SCALAR >*)command));
251  break;
252  }
253  }
std::vector< O3prmrCommand *> m_commands
A sequence of commands.
+ Here is the caller graph for this function:

◆ addCommand() [2/2]

template<typename GUM_SCALAR >
void gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::addCommand ( O3prmrCommand command)
private

Definition at line 190 of file O3prmrContext_tpl.h.

190  {
191  m_commands.push_back(command);
192  }
std::vector< O3prmrCommand *> m_commands
A sequence of commands.

◆ addObserve()

template<typename GUM_SCALAR >
void gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::addObserve ( int  line,
const std::string &  leftValue,
const std::string &  rightValue 
)

Definition at line 195 of file O3prmrContext_tpl.h.

197  {
198  addCommand(new ObserveCommand< GUM_SCALAR >(line, leftValue, rightValue));
199  }
void addCommand(const O3prmrCommand *command)

◆ addQuery()

template<typename GUM_SCALAR >
void gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::addQuery ( int  line,
const std::string &  value 
)

Definition at line 208 of file O3prmrContext_tpl.h.

209  {
210  addCommand(new QueryCommand< GUM_SCALAR >(line, value));
211  }
void addCommand(const O3prmrCommand *command)

◆ addSetEngine()

template<typename GUM_SCALAR >
void gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::addSetEngine ( int  line,
const std::string &  value 
)

Definition at line 214 of file O3prmrContext_tpl.h.

215  {
216  addCommand(new SetEngineCommand(line, value));
217  }
void addCommand(const O3prmrCommand *command)

◆ addSetGndEngine()

template<typename GUM_SCALAR >
void gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::addSetGndEngine ( int  line,
const std::string &  value 
)

Definition at line 220 of file O3prmrContext_tpl.h.

221  {
222  addCommand(new SetGndEngineCommand(line, value));
223  }
void addCommand(const O3prmrCommand *command)

◆ addUnobserve()

template<typename GUM_SCALAR >
void gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::addUnobserve ( int  line,
const std::string &  value 
)

Definition at line 202 of file O3prmrContext_tpl.h.

203  {
204  addCommand(new UnobserveCommand< GUM_SCALAR >(line, value));
205  }
void addCommand(const O3prmrCommand *command)

◆ commands()

template<typename GUM_SCALAR >
std::vector< O3prmrCommand *> gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::commands ( ) const

Definition at line 185 of file O3prmrContext_tpl.h.

185  {
186  return m_commands;
187  }
std::vector< O3prmrCommand *> m_commands
A sequence of commands.

◆ name()

template<typename GUM_SCALAR >
std::string gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::name ( ) const

Definition at line 180 of file O3prmrContext_tpl.h.

180  {
181  return m_name;
182  }
std::string m_name
The session name;.

◆ operator+=()

template<typename GUM_SCALAR >
O3prmrSession< GUM_SCALAR > & gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::operator+= ( const O3prmrSession< GUM_SCALAR > &  c)

Definition at line 273 of file O3prmrContext_tpl.h.

Referenced by gum::prm::o3prmr::O3prmrSession< double >::toString().

273  {
274  for (std::vector< O3prmrCommand* >::const_iterator i =
275  c.m_commands.begin();
276  i < c.m_commands.end();
277  i++)
278  addCommand(*i);
279 
280  return *this;
281  }
void addCommand(const O3prmrCommand *command)
+ Here is the caller graph for this function:

◆ toString()

template<typename GUM_SCALAR >
std::string gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::toString ( ) const
virtual

Definition at line 256 of file O3prmrContext_tpl.h.

256  {
257  std::string output;
258 
259  output += "request " + m_name + " {\n";
260 
261  for (std::vector< O3prmrCommand* >::const_iterator i = m_commands.begin();
262  i < m_commands.end();
263  i++)
264  output += "\t" + (*i)->toString() + "\n";
265 
266  output += "}\n";
267 
268  return output;
269  }
std::vector< O3prmrCommand *> m_commands
A sequence of commands.
std::string m_name
The session name;.

Member Data Documentation

◆ m_commands

template<typename GUM_SCALAR>
std::vector< O3prmrCommand* > gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::m_commands
private

A sequence of commands.

Definition at line 181 of file O3prmrContext.h.

Referenced by gum::prm::o3prmr::O3prmrSession< double >::operator+=().

◆ m_infEngineMap

template<typename GUM_SCALAR>
std::map< const PRMSystem< GUM_SCALAR >*, PRMInference< GUM_SCALAR >* > gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::m_infEngineMap
private

Definition at line 183 of file O3prmrContext.h.

◆ m_name

template<typename GUM_SCALAR>
std::string gum::prm::o3prmr::O3prmrSession< GUM_SCALAR >::m_name
private

The session name;.

Definition at line 179 of file O3prmrContext.h.

Referenced by gum::prm::o3prmr::O3prmrSession< double >::O3prmrSession().


The documentation for this class was generated from the following files: