sot-core  4.11.6
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 #include <sot/core/flags.hh>
34 
35 /* --------------------------------------------------------------------- */
36 /* --- API ------------------------------------------------------------- */
37 /* --------------------------------------------------------------------- */
38 
39 #if defined(WIN32)
40 #if defined(reader_EXPORTS)
41 #define SOTREADER_EXPORT __declspec(dllexport)
42 #else
43 #define SOTREADER_EXPORT __declspec(dllimport)
44 #endif
45 #else
46 #define SOTREADER_EXPORT
47 #endif
48 
49 /* --------------------------------------------------------------------- */
50 /* --- TRACER ---------------------------------------------------------- */
51 /* --------------------------------------------------------------------- */
52 
53 using dynamicgraph::Entity;
54 using dynamicgraph::SignalPtr;
55 using dynamicgraph::SignalTimeDependent;
57 
58 class SOTREADER_EXPORT sotReader : public Entity {
59  DYNAMIC_GRAPH_ENTITY_DECL();
60 
61 public:
62  SignalPtr<Flags, int> selectionSIN;
63  SignalTimeDependent<dynamicgraph::Vector, int> vectorSOUT;
64  SignalTimeDependent<dynamicgraph::Matrix, int> matrixSOUT;
65 
66 public:
67  sotReader(const std::string n);
68  virtual ~sotReader(void) {}
69 
70  void load(const std::string &filename);
71  void clear(void);
72  void rewind(void);
73 
74 protected:
75  typedef std::list<std::vector<double> > DataType;
77  DataType::const_iterator currentData;
79 
80  int rows, cols;
81 
82  dynamicgraph::Vector &getNextData(dynamicgraph::Vector &res,
83  const unsigned int time);
84  dynamicgraph::Matrix &getNextMatrix(dynamicgraph::Matrix &res,
85  const unsigned int time);
86  void resize(const int &nbRow, const int &nbCol);
87 
88 public:
89  /* --- PARAMS --- */
90  void display(std::ostream &os) const;
91  virtual void initCommands();
92 };
93 
94 #endif /* #ifndef __SOT_TRACER_H__ */
sotReader::rows
int rows
Definition: reader.hh:80
SOTREADER_EXPORT
#define SOTREADER_EXPORT
Definition: reader.hh:46
sotReader::selectionSIN
SignalPtr< Flags, int > selectionSIN
Definition: reader.hh:62
sotReader::~sotReader
virtual ~sotReader(void)
Definition: reader.hh:68
sotReader::iteratorSet
bool iteratorSet
Definition: reader.hh:78
sotReader::dataSet
DataType dataSet
Definition: reader.hh:76
sotReader::matrixSOUT
SignalTimeDependent< dynamicgraph::Matrix, int > matrixSOUT
Definition: reader.hh:64
sotReader::vectorSOUT
SignalTimeDependent< dynamicgraph::Vector, int > vectorSOUT
Definition: reader.hh:63
flags.hh
sotReader
Definition: reader.hh:58
sotReader::currentData
DataType::const_iterator currentData
Definition: reader.hh:77
dynamicgraph::sot::Flags
Definition: flags.hh:32
sotReader::DataType
std::list< std::vector< double > > DataType
Definition: reader.hh:75