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
32#include <sot/core/matrix-geometry.hh>
33
34/* STD */
35#include <string>
36
37/* --------------------------------------------------------------------- */
38/* --- API ------------------------------------------------------------- */
39/* --------------------------------------------------------------------- */
40
41#if defined(WIN32)
42#if defined(selector_EXPORTS)
43#define Selector_EXPORT __declspec(dllexport)
44#else
45#define Selector_EXPORT __declspec(dllimport)
46#endif
47#else
48#define Selector_EXPORT
49#endif
50
51namespace dynamicgraph {
52namespace sot {
53
54/* --------------------------------------------------------------------- */
55/* --- CLASS ----------------------------------------------------------- */
56/* --------------------------------------------------------------------- */
57
58class Selector_EXPORT Selector : public Entity {
59 public:
61
62 protected:
65 unsigned int nbSignals;
68 unsigned int nbEntries;
69
70 public: /* --- CONSTRUCTION --- */
71 Selector(const std::string &name);
72 virtual ~Selector(void);
73
74 public: /* --- SIGNAL --- */
75 SignalPtr<unsigned int, int> selectorSIN;
76
77 std::vector<std::vector<SignalBase<int> *> > inputsSIN;
78 std::vector<SignalBase<int> *> outputsSOUT;
79
80 public: /* --- FUNCTIONS --- */
81 template <class T>
82 static T &computeSelection(const unsigned int &sigNum,
83 std::vector<SignalBase<int> *> &entriesSIN, T &res,
84 const int &time);
85
86 template <class T>
87 unsigned int createSignal(const std::string &shortname,
88 const int &sigId = -1);
89
90 void resetSignals(const unsigned int &nbEntries,
91 const unsigned int &nbSignals);
92
93 public: /* --- PARAMS --- */
94 void initCommands(void);
95 virtual void commandLine(const std::string &cmdLine,
96 std::istringstream &cmdArgs, std::ostream &os);
97
98 void create(const std::string &name, const std::string &type,
99 const int &sigId);
100 std::string getTypeList(void);
101 void getTypeList(std::ostream &os);
102};
103
104} // namespace sot
105} // namespace dynamicgraph
106
107#endif // #ifndef __SOT_Selector_H__
Definition selector.h:58
std::vector< std::vector< SignalBase< int > * > > inputsSIN
Definition selector.h:77
virtual void commandLine(const std::string &cmdLine, std::istringstream &cmdArgs, std::ostream &os)
std::vector< SignalBase< int > * > outputsSOUT
Definition selector.h:78
SignalPtr< unsigned int, int > selectorSIN
Definition selector.h:75
static T & computeSelection(const unsigned int &sigNum, std::vector< SignalBase< int > * > &entriesSIN, T &res, const int &time)
unsigned int nbSignals
Definition selector.h:65
void resetSignals(const unsigned int &nbEntries, const unsigned int &nbSignals)
unsigned int nbEntries
Definition selector.h:68
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:48