aGrUM  0.20.3
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 167 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 156 of file O3prmrContext_tpl.h.

156  {
157  m_name = name;
158  }
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 161 of file O3prmrContext_tpl.h.

161  {
162  m_name = s.m_name;
163  *this += s;
164  }
std::string m_name
The session name;.

◆ ~O3prmrSession()

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

Definition at line 167 of file O3prmrContext_tpl.h.

167  {
168  for (Idx i = Size(m_commands.size()); i >= 1; i--)
169  delete m_commands[i - 1];
170 
171  m_commands.clear();
172  }
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 217 of file O3prmrContext_tpl.h.

217  {
218  switch (command->type()) {
220  m_commands.push_back(new SetEngineCommand(*(SetEngineCommand*)command));
221  break;
222 
224  m_commands.push_back(new SetGndEngineCommand(*(SetGndEngineCommand*)command));
225  break;
226 
228  m_commands.push_back(
229  new ObserveCommand< GUM_SCALAR >(*(ObserveCommand< GUM_SCALAR >*)command));
230  break;
231 
233  m_commands.push_back(
234  new UnobserveCommand< GUM_SCALAR >(*(UnobserveCommand< GUM_SCALAR >*)command));
235  break;
236 
238  m_commands.push_back(
239  new QueryCommand< GUM_SCALAR >(*(QueryCommand< GUM_SCALAR >*)command));
240  break;
241  }
242  }
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 185 of file O3prmrContext_tpl.h.

185  {
186  m_commands.push_back(command);
187  }
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 190 of file O3prmrContext_tpl.h.

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

202  {
203  addCommand(new QueryCommand< GUM_SCALAR >(line, value));
204  }
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 207 of file O3prmrContext_tpl.h.

207  {
208  addCommand(new SetEngineCommand(line, value));
209  }
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 212 of file O3prmrContext_tpl.h.

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

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

◆ commands()

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

Definition at line 180 of file O3prmrContext_tpl.h.

180  {
181  return m_commands;
182  }
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 175 of file O3prmrContext_tpl.h.

175  {
176  return m_name;
177  }
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 262 of file O3prmrContext_tpl.h.

262  {
263  for (std::vector< O3prmrCommand* >::const_iterator i = c.m_commands.begin();
264  i < c.m_commands.end();
265  i++)
266  addCommand(*i);
267 
268  return *this;
269  }
void addCommand(const O3prmrCommand *command)

◆ toString()

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

Definition at line 245 of file O3prmrContext_tpl.h.

245  {
246  std::string output;
247 
248  output += "request " + m_name + " {\n";
249 
250  for (std::vector< O3prmrCommand* >::const_iterator i = m_commands.begin();
251  i < m_commands.end();
252  i++)
253  output += "\t" + (*i)->toString() + "\n";
254 
255  output += "}\n";
256 
257  return output;
258  }
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 171 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 172 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: