aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
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 162 of file O3prmrContext_tpl.h.

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

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

◆ ~O3prmrSession()

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

Definition at line 174 of file O3prmrContext_tpl.h.

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

228  {
229  switch (command->type()) {
231  m_commands.push_back(
232  new SetEngineCommand(*(SetEngineCommand*)command));
233  break;
234 
236  m_commands.push_back(
237  new SetGndEngineCommand(*(SetGndEngineCommand*)command));
238  break;
239 
241  m_commands.push_back(new ObserveCommand< GUM_SCALAR >(
242  *(ObserveCommand< GUM_SCALAR >*)command));
243  break;
244 
246  m_commands.push_back(new UnobserveCommand< GUM_SCALAR >(
247  *(UnobserveCommand< GUM_SCALAR >*)command));
248  break;
249 
251  m_commands.push_back(new QueryCommand< GUM_SCALAR >(
252  *(QueryCommand< GUM_SCALAR >*)command));
253  break;
254  }
255  }
std::vector< O3prmrCommand *> m_commands
A sequence of commands.

◆ addCommand() [2/2]

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

Definition at line 192 of file O3prmrContext_tpl.h.

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

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

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

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

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

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

◆ commands()

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

Definition at line 187 of file O3prmrContext_tpl.h.

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

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

275  {
276  for (std::vector< O3prmrCommand* >::const_iterator i
277  = c.m_commands.begin();
278  i < c.m_commands.end();
279  i++)
280  addCommand(*i);
281 
282  return *this;
283  }
void addCommand(const O3prmrCommand *command)

◆ toString()

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

Definition at line 258 of file O3prmrContext_tpl.h.

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

◆ 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 documentation for this class was generated from the following files: