sequencer.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #ifndef __SOT_SOTSEQUENCER_H__
11 #define __SOT_SOTSEQUENCER_H__
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* Matrix */
19 
20 /* SOT */
22 #include <dynamic-graph/entity.h>
23 
25 
26 /* STD */
27 #include <list>
28 #include <map>
29 #include <string>
30 
31 /* --------------------------------------------------------------------- */
32 /* --- API ------------------------------------------------------------- */
33 /* --------------------------------------------------------------------- */
34 
35 #if defined(WIN32)
36 #if defined(sequencer_EXPORTS)
37 #define SOTSEQUENCER_EXPORT __declspec(dllexport)
38 #else
39 #define SOTSEQUENCER_EXPORT __declspec(dllimport)
40 #endif
41 #else
42 #define SOTSEQUENCER_EXPORT
43 #endif
44 
45 namespace dynamicgraph {
46 namespace sot {
47 
48 /* --------------------------------------------------------------------- */
49 /* --- CLASS ----------------------------------------------------------- */
50 /* --------------------------------------------------------------------- */
51 
52 class Sot;
53 
56 
57  public:
59  public:
60  enum sotEventType { EVENT_ADD, EVENT_RM, EVENT_CMD };
61 
62  protected:
63  std::string name;
64  void setName(const std::string &name_) { name = name_; }
66 
67  public:
68  sotEventAbstract(const std::string &name) : name(name){};
69  virtual ~sotEventAbstract(void) {}
70  virtual const std::string &getName() const { return name; }
71  size_type getEventType() const { return eventType; }
72  virtual void operator()(Sot *sotPtr) = 0;
73  virtual void display(std::ostream &os) const { os << name; }
74  };
75 
76  protected:
78  typedef std::list<sotEventAbstract *> TaskList;
79  typedef std::map<std::size_t, TaskList> TaskMap;
80 
82  /* All the events are counting wrt to this t0. If t0 is -1, it
83  * is set to the first time of trig. */
85  bool playMode;
86  std::ostream *outputStreamPtr;
87  bool noOutput;
89  public: /* --- CONSTRUCTION --- */
90  Sequencer(const std::string &name);
91  virtual ~Sequencer(void);
92 
93  public: /* --- TASK MANIP --- */
94  void setSotRef(Sot *sot) { sotPtr = sot; }
95  void addTask(sotEventAbstract *task, const std::size_t time);
96  void rmTask(size_type eventType, const std::string &name,
97  const std::size_t time);
98  void clearAll();
99 
100  public: /* --- SIGNAL --- */
102 
103  public: /* --- FUNCTIONS --- */
104  size_type &trigger(size_type &dummy, const sigtime_t &time);
105 
106  public: /* --- PARAMS --- */
107  virtual void display(std::ostream &os) const;
108 };
109 } // namespace sot
110 } // namespace dynamicgraph
111 
112 #endif // #ifndef __SOT_SOTSEQUENCER_H__
dynamicgraph::sot::Sequencer::sotEventAbstract::setName
void setName(const std::string &name_)
Definition: sequencer.hh:64
dynamicgraph::sot::Sequencer::sotEventAbstract
Definition: sequencer.hh:58
dynamicgraph::sot::Sequencer
Definition: sequencer.hh:54
dynamicgraph
dynamicgraph::sot::Sequencer::sotPtr
Sot * sotPtr
Definition: sequencer.hh:77
dynamicgraph::Entity
dynamicgraph::sot::Sequencer::timeInit
sigtime_t timeInit
Definition: sequencer.hh:84
dynamicgraph::sot::Sequencer::sotEventAbstract::getName
virtual const std::string & getName() const
Definition: sequencer.hh:70
dynamicgraph::sot::Sequencer::triggerSOUT
dynamicgraph::SignalTimeDependent< size_type, sigtime_t > triggerSOUT
Definition: sequencer.hh:101
DYNAMIC_GRAPH_ENTITY_DECL
#define DYNAMIC_GRAPH_ENTITY_DECL()
dynamicgraph::sot::Sot
This class implements the Stack of Task. It allows to deal with the priority of the controllers throu...
Definition: sot.hh:57
dynamicgraph::sot::Sequencer::sotEventAbstract::sotEventType
sotEventType
Definition: sequencer.hh:60
dynamicgraph::sigtime_t
int64_t sigtime_t
dynamicgraph::sot::Sequencer::sotEventAbstract::eventType
size_type eventType
Definition: sequencer.hh:65
dummy
DummyClass dummy
Definition: test_signal.cpp:31
SOTSEQUENCER_EXPORT
#define SOTSEQUENCER_EXPORT
Definition: sequencer.hh:42
dynamicgraph::sot::Sequencer::sotEventAbstract::sotEventAbstract
sotEventAbstract(const std::string &name)
Definition: sequencer.hh:68
all-signals.h
dynamicgraph::size_type
Matrix::Index size_type
display
linear-algebra.h
dynamicgraph::sot::Sequencer::sotEventAbstract::~sotEventAbstract
virtual ~sotEventAbstract(void)
Definition: sequencer.hh:69
dynamicgraph::SignalTimeDependent< size_type, sigtime_t >
dynamicgraph::sot::Sequencer::sotEventAbstract::display
virtual void display(std::ostream &os) const
Definition: sequencer.hh:73
dynamicgraph::sot::Sequencer::outputStreamPtr
std::ostream * outputStreamPtr
Definition: sequencer.hh:86
dynamicgraph::sot::Sequencer::sotEventAbstract::getEventType
size_type getEventType() const
Definition: sequencer.hh:71
dynamicgraph::sot::Sequencer::TaskList
std::list< sotEventAbstract * > TaskList
Definition: sequencer.hh:78
dynamicgraph::sot::Sequencer::setSotRef
void setSotRef(Sot *sot)
Definition: sequencer.hh:94
dynamicgraph::sot::Sequencer::sotEventAbstract::name
std::string name
Definition: sequencer.hh:63
task-abstract.hh
dynamicgraph::sot::Sequencer::taskMap
TaskMap taskMap
Definition: sequencer.hh:81
dynamicgraph::sot::Sequencer::TaskMap
std::map< std::size_t, TaskList > TaskMap
Definition: sequencer.hh:79
dynamicgraph::sot::Sequencer::noOutput
bool noOutput
Definition: sequencer.hh:87
compile.name
name
Definition: compile.py:23
dynamicgraph::sot::Sequencer::playMode
bool playMode
Definition: sequencer.hh:85


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31