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 
50 namespace dynamicgraph {
51 namespace sot {
52 
53 /* --------------------------------------------------------------------- */
54 /* --- CLASS ----------------------------------------------------------- */
55 /* --------------------------------------------------------------------- */
56 
57 class Selector_EXPORT Selector : public Entity {
58  public:
59  DYNAMIC_GRAPH_ENTITY_DECL();
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__
dynamicgraph::sot::Selector
Definition: selector.h:57
dynamicgraph
Definition: exception-pg.h:47
dynamicgraph::sot::Selector::nbEntries
unsigned int nbEntries
Definition: selector.h:67
dynamicgraph::sot::Selector::nbSignals
unsigned int nbSignals
Definition: selector.h:64
dynamicgraph::sot::Selector::outputsSOUT
std::vector< SignalBase< int > * > outputsSOUT
Definition: selector.h:77
Selector_EXPORT
#define Selector_EXPORT
Definition: selector.h:47
dynamicgraph::sot::Selector::selectorSIN
SignalPtr< unsigned int, int > selectorSIN
Definition: selector.h:74
dynamicgraph::sot::Selector::inputsSIN
std::vector< std::vector< SignalBase< int > * > > inputsSIN
Definition: selector.h:76