#include <keyvalue/mngt/Command.h>
Public Member Functions | |
virtual const char * | getCommandName () const =0 |
Gets Command's name. | |
virtual const char * | getName () const =0 |
Gets Processor's name. | |
virtual value::Result | getResult (const DataSet &data) const =0 |
Gets result of processing a DataSet. |
Command interface.
A Processor able to process an empty DataSet might be a Command.
For instance, if the Processor is Builder<OutputType>, for some ObjectType, then Builder<OutputType>::getObject(const DataSet& data) might do its job ignoring data. Another way is when the method does look up values in an empty data but, failing to find any, can still do its job considering default values for the searched keys (with or without intervention of DataSet Default).
In either cases above, the Builder<OutputType> might be declared as a command by public
ly deriving from this class
. Similar arguments hold for a Calculator<Tag>. The public
derivation can be done directly but the use of DeclareBuilder.h or DeclareCalculator.h are preferable. (See Builder and Calculator for details.)
When a Processor is a Command some front-ends might take advantage of this fact and provide to their users some shortcut or menu entry to call the Processor without asking for additional user's input.
virtual const char* getCommandName | ( | ) | const [pure virtual] |
Gets Command's name.
virtual const char* getName | ( | ) | const [pure virtual, inherited] |
Gets Processor's name.
Implemented in Builder< ObjectType >, and Calculator< Tag >.
virtual value::Result getResult | ( | const DataSet & | data | ) | const [pure virtual, inherited] |
Gets result of processing a DataSet.
This is a low level method which bypasses the memoization technique implemented by DataSet (see DataSet::mustUpdate()). Therefore, if processor is a Processor and data is a DataSet, then rather than
processor.getResult(data);
one should use
data.process(processor);
Actually, the latter calls the former adding memoization support.
data | : DataSet to be processed. |
Implemented in Builder< ObjectType >, and Calculator< Tag >.