iCub-main
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iCub::learningmachine::IMachineLearnerModule Class Referenceabstract

An abstract base module for the machine learning YARP interface. More...

#include <IMachineLearnerModule.h>

+ Inheritance diagram for iCub::learningmachine::IMachineLearnerModule:

Public Member Functions

 IMachineLearnerModule (std::string pp)
 Constructor. More...
 
virtual ~IMachineLearnerModule ()
 Destructor (empty). More...
 
virtual bool close ()
 Close the module. More...
 
virtual bool updateModule ()
 Default empty update loop with 1 second delay. More...
 

Protected Member Functions

 IMachineLearnerModule (const IMachineLearnerModule &other)
 Copy Constructor (private and unimplemented on purpose). More...
 
IMachineLearnerModuleoperator= (const IMachineLearnerModule &other)
 Assignment operator (private and unimplemented on purpose). More...
 
void registerPort (yarp::os::Contactable &port, std::string name)
 Register a port with a given name. More...
 
virtual void registerAllPorts ()=0
 Registers all ports used by this module. More...
 
virtual void unregisterAllPorts ()=0
 Unregisters all ports used by this module. More...
 
virtual void printOptions (std::string error="")=0
 Prints the accepted command line options with an optional error message. More...
 
virtual void loadCommandFile (std::string fname, yarp::os::Bottle *out=(yarp::os::Bottle *) 0)
 Reads bottles from a file and sends these one by one to the respond method. More...
 
virtual yarp::os::ResourceFinder & getResourceFinder ()
 Returns a reference to the cached ResourceFinder. More...
 
std::string findFile (std::string fname)
 Finds the full path to a specified filename using the ResourceFinder. More...
 
virtual void setResourceFinder (yarp::os::ResourceFinder *rf)
 Mutator for the locally stored ResourceFinder. More...
 

Protected Attributes

yarp::os::Port cmd_in
 An input port for commands. More...
 
std::string portPrefix
 A prefix path for the ports that will be registered. More...
 
DispatcherManager dmanager
 An instance of the DispatchManager to configure event listeners. More...
 
yarp::os::ResourceFinder * rf
 A pointer to the ResourceFinder. More...
 

Detailed Description

An abstract base module for the machine learning YARP interface.

This abstract class contains base functionality that is shared by PredictModule, TrainModule and TransformModule.

See also
iCub::learningmachine::IMachineLearner
iCub::learningmachine::TrainModule
iCub::learningmachine::PredictModule
iCub::learningmachine::TransformerModule
Author
Arjan Gijsberts

Definition at line 59 of file IMachineLearnerModule.h.

Constructor & Destructor Documentation

◆ IMachineLearnerModule() [1/2]

iCub::learningmachine::IMachineLearnerModule::IMachineLearnerModule ( const IMachineLearnerModule other)
protected

Copy Constructor (private and unimplemented on purpose).

◆ IMachineLearnerModule() [2/2]

iCub::learningmachine::IMachineLearnerModule::IMachineLearnerModule ( std::string  pp)
inline

Constructor.

Parameters
ppthe default prefix used for the ports.

Definition at line 163 of file IMachineLearnerModule.h.

◆ ~IMachineLearnerModule()

virtual iCub::learningmachine::IMachineLearnerModule::~IMachineLearnerModule ( )
inlinevirtual

Destructor (empty).

Definition at line 168 of file IMachineLearnerModule.h.

Member Function Documentation

◆ close()

bool iCub::learningmachine::IMachineLearnerModule::close ( void  )
virtual

Close the module.

Returns
true if the module was closed successfully

Reimplemented in iCub::learningmachine::PredictModule.

Definition at line 39 of file IMachineLearnerModule.cpp.

◆ findFile()

std::string iCub::learningmachine::IMachineLearnerModule::findFile ( std::string  fname)
protected

Finds the full path to a specified filename using the ResourceFinder.

This method is necessary to work around the limitation of ResourceFinder to only work with registered keys instead of directly with filenames.

Parameters
fnamethe filename
Returns
the full path
Exceptions
std::runtime_errorif the file cannot be located

Definition at line 44 of file IMachineLearnerModule.cpp.

◆ getResourceFinder()

virtual yarp::os::ResourceFinder& iCub::learningmachine::IMachineLearnerModule::getResourceFinder ( )
inlineprotectedvirtual

Returns a reference to the cached ResourceFinder.

Returns
a reference to a ResourceFinder
Exceptions
std::runtime_errorif there is no cached ResourceFinder

Definition at line 129 of file IMachineLearnerModule.h.

◆ loadCommandFile()

void iCub::learningmachine::IMachineLearnerModule::loadCommandFile ( std::string  fname,
yarp::os::Bottle *  out = (yarp::os::Bottle*) 0 
)
protectedvirtual

Reads bottles from a file and sends these one by one to the respond method.

Parameters
fnamethe filename
outan optional Bottle to which the replies will be appended

Definition at line 68 of file IMachineLearnerModule.cpp.

◆ operator=()

IMachineLearnerModule& iCub::learningmachine::IMachineLearnerModule::operator= ( const IMachineLearnerModule other)
protected

Assignment operator (private and unimplemented on purpose).

◆ printOptions()

virtual void iCub::learningmachine::IMachineLearnerModule::printOptions ( std::string  error = "")
protectedpure virtual

Prints the accepted command line options with an optional error message.

Implemented in iCub::learningmachine::PredictModule.

◆ registerAllPorts()

virtual void iCub::learningmachine::IMachineLearnerModule::registerAllPorts ( )
protectedpure virtual

Registers all ports used by this module.

Implemented in iCub::learningmachine::PredictModule.

◆ registerPort()

void iCub::learningmachine::IMachineLearnerModule::registerPort ( yarp::os::Contactable &  port,
std::string  name 
)
protected

Register a port with a given name.

Parameters
portthe port object
namethe name for the port

Definition at line 30 of file IMachineLearnerModule.cpp.

◆ setResourceFinder()

virtual void iCub::learningmachine::IMachineLearnerModule::setResourceFinder ( yarp::os::ResourceFinder *  rf)
inlineprotectedvirtual

Mutator for the locally stored ResourceFinder.

The module does not take responsibility for the allocated memory.

Parameters
rfa pointer to a ResourceFinder

Definition at line 153 of file IMachineLearnerModule.h.

◆ unregisterAllPorts()

virtual void iCub::learningmachine::IMachineLearnerModule::unregisterAllPorts ( )
protectedpure virtual

Unregisters all ports used by this module.

Implemented in iCub::learningmachine::PredictModule.

◆ updateModule()

virtual bool iCub::learningmachine::IMachineLearnerModule::updateModule ( )
inlinevirtual

Default empty update loop with 1 second delay.

Definition at line 180 of file IMachineLearnerModule.h.

Member Data Documentation

◆ cmd_in

yarp::os::Port iCub::learningmachine::IMachineLearnerModule::cmd_in
protected

An input port for commands.

Definition at line 64 of file IMachineLearnerModule.h.

◆ dmanager

DispatcherManager iCub::learningmachine::IMachineLearnerModule::dmanager
protected

An instance of the DispatchManager to configure event listeners.

Definition at line 74 of file IMachineLearnerModule.h.

◆ portPrefix

std::string iCub::learningmachine::IMachineLearnerModule::portPrefix
protected

A prefix path for the ports that will be registered.

Definition at line 69 of file IMachineLearnerModule.h.

◆ rf

yarp::os::ResourceFinder* iCub::learningmachine::IMachineLearnerModule::rf
protected

A pointer to the ResourceFinder.

Definition at line 79 of file IMachineLearnerModule.h.


The documentation for this class was generated from the following files: