sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
time-stamp.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_TIME_STAMP__HH
11 #define __SOT_TIME_STAMP__HH
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* Matrix */
18 #include <dynamic-graph/linear-algebra.h>
19 
20 /* Classes standards. */
21 #ifndef WIN32
22 #include <sys/time.h>
23 #else /*WIN32*/
25 #endif /*WIN32*/
26 
27 /* SOT */
28 #include <dynamic-graph/all-signals.h>
29 #include <dynamic-graph/entity.h>
30 
31 #include <sot/core/debug.hh>
32 
33 /* --------------------------------------------------------------------- */
34 /* --- API ------------------------------------------------------------- */
35 /* --------------------------------------------------------------------- */
36 
37 #if defined(WIN32)
38 #if defined(time_stamp_EXPORTS)
39 #define TimeStamp_EXPORT __declspec(dllexport)
40 #else
41 #define TimeStamp_EXPORT __declspec(dllimport)
42 #endif
43 #else
44 #define TimeStamp_EXPORT
45 #endif
46 
47 /* --------------------------------------------------------------------- */
48 /* --- CLASS ----------------------------------------------------------- */
49 /* --------------------------------------------------------------------- */
50 
51 namespace dynamicgraph {
52 namespace sot {
53 
54 class TimeStamp_EXPORT TimeStamp : public dynamicgraph::Entity {
55  public:
56  static const std::string CLASS_NAME;
57  virtual const std::string &getClassName(void) const { return CLASS_NAME; }
58 
59  protected:
60  struct timeval val;
61  unsigned int offsetValue;
62  bool offsetSet;
63 
64  public:
65  /* --- CONSTRUCTION --- */
66  TimeStamp(const std::string &name);
67 
68  public: /* --- DISPLAY --- */
69  virtual void display(std::ostream &os) const;
70 
71  public: /* --- SIGNALS --- */
72  /* These signals can be called several time per period, given
73  * each time a different results. Useful for chronos. */
74  dynamicgraph::Signal<dynamicgraph::Vector, int> timeSOUT;
75  dynamicgraph::Signal<double, int> timeDoubleSOUT;
76 
77  /* These signals can be called several time per period, but give
78  * always the same results different results. Useful for synchro. */
79  dynamicgraph::SignalTimeDependent<dynamicgraph::Vector, int> timeOnceSOUT;
80  dynamicgraph::SignalTimeDependent<double, int> timeOnceDoubleSOUT;
81 
82  protected: /* --- SIGNAL FUNCTIONS --- */
83  dynamicgraph::Vector &getTimeStamp(dynamicgraph::Vector &res,
84  const int &time);
85  double &getTimeStampDouble(const dynamicgraph::Vector &vect, double &res);
86 };
87 
88 } /* namespace sot */
89 } /* namespace dynamicgraph */
90 
91 #endif /* #ifndef __SOT_SOT_HH */
Definition: time-stamp.hh:54
virtual void display(std::ostream &os) const
dynamicgraph::Signal< dynamicgraph::Vector, int > timeSOUT
Definition: time-stamp.hh:74
unsigned int offsetValue
Definition: time-stamp.hh:61
double & getTimeStampDouble(const dynamicgraph::Vector &vect, double &res)
bool offsetSet
Definition: time-stamp.hh:62
virtual const std::string & getClassName(void) const
Definition: time-stamp.hh:57
dynamicgraph::SignalTimeDependent< double, int > timeOnceDoubleSOUT
Definition: time-stamp.hh:80
dynamicgraph::Vector & getTimeStamp(dynamicgraph::Vector &res, const int &time)
dynamicgraph::Signal< double, int > timeDoubleSOUT
Definition: time-stamp.hh:75
static const std::string CLASS_NAME
Definition: time-stamp.hh:56
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > timeOnceSOUT
Definition: time-stamp.hh:79
TimeStamp(const std::string &name)
Definition: abstract-sot-external-interface.hh:17
#define TimeStamp_EXPORT
Definition: time-stamp.hh:44