GCC Code Coverage Report


Directory: ./
File: include/sot/core/reader.hh
Date: 2024-11-13 12:35:17
Exec Total Coverage
Lines: 0 2 0.0%
Branches: 0 0 -%

Line Branch Exec Source
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;
57 using dynamicgraph::sot::Flags;
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;
77 DataType dataSet;
78 DataType::const_iterator currentData;
79 bool iteratorSet;
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__ */
96