aGrUM  0.16.0
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 179 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 163 of file O3prmrContext_tpl.h.

163  {
164  m_name = name;
165  }
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 168 of file O3prmrContext_tpl.h.

169  {
170  m_name = s.m_name;
171  *this += s;
172  }
std::string m_name
The session name;.

◆ ~O3prmrSession()

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

Definition at line 175 of file O3prmrContext_tpl.h.

175  {
176  for (Idx i = Size(m_commands.size()); i >= 1; i--)
177  delete m_commands[i - 1];
178 
179  m_commands.clear();
180  }
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
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 229 of file O3prmrContext_tpl.h.

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

229  {
230  switch (command->type()) {
232  m_commands.push_back(
233  new SetEngineCommand(*(SetEngineCommand*)command));
234  break;
235 
237  m_commands.push_back(
238  new SetGndEngineCommand(*(SetGndEngineCommand*)command));
239  break;
240 
242  m_commands.push_back(new ObserveCommand< GUM_SCALAR >(
243  *(ObserveCommand< GUM_SCALAR >*)command));
244  break;
245 
247  m_commands.push_back(new UnobserveCommand< GUM_SCALAR >(
248  *(UnobserveCommand< GUM_SCALAR >*)command));
249  break;
250 
252  m_commands.push_back(new QueryCommand< GUM_SCALAR >(
253  *(QueryCommand< GUM_SCALAR >*)command));
254  break;
255  }
256  }
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 193 of file O3prmrContext_tpl.h.

193  {
194  m_commands.push_back(command);
195  }
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 198 of file O3prmrContext_tpl.h.

200  {
201  addCommand(new ObserveCommand< GUM_SCALAR >(line, leftValue, rightValue));
202  }
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 211 of file O3prmrContext_tpl.h.

212  {
213  addCommand(new QueryCommand< GUM_SCALAR >(line, value));
214  }
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 217 of file O3prmrContext_tpl.h.

218  {
219  addCommand(new SetEngineCommand(line, value));
220  }
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 223 of file O3prmrContext_tpl.h.

224  {
225  addCommand(new SetGndEngineCommand(line, value));
226  }
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 205 of file O3prmrContext_tpl.h.

206  {
207  addCommand(new UnobserveCommand< GUM_SCALAR >(line, value));
208  }
void addCommand(const O3prmrCommand *command)

◆ commands()

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

Definition at line 188 of file O3prmrContext_tpl.h.

188  {
189  return m_commands;
190  }
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 183 of file O3prmrContext_tpl.h.

183  {
184  return m_name;
185  }
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 276 of file O3prmrContext_tpl.h.

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

276  {
277  for (std::vector< O3prmrCommand* >::const_iterator i =
278  c.m_commands.begin();
279  i < c.m_commands.end();
280  i++)
281  addCommand(*i);
282 
283  return *this;
284  }
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 259 of file O3prmrContext_tpl.h.

259  {
260  std::string output;
261 
262  output += "request " + m_name + " {\n";
263 
264  for (std::vector< O3prmrCommand* >::const_iterator i = m_commands.begin();
265  i < m_commands.end();
266  i++)
267  output += "\t" + (*i)->toString() + "\n";
268 
269  output += "}\n";
270 
271  return output;
272  }
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 183 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 185 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 181 of file O3prmrContext.h.

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


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