iCub-main
TrainEvent.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2010 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 #include <sstream>
20 
22 
23 namespace iCub {
24 namespace learningmachine {
25 
26 TrainEvent::TrainEvent(const yarp::sig::Vector& input, const yarp::sig::Vector& desired, const Prediction& predicted) {
27  this->input = input;
28  this->desired = desired;
29  this->predicted = predicted;
30 }
31 
33  listener.handle(*this);
34 }
35 
36 std::string TrainEvent::toString() {
37  std::ostringstream buffer;
38  buffer << "Input: [" << this->input.toString() << "; " << "] Desired: [" << this->desired.toString() << "; " << "] Predicted: [" << this->predicted.toString() << "]";
39  return buffer.str();
40 }
41 
42 
43 } // learningmachine
44 } // iCub
virtual void handle(IEvent &e)
Default handler for any Event, which means the Event is ignored.
A class that represents a prediction result.
Definition: Prediction.h:44
std::string toString()
Returns a string represenation of the prediction.
Definition: Prediction.h:155
yarp::sig::Vector desired
Vector of desired outputs.
Definition: TrainEvent.h:54
std::string toString()
Returns a string representation of the Event.
Definition: TrainEvent.cpp:36
TrainEvent(const yarp::sig::Vector &input, const yarp::sig::Vector &desired, const Prediction &predicted)
Constructor.
Definition: TrainEvent.cpp:26
virtual void visit(IEventListener &listener)
Causes the Event to visit an EventListener.
Definition: TrainEvent.cpp:32
yarp::sig::Vector input
Vector of inputs.
Definition: TrainEvent.h:49
Prediction predicted
Predicted outputs.
Definition: TrainEvent.h:59
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.