sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
reader.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_TRACER_H__
11 #define __SOT_TRACER_H__
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* Matrix */
18 #include <dynamic-graph/linear-algebra.h>
19 
20 /* STD */
21 #include <boost/function.hpp>
22 #include <fstream>
23 #include <list>
24 #include <string>
25 #include <vector>
26 
27 /* SOT & DG*/
28 #include <dynamic-graph/entity.h>
29 #include <dynamic-graph/exception-traces.h>
30 #include <dynamic-graph/signal-base.h>
31 #include <dynamic-graph/signal-ptr.h>
32 #include <dynamic-graph/signal-time-dependent.h>
33 
34 #include <sot/core/flags.hh>
35 
36 /* --------------------------------------------------------------------- */
37 /* --- API ------------------------------------------------------------- */
38 /* --------------------------------------------------------------------- */
39 
40 #if defined(WIN32)
41 #if defined(reader_EXPORTS)
42 #define SOTREADER_EXPORT __declspec(dllexport)
43 #else
44 #define SOTREADER_EXPORT __declspec(dllimport)
45 #endif
46 #else
47 #define SOTREADER_EXPORT
48 #endif
49 
50 /* --------------------------------------------------------------------- */
51 /* --- TRACER ---------------------------------------------------------- */
52 /* --------------------------------------------------------------------- */
53 
54 using dynamicgraph::Entity;
55 using dynamicgraph::SignalPtr;
56 using dynamicgraph::SignalTimeDependent;
58 
59 class SOTREADER_EXPORT sotReader : public Entity {
60  DYNAMIC_GRAPH_ENTITY_DECL();
61 
62  public:
63  SignalPtr<Flags, int> selectionSIN;
64  SignalTimeDependent<dynamicgraph::Vector, int> vectorSOUT;
65  SignalTimeDependent<dynamicgraph::Matrix, int> matrixSOUT;
66 
67  public:
68  sotReader(const std::string n);
69  virtual ~sotReader(void) {}
70 
71  void load(const std::string &filename);
72  void clear(void);
73  void rewind(void);
74 
75  protected:
76  typedef std::list<std::vector<double> > DataType;
78  DataType::const_iterator currentData;
80 
81  int rows, cols;
82 
83  dynamicgraph::Vector &getNextData(dynamicgraph::Vector &res,
84  const unsigned int time);
85  dynamicgraph::Matrix &getNextMatrix(dynamicgraph::Matrix &res,
86  const unsigned int time);
87  void resize(const int &nbRow, const int &nbCol);
88 
89  public:
90  /* --- PARAMS --- */
91  void display(std::ostream &os) const;
92  virtual void initCommands();
93 };
94 
95 #endif /* #ifndef __SOT_TRACER_H__ */
Definition: flags.hh:33
Definition: reader.hh:59
int cols
Definition: reader.hh:81
void clear(void)
void resize(const int &nbRow, const int &nbCol)
SignalTimeDependent< dynamicgraph::Matrix, int > matrixSOUT
Definition: reader.hh:65
void rewind(void)
sotReader(const std::string n)
SignalPtr< Flags, int > selectionSIN
Definition: reader.hh:63
SignalTimeDependent< dynamicgraph::Vector, int > vectorSOUT
Definition: reader.hh:64
DataType::const_iterator currentData
Definition: reader.hh:78
bool iteratorSet
Definition: reader.hh:79
std::list< std::vector< double > > DataType
Definition: reader.hh:76
virtual void initCommands()
DataType dataSet
Definition: reader.hh:77
void load(const std::string &filename)
dynamicgraph::Vector & getNextData(dynamicgraph::Vector &res, const unsigned int time)
dynamicgraph::Matrix & getNextMatrix(dynamicgraph::Matrix &res, const unsigned int time)
virtual ~sotReader(void)
Definition: reader.hh:69
void display(std::ostream &os) const
#define SOTREADER_EXPORT
Definition: reader.hh:47