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_; }
65  int eventType;
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  int 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<unsigned int, TaskList> TaskMap;
80 
81  TaskMap taskMap;
82  /* All the events are counting wrt to this t0. If t0 is -1, it
83  * is set to the first time of trig. */
84  int timeInit;
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 unsigned int time);
96  void rmTask(int eventType, const std::string &name, const unsigned int time);
97  void clearAll();
98 
99  public: /* --- SIGNAL --- */
101 
102  public: /* --- FUNCTIONS --- */
103  int &trigger(int &dummy, const int &time);
104 
105  public: /* --- PARAMS --- */
106  virtual void display(std::ostream &os) const;
107 };
108 } // namespace sot
109 } // namespace dynamicgraph
110 
111 #endif // #ifndef __SOT_SOTSEQUENCER_H__
void setSotRef(Sot *sot)
Definition: sequencer.hh:94
std::ostream * outputStreamPtr
Definition: sequencer.hh:86
void setName(const std::string &name_)
Definition: sequencer.hh:64
std::map< unsigned int, TaskList > TaskMap
Definition: sequencer.hh:79
#define DYNAMIC_GRAPH_ENTITY_DECL()
virtual void display(std::ostream &os) const
Definition: sequencer.hh:73
DummyClass dummy
Definition: test_signal.cpp:31
This class implements the Stack of Task. It allows to deal with the priority of the controllers throu...
Definition: sot.hh:57
std::list< sotEventAbstract * > TaskList
Definition: sequencer.hh:78
sotEventAbstract(const std::string &name)
Definition: sequencer.hh:68
dynamicgraph::SignalTimeDependent< int, int > triggerSOUT
Definition: sequencer.hh:100
virtual const std::string & getName() const
Definition: sequencer.hh:70
#define SOTSEQUENCER_EXPORT
Definition: sequencer.hh:42


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26