iCub-main
ScaleTransformer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2011 RobotCub Consortium, European Commission FP6 Project IST-004370
3  * author: Arjan Gijsberts
4  * email: arjan.gijsberts@iit.it
5  * website: www.robotcub.org
6  * Permission is granted to copy, distribute, and/or modify this program
7  * under the terms of the GNU General Public License, version 2 or any
8  * later version published by the Free Software Foundation.
9  *
10  * A copy of the license can be found at
11  * http://www.robotcub.org/icub/license/gpl.txt
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details
17  */
18 
19 #ifndef LM_SCALETRANSFORMER__
20 #define LM_SCALETRANSFORMER__
21 
22 #include <vector>
23 
26 
27 namespace iCub {
28 namespace learningmachine {
29 
47 protected:
51  std::vector<IScaler*> scalers;
52 
56  void deleteAll();
57 
63  void deleteAll(int size);
64 
71  void setAt(int index, std::string type);
72 
79  IScaler* getAt(int index);
80 
84  void setAll(std::string type);
85 
86  /*
87  * Inherited from ITransformer.
88  */
89  virtual void writeBottle(yarp::os::Bottle& bot);
90 
91  /*
92  * Inherited from ITransformer.
93  */
94  virtual void readBottle(yarp::os::Bottle& bot);
95 
96 public:
102  ScaleTransformer(unsigned int dom = 1);
103 
107  ScaleTransformer(const ScaleTransformer& other);
108 
112  virtual ~ScaleTransformer();
113 
118 
119  /*
120  * Inherited from ITransformer.
121  */
122  virtual ScaleTransformer* clone() {
123  return new ScaleTransformer(*this);
124  }
125 
126  /*
127  * Inherited from ITransformer.
128  */
129  virtual yarp::sig::Vector transform(const yarp::sig::Vector& input);
130 
131  /*
132  * Inherited from ITransformer.
133  */
134  virtual std::string getInfo();
135 
136  /*
137  * Inherited from ITransformer.
138  */
139  virtual std::string getConfigHelp();
140 
141  /*
142  * Inherited from ITransformer.
143  */
144  virtual void setDomainSize(unsigned int size);
145 
146  /*
147  * Inherited from ITransformer.
148  */
149  virtual void setCoDomainSize(unsigned int size);
150 
151  /*
152  * Inherited from ITransformer.
153  */
154  virtual void reset();
155 
156  /*
157  * Inherited from ITransformer.
158  */
159  virtual bool configure(yarp::os::Searchable &config);
160 
161 protected:
162 
163 };
164 
165 } // learningmachine
166 } // iCub
167 
168 #endif
An generalized interface for an ITransformer with a fixed domain and codomain size.
The IScaler is a linear scaler based scaler.
Definition: IScaler.h:41
The ScaleTransformer is a ITransformer that supports element-based scaling transformations.
virtual void setDomainSize(unsigned int size)
Mutator for the domain size.
IScaler * getAt(int index)
Returns a pointer to the scaler at a certain position.
virtual std::string getConfigHelp()
Asks the transformer to return a string containing the list of configuration options that it supports...
virtual bool configure(yarp::os::Searchable &config)
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a transformer from a bottle.
ScaleTransformer(unsigned int dom=1)
Constructor.
virtual void writeBottle(yarp::os::Bottle &bot)
std::vector< IScaler * > scalers
The vector of IScaler objects.
virtual yarp::sig::Vector transform(const yarp::sig::Vector &input)
Transforms an input vector.
void setAt(int index, std::string type)
Sets the scaler at a certain position to a given type.
void setAll(std::string type)
Sets all scalers to a given type.
virtual void reset()
Forget everything and start over.
virtual void setCoDomainSize(unsigned int size)
Mutator for the codomain size.
virtual ScaleTransformer * clone()
Asks the transformer to return a new object of its type.
ScaleTransformer & operator=(const ScaleTransformer &other)
Assignment operator.
void deleteAll()
Resets the vector of scalers and deletes each element.
virtual std::string getInfo()
Asks the transformer to return a string containing statistics on its operation so far.
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.