GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/sot/core/sequencer.hh Lines: 0 2 0.0 %
Date: 2023-03-13 12:09:37 Branches: 0 0 - %

Line Branch Exec Source
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 */
18
#include <dynamic-graph/linear-algebra.h>
19
20
/* SOT */
21
#include <dynamic-graph/all-signals.h>
22
#include <dynamic-graph/entity.h>
23
24
#include <sot/core/task-abstract.hh>
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
54
class SOTSEQUENCER_EXPORT Sequencer : public dynamicgraph::Entity {
55
  DYNAMIC_GRAPH_ENTITY_DECL();
56
57
 public:
58
  class sotEventAbstract {
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:
77
  Sot *sotPtr;
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; /*! if true, display nothing standard output on except errors*/
88
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 --- */
100
  dynamicgraph::SignalTimeDependent<int, int> triggerSOUT;
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__