iCub-main
Loading...
Searching...
No Matches
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.
 
virtual ~IMachineLearnerModule ()
 Destructor (empty).
 
virtual bool close ()
 Close the module.
 
virtual bool updateModule ()
 Default empty update loop with 1 second delay.
 

Protected Member Functions

 IMachineLearnerModule (const IMachineLearnerModule &other)
 Copy Constructor (private and unimplemented on purpose).
 
IMachineLearnerModuleoperator= (const IMachineLearnerModule &other)
 Assignment operator (private and unimplemented on purpose).
 
void registerPort (yarp::os::Contactable &port, std::string name)
 Register a port with a given name.
 
virtual void registerAllPorts ()=0
 Registers all ports used by this module.
 
virtual void unregisterAllPorts ()=0
 Unregisters all ports used by this module.
 
virtual void printOptions (std::string error="")=0
 Prints the accepted command line options with an optional error message.
 
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.
 
virtual yarp::os::ResourceFinder & getResourceFinder ()
 Returns a reference to the cached ResourceFinder.
 
std::string findFile (std::string fname)
 Finds the full path to a specified filename using the ResourceFinder.
 
virtual void setResourceFinder (yarp::os::ResourceFinder *rf)
 Mutator for the locally stored ResourceFinder.
 

Protected Attributes

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

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 ( )
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: