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