iCub-main
Public Member Functions | List of all members
iCub::learningmachine::PortableT< T > Class Template Reference

A templated portable class intended to wrap abstract base classes. More...

#include <PortableT.h>

+ Inheritance diagram for iCub::learningmachine::PortableT< T >:

Public Member Functions

 PortableT (T *w=(T *) 0)
 Constructor. More...
 
 PortableT (std::string name)
 Constructor. More...
 
 PortableT (const PortableT< T > &other)
 Copy constructor. More...
 
virtual ~PortableT ()
 Destructor. More...
 
PortableT< T > & operator= (const PortableT< T > &other)
 Assignment operator. More...
 
bool write (yarp::os::ConnectionWriter &connection) const
 Writes a wrapped object to a connection. More...
 
bool read (yarp::os::ConnectionReader &connection)
 Reads a wrapped object from a connection. More...
 
bool writeToFile (std::string filename)
 Writes a wrapped object to a file. More...
 
bool readFromFile (std::string filename)
 Reads a wrapped object from a file. More...
 
bool hasWrapped () const
 Returns true iff if there is a wrapped object. More...
 
TgetWrapped () const
 The accessor for the wrapped object. More...
 
void setWrapped (T *w, bool wipe=true)
 The mutator for the wrapped object. More...
 
void setWrapped (std::string name, bool wipe=true)
 The mutator for the wrapped object. More...
 

Detailed Description

template<class T>
class iCub::learningmachine::PortableT< T >

A templated portable class intended to wrap abstract base classes.

This template depends on an associated FactoryT for the specified type.

See also
iCub::learningmachine::MachinePortable
iCub::learningmachine::TransformerPortable
Author
Arjan Gijsberts

Definition at line 47 of file PortableT.h.

Constructor & Destructor Documentation

◆ PortableT() [1/3]

template<class T >
iCub::learningmachine::PortableT< T >::PortableT ( T w = (T*) 0)
inline

Constructor.

Parameters
winitial wrapped object

Definition at line 60 of file PortableT.h.

◆ PortableT() [2/3]

template<class T >
iCub::learningmachine::PortableT< T >::PortableT ( std::string  name)
inline

Constructor.

Parameters
namename specifier of the wrapped object
Exceptions
runtimeerror if no object exists with the given key

Definition at line 68 of file PortableT.h.

◆ PortableT() [3/3]

template<class T >
iCub::learningmachine::PortableT< T >::PortableT ( const PortableT< T > &  other)
inline

Copy constructor.

Definition at line 75 of file PortableT.h.

◆ ~PortableT()

template<class T >
virtual iCub::learningmachine::PortableT< T >::~PortableT ( )
inlinevirtual

Destructor.

Definition at line 80 of file PortableT.h.

Member Function Documentation

◆ getWrapped()

template<class T >
T& iCub::learningmachine::PortableT< T >::getWrapped ( ) const
inline

The accessor for the wrapped object.

Returns
a reference to the wrapped object
Exceptions
runtimeerror if no wrapped object exists

Definition at line 215 of file PortableT.h.

◆ hasWrapped()

template<class T >
bool iCub::learningmachine::PortableT< T >::hasWrapped ( ) const
inline

Returns true iff if there is a wrapped object.

Returns
true iff there is a wrapped machine

Definition at line 205 of file PortableT.h.

◆ operator=()

template<class T >
PortableT<T>& iCub::learningmachine::PortableT< T >::operator= ( const PortableT< T > &  other)
inline

Assignment operator.

Definition at line 87 of file PortableT.h.

◆ read()

template<class T >
bool iCub::learningmachine::PortableT< T >::read ( yarp::os::ConnectionReader &  connection)
inline

Reads a wrapped object from a connection.

Parameters
connectionthe connection
Returns
true on success

Definition at line 128 of file PortableT.h.

◆ readFromFile()

template<class T >
bool iCub::learningmachine::PortableT< T >::readFromFile ( std::string  filename)
inline

Reads a wrapped object from a file.

Parameters
filenamethe filename
Returns
true on success

Definition at line 182 of file PortableT.h.

◆ setWrapped() [1/2]

template<class T >
void iCub::learningmachine::PortableT< T >::setWrapped ( std::string  name,
bool  wipe = true 
)
inline

The mutator for the wrapped object.

Parameters
nameThe name specifier for the wrapped object
wipeboolean whether the previous wrapped object has to be deleted

Definition at line 242 of file PortableT.h.

◆ setWrapped() [2/2]

template<class T >
void iCub::learningmachine::PortableT< T >::setWrapped ( T w,
bool  wipe = true 
)
inline

The mutator for the wrapped object.

Parameters
wa pointer to object to wrap
wipeboolean whether the previous wrapped object has to be deleted

Definition at line 228 of file PortableT.h.

◆ write()

template<class T >
bool iCub::learningmachine::PortableT< T >::write ( yarp::os::ConnectionWriter &  connection) const
inline

Writes a wrapped object to a connection.

Parameters
connectionthe connection
Returns
true on success

Definition at line 103 of file PortableT.h.

◆ writeToFile()

template<class T >
bool iCub::learningmachine::PortableT< T >::writeToFile ( std::string  filename)
inline

Writes a wrapped object to a file.

Parameters
filenamethe filename
Returns
true on success

Definition at line 161 of file PortableT.h.


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