iCub-main
Loading...
Searching...
No Matches
Public Member Functions | List of all members
iCub::learningmachine::FileReaderT< T > Class Template Reference

Template class that supports reading lines of a file to object instances using a fromString(char* line) method (e.g. More...

#include <FileReaderT.h>

Public Member Functions

 FileReaderT ()
 Default constructor.
 
 ~FileReaderT ()
 Default destructor.
 
virtual void open (std::istream &s)
 Opens the given stream for reading.
 
virtual void open (const std::string &f)
 Opens a stream to the given filename for reading.
 
virtual bool hasNext ()
 Checks whether there are more items left in the stream.
 
virtual void reset ()
 Resets the stream to the beginning.
 
TgetNext ()
 Returns a pointer to the next item in the file.
 

Detailed Description

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

Template class that supports reading lines of a file to object instances using a fromString(char* line) method (e.g.

YARP Bottles).

Author
Arjan Gijsberts

Definition at line 37 of file FileReaderT.h.

Constructor & Destructor Documentation

◆ FileReaderT()

template<class T >
iCub::learningmachine::FileReaderT< T >::FileReaderT ( )
inline

Default constructor.

Definition at line 78 of file FileReaderT.h.

◆ ~FileReaderT()

template<class T >
iCub::learningmachine::FileReaderT< T >::~FileReaderT ( )
inline

Default destructor.

Definition at line 86 of file FileReaderT.h.

Member Function Documentation

◆ getNext()

template<class T >
T * iCub::learningmachine::FileReaderT< T >::getNext ( )
inline

Returns a pointer to the next item in the file.

Note that the caller takes responsibility for cleaning the memory space associated with the pointer.

Returns
a pointer to the new item
Exceptions
std::runtime_errorno open stream
std::runtime_errorend of stream

Definition at line 148 of file FileReaderT.h.

◆ hasNext()

template<class T >
virtual bool iCub::learningmachine::FileReaderT< T >::hasNext ( )
inlinevirtual

Checks whether there are more items left in the stream.

Returns
true if the stream has more items left
Exceptions
std::runtime_errorno open stream

Definition at line 123 of file FileReaderT.h.

◆ open() [1/2]

template<class T >
virtual void iCub::learningmachine::FileReaderT< T >::open ( const std::string &  f)
inlinevirtual

Opens a stream to the given filename for reading.

Parameters
fthe filename

Definition at line 105 of file FileReaderT.h.

◆ open() [2/2]

template<class T >
virtual void iCub::learningmachine::FileReaderT< T >::open ( std::istream &  s)
inlinevirtual

Opens the given stream for reading.

Parameters
sthe input stream

Definition at line 95 of file FileReaderT.h.

◆ reset()

template<class T >
virtual void iCub::learningmachine::FileReaderT< T >::reset ( )
inlinevirtual

Resets the stream to the beginning.

Note that this may not be possible for specific combinations of streams (e.g. stdin) and platforms.

Definition at line 134 of file FileReaderT.h.


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