launcher::core::PlastCmd Class Reference

High level ICommand implementation for launching PLAST algorithm. More...

#include <PlastCmd.hpp>

Inheritance diagram for launcher::core::PlastCmd:

Public Member Functions

 PlastCmd (dp::IProperties *properties)
virtual ~PlastCmd ()
void execute ()
void cancel ()
void update (dp::EventInfo *evt, dp::ISubject *subject)
bool isRunning ()
dp::IPropertiesgetProperties ()
- Public Member Functions inherited from dp::SmartPointer
virtual void use ()
virtual void forget ()
- Public Member Functions inherited from dp::impl::Subject
 Subject ()
 Subject (const InterfaceId &interface)
virtual ~Subject ()
InterfaceId getInterface ()
void addObserver (IObserver *observer)
void removeObserver (IObserver *observer)
void notify (EventInfo *event)
- Public Member Functions inherited from dp::ISubject
virtual ~ISubject ()
- Public Member Functions inherited from dp::IObserver
virtual ~IObserver ()

Additional Inherited Members

- Protected Member Functions inherited from dp::SmartPointer
 SmartPointer ()
virtual ~SmartPointer ()

Detailed Description

High level ICommand implementation for launching PLAST algorithm.

This class is mainly a ICommand that runs PLAST for a given set of arguments (provided as a IProperties instance).

So, running PLAST should be as simple as running such an instance.

Moreover, the PlastCmd is both an Observer and a Subject.

It is an Observer by receiving notifications from the inner parts of the algorithm. On such receptions, the PlastCmd instance only forward the notification (as a Subject). This mechanism is useful for externalizing some inner notifications to the world outside PLAST (see JNI implementation for instance).

It is a also a Subject for some specific observers (see method configureObservers) that are systematically attached to it for gathering information about the execution of the algorithm itself. For instance, the BargraphObserver is an observer attached to PlastCmd in order to receive information about the percentage of execution, which allows to display some bargraph to the end user for having an idea of the remaining execution time. Other observers gather other kind of information for dumping statistical information about the found alignments.

We can see there the power of the Observer Design Pattern. The algorithm sends notifications about its inner state, but doesn't know at all for instance that it will be used for displaying a bargraph.

Note that a PlastCmd can be stopped by calling cancel. As a result, the inner parts of the algorithm should stop as soon as possible (and possibly in a clean fashion).

// we create a IProperties instance holding the subject and query databases URIs
IProperties* props = new Properties ();
props->add (0, "-d", "/databases/HalobacteriumSalinarum.fa");
props->add (0, "-i", "/databases/query.fa");
props->add (0, "-o", "/tmp/plast.out");
props->add (0, "-a", "1");
// We create the PLAST command with the arguments above
ICommand* cmd = new PlastCmd (props);
// We launch the request through some dispatcher.
SerialCommandDispatcher().dispatchCommand (cmd);
See also

Constructor & Destructor Documentation

launcher::core::PlastCmd::PlastCmd ( dp::IProperties properties)


[in]properties: configuration for the PLAST command
launcher::core::PlastCmd::~PlastCmd ( )


Member Function Documentation

void launcher::core::PlastCmd::cancel ( )

Cancel the command.

void launcher::core::PlastCmd::execute ( void  )

Method that executes some job.

Implements dp::ICommand.

dp::IProperties* launcher::core::PlastCmd::getProperties ( )

Returns the properties of the command

the command properties.
bool launcher::core::PlastCmd::isRunning ( )

Tells whether the command is finished or not.

true if the command is finished, false otherwise.
void launcher::core::PlastCmd::update ( dp::EventInfo evt,
dp::ISubject subject 

Method called by Subject for some notification.

[in]evt: specific information related to the notification.
[in]subject: the subject (ie. the caller of the 'update' method).

Implements dp::IObserver.

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