Loading...
Searching...
No Matches
selector.h
Go to the documentation of this file.
1/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 * Copyright Projet JRL-Japan, 2007
3 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 *
5 * File: Selector.h
6 * Project: SOT
7 * Author: Nicolas Mansard
8 *
9 * Version control
10 * ===============
11 *
12 * $Id$
13 *
14 * Description
15 * ============
16 *
17 *
18 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
19
20#ifndef __SOT_Selector_H__
21#define __SOT_Selector_H__
22
23/* --------------------------------------------------------------------- */
24/* --- INCLUDE --------------------------------------------------------- */
25/* --------------------------------------------------------------------- */
26
27/* SOT */
28#include <dynamic-graph/entity.h>
29#include <dynamic-graph/signal-ptr.h>
30#include <dynamic-graph/signal-time-dependent.h>
31#include <sot/core/matrix-geometry.hh>
32
33/* STD */
34#include <string>
35
36/* --------------------------------------------------------------------- */
37/* --- API ------------------------------------------------------------- */
38/* --------------------------------------------------------------------- */
39
40#if defined(WIN32)
41#if defined(selector_EXPORTS)
42#define Selector_EXPORT __declspec(dllexport)
43#else
44#define Selector_EXPORT __declspec(dllimport)
45#endif
46#else
47#define Selector_EXPORT
48#endif
49
50namespace dynamicgraph {
51namespace sot {
52
53/* --------------------------------------------------------------------- */
54/* --- CLASS ----------------------------------------------------------- */
55/* --------------------------------------------------------------------- */
56
57class Selector_EXPORT Selector : public Entity {
58 public:
60
61 protected:
64 unsigned int nbSignals;
67 unsigned int nbEntries;
68
69 public: /* --- CONSTRUCTION --- */
70 Selector(const std::string &name);
71 virtual ~Selector(void);
72
73 public: /* --- SIGNAL --- */
74 SignalPtr<unsigned int, int> selectorSIN;
75
76 std::vector<std::vector<SignalBase<int> *> > inputsSIN;
77 std::vector<SignalBase<int> *> outputsSOUT;
78
79 public: /* --- FUNCTIONS --- */
80 template <class T>
81 static T &computeSelection(const unsigned int &sigNum,
82 std::vector<SignalBase<int> *> &entriesSIN, T &res,
83 const int &time);
84
85 template <class T>
86 unsigned int createSignal(const std::string &shortname,
87 const int &sigId = -1);
88
89 void resetSignals(const unsigned int &nbEntries,
90 const unsigned int &nbSignals);
91
92 public: /* --- PARAMS --- */
93 void initCommands(void);
94 virtual void commandLine(const std::string &cmdLine,
95 std::istringstream &cmdArgs, std::ostream &os);
96
97 void create(const std::string &name, const std::string &type,
98 const int &sigId);
99 std::string getTypeList(void);
100 void getTypeList(std::ostream &os);
101};
102
103} // namespace sot
104} // namespace dynamicgraph
105
106#endif // #ifndef __SOT_Selector_H__
Definition: selector.h:57
std::vector< std::vector< SignalBase< int > * > > inputsSIN
Definition: selector.h:76
virtual void commandLine(const std::string &cmdLine, std::istringstream &cmdArgs, std::ostream &os)
std::vector< SignalBase< int > * > outputsSOUT
Definition: selector.h:77
SignalPtr< unsigned int, int > selectorSIN
Definition: selector.h:74
static T & computeSelection(const unsigned int &sigNum, std::vector< SignalBase< int > * > &entriesSIN, T &res, const int &time)
unsigned int nbSignals
Definition: selector.h:64
void resetSignals(const unsigned int &nbEntries, const unsigned int &nbSignals)
unsigned int nbEntries
Definition: selector.h:67
std::string getTypeList(void)
void create(const std::string &name, const std::string &type, const int &sigId)
void getTypeList(std::ostream &os)
unsigned int createSignal(const std::string &shortname, const int &sigId=-1)
Selector(const std::string &name)
Definition: exception-pg.h:47
#define Selector_EXPORT
Definition: selector.h:47