gatb.core-API-0.0.0
|
Framework abstract class for implementing tools (ie. binary tools). More...
#include <Tool.hpp>
Public Member Functions | |
Tool (const std::string &name) | |
virtual | ~Tool () |
std::string | getName () const |
virtual IProperties * | run (IProperties *input) |
virtual IProperties * | run (int argc, char *argv[]) |
virtual void | execute ()=0 |
virtual IProperties * | getInput () |
virtual IProperties * | getOutput () |
virtual IProperties * | getInfo () |
virtual IOptionsParser * | getParser () |
virtual dp::IDispatcher * | getDispatcher () |
virtual TimeInfo & | getTimeInfo () |
template<typename Item > | |
dp::Iterator< Item > * | createIterator (collections::Iterable< Item > &iterable, const char *message=0) |
template<typename Item > | |
dp::Iterator< Item > * | createIterator (dp::Iterator< Item > *iter, size_t nbIterations=0, const char *message=0) |
virtual dp::IteratorListener * | createIteratorListener (size_t nbIterations, const char *message) |
virtual void | displayVersion (std::ostream &os) |
Public Member Functions inherited from SmartPointer | |
void | use () |
void | forget () |
Public Member Functions inherited from ISmartPointer | |
virtual | ~ISmartPointer () |
Protected Member Functions | |
std::string | getUriByKey (const std::string &key) |
std::string | getUri (const std::string &str) |
void | setInput (IProperties *input) |
Protected Member Functions inherited from SmartPointer | |
SmartPointer () | |
virtual | ~SmartPointer () |
Protected Attributes | |
std::string | _name |
Framework abstract class for implementing tools (ie. binary tools).
This class provides facilities for:
The Tool sub classes must implement the execute method; this is the place where the actual job of the tool has to be done.
If the tool is launch with the run method and the famous [argc,argv] couple, the command line [argc,argv] is parsed through an options parser and the recognized options are available through the getInput method.
The option parser should be configured (ie. adding specific options) during the constructor of the Tool sub class. By default, some default options are attached to the Tool options parser; for instance :
A dispatcher is available with the getDispatcher method. This dispatcher may have been configured (ie. set the number of available cores) during the constructor.
Example:
Tool | ( | const std::string & | name | ) |
Constructor.
[in] | name | name of the tool. |
|
virtual |
Destructor.
|
inline |
Create an iterator for the given iterable. If the verbosity is enough, progress bar information can be displayed.
[in] | iterable | : object that creates the iterator. |
[in] | message | : message used if progress information has to be displayed |
|
inline |
Create an iterator for the given iterator. If the verbosity is enough, progress bar information can be displayed.
[in] | iter | : object to be encapsulated by a potential progress information |
[in] | nbIterations | : number of iterations to be done. |
[in] | message | : message used if progress information has to be displayed |
|
virtual |
Creates an iterator listener according to the verbosity level.
[in] | nbIterations | : number of iterations to be done |
[in] | message | : progression message |
|
virtual |
Displays information about the GATB library
[in] | os | : output stream used for dumping library information |
|
pure virtual |
Subclasses must implement this method; this is where the actual job of the tool has to be done.
|
inlinevirtual |
Get a dispatched that can be used for parallelization. The option "-nb-cores" can be used, and thus the provided number is used for configuring the dispatcher.
|
inlinevirtual |
Get statistics information about the execution of the tool
|
inlinevirtual |
Get the parsed options as a properties instance
|
inline |
Get tool name
|
inlinevirtual |
Get output results as a properties instance
|
inlinevirtual |
Get an option parser configured with recognized options for the tool
|
inlinevirtual |
|
inlineprotected |
Computes the uri from an uri (ie add a prefix if any).
|
inlineprotected |
Computes the uri from an uri (ie add a prefix if any).
|
virtual |
Run the tool with input parameters provided as a IProperties instance
[in] | input | : input parameters |
|
virtual |
Run the tool with input parameters provided as a couple [argc,argv]
[in] | argc | : number of arguments |
[in] | argv | : array of arguments |
|
inlineprotected |
Setters.
|
protected |
Name of the tool (set at construction).