27namespace learningmachine {
43 for(
unsigned int i = 0; i < other.
scalers.size(); i++) {
49 if(
this == &other)
return *
this;
51 this->IFixedSizeTransformer::operator=(other);
54 for(
unsigned int i = 0; i < other.
scalers.size(); i++) {
62 if (index >= 0 && index <
int(this->
scalers.size())) {
65 throw std::runtime_error(
"Index for scaler out of bounds!");
75 for(std::vector<IScaler*>::iterator it = this->
scalers.begin(); it != this->
scalers.end(); it++) {
84 if(index >= 0 && index <
int(this->
scalers.size())) {
89 throw std::runtime_error(
"Index for scaler out of bounds!");
95 for(
unsigned int i = 0; i < this->
scalers.size(); i++) {
102 assert(input.size() ==
int(this->scalers.size()));
103 assert(output.size() ==
int(this->scalers.size()));
105 for(
size_t i = 0; i < output.size(); i++) {
130 std::ostringstream buffer;
132 buffer <<
"Scalers:" << std::endl;
133 for(
unsigned int i = 0; i < this->
scalers.size(); i++) {
134 buffer <<
" [" << (i + 1) <<
"] ";
135 buffer << this->
scalers[i]->getInfo() << std::endl;
141 std::ostringstream buffer;
143 buffer <<
" type idx|all id Scaler type" << std::endl;
144 buffer <<
" config idx|all key v Set scaler configuration option" << std::endl;
166 this->
setAt(i, bot.pop().asString().c_str());
175 if(config.find(
"type").isList()) {
176 yarp::os::Bottle* scaleList = config.find(
"type").asList();
177 for(
int i = 0; i < scaleList->size(); i++) {
178 if(scaleList->get(i).isString()) {
179 this->
setAt(i, scaleList->get(i).asString().c_str());
187 if(!config.findGroup(
"type").isNull()) {
189 yarp::os::Bottle list = config.findGroup(
"type").tail();
190 if(list.get(0).isInt32() && list.get(1).isString()) {
192 this->
setAt(list.get(0).asInt32() - 1, list.get(1).asString().c_str());
194 }
else if(list.get(0).asString() ==
"all" && list.get(1).isString()) {
195 this->
setAll(list.get(1).asString().c_str());
201 if(!config.findGroup(
"config").isNull()) {
202 yarp::os::Bottle property;
203 yarp::os::Bottle list = config.findGroup(
"config").tail();
204 property.addList() = list.tail();
205 if(list.get(0).isInt32()) {
207 int i = list.get(0).asInt32() - 1;
209 }
else if(list.get(0).asString() ==
"all") {
211 for(
unsigned int i = 0; i < this->
scalers.size(); i++) {
static FactoryT< K, T > & instance()
An instance retrieval method that follows the Singleton pattern.
The IScaler is a linear scaler based scaler.
virtual std::string toString()
Asks the scaler to return a string serialization.
std::string getName() const
Retrieve the name of this scaler.
virtual double transform(double val)
Transforms a single sample value according to the state of the scaler.
virtual bool fromString(const std::string &str)
Asks the scaler to initialize from a string serialization.
virtual bool configure(yarp::os::Searchable &config)
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.