Program listing for file control/src/Observer/Observer.hpp

Program listing for file control/src/Observer/Observer.hpp#

  1#ifndef Observer_H
  2#define Observer_H
  3
  4#include <string>
  5#include <set>
  6#include "SiconosException.hpp"
  7#include "SiconosPointers.hpp"
  8
  9#include "SiconosFwd.hpp"
 10
 11#include "SiconosAlgebraTypeDef.hpp"
 12#include "ControlTypeDef.hpp"
 13#include "SiconosControlFwd.hpp"
 14
 15
 16
 17class Observer
 18{
 19protected:
 20
 21  ACCEPT_SERIALIZATION(Observer);
 22
 23
 24  int _type;
 25
 26
 27  SP::DynamicalSystem _DS;
 28
 29
 30  SP::TimeDiscretisation _td;
 31
 32
 33  SP::ControlSensor _sensor;
 34
 35
 36  SP::SiconosVector _xHat;
 37
 38
 39  SP::SiconosVector _e;
 40
 41
 42  SP::SiconosVector _y;
 43
 44
 45  std::string _id;
 46
 47
 48
 49
 50
 51  SP::NonSmoothDynamicalSystem _nsds;
 52
 53
 54  SP::TimeStepping _simulation;
 55
 56
 57  SP::OneStepIntegrator _integrator;
 58
 59
 60  Observer();
 61
 62public:
 63
 64
 65  Observer(unsigned int type, SP::ControlSensor sensor, const SiconosVector& xHat0, const std::string& newId = "none");
 66
 67
 68  Observer(unsigned int type, SP::ControlSensor sensor, const SiconosVector& xHat0, SP::DynamicalSystem ds, const std::string& newId = "none");
 69
 70
 71  virtual ~Observer();
 72
 73
 74  inline void setId(const std::string& newId)
 75  {
 76    _id = newId;
 77  };
 78
 79
 80  inline const std::string getId() const
 81  {
 82    return _id;
 83  };
 84
 85
 86  inline int getType() const
 87  {
 88    return _type;
 89  };
 90
 91
 92  virtual void setTimeDiscretisation(const TimeDiscretisation& td);
 93
 94
 95  virtual void initialize(const NonSmoothDynamicalSystem& nsds, const Simulation& s);
 96
 97
 98  virtual void process() = 0;
 99
100
101  void display() const;
102
103
104  inline SP::SiconosVector e()
105  {
106    return _e;
107  }
108
109
110  inline SP::SiconosVector xHat()
111  {
112    return _xHat;
113  }
114
115
116  inline void setDS(SP::DynamicalSystem ds)
117  {
118    _DS = ds;
119  }
120
121
122  virtual SP::NonSmoothDynamicalSystem getInternalNSDS() const { return _nsds; };
123
124};
125
126#endif