solarpowerlog trunk
ICommand Class Reference

#include <ICommand.h>

Collaboration diagram for ICommand:

List of all members.

Public Member Functions

 ICommand (int command, ICommandTarget *target, std::map< std::string, boost::any > dat)
 ICommand (int command, ICommandTarget *target)
virtual ~ICommand ()
void execute ()
int getCmd () const
const boost::any findData (const std::string &key) const throw (std::invalid_argument)
void setCmd (int cmd)
void setTrgt (ICommandTarget *trgt)
void RemoveData (const std::string &key)
void addData (const std::string &key, const boost::any &data)
void mergeData (const ICommand &other)
void DumpData (ILogger &logger) const

Detailed Description

Encapsulates a command

See the command pattern for details....

Commands are used, for example, to schedule work, to check for completion, etc...

NOTE: The one that calls execute should delete the object afterwards!

Definition at line 69 of file ICommand.h.


Constructor & Destructor Documentation

ICommand::ICommand ( int  command,
ICommandTarget target,
std::map< std::string, boost::any >  dat 
)

Definition at line 40 of file ICommand.cpp.

ICommand::ICommand ( int  command,
ICommandTarget target 
)

Definition at line 49 of file ICommand.cpp.

ICommand::~ICommand ( ) [virtual]

Destructor, even for no need for destruction

Definition at line 56 of file ICommand.cpp.


Member Function Documentation

void ICommand::addData ( const std::string &  key,
const boost::any &  data 
) [inline]

Add/Replace Data from the Command

Add new data, or if the data is already existing, replace the data with the new one.

Definition at line 125 of file ICommand.h.

void ICommand::DumpData ( ILogger logger) const [inline]

Definition at line 136 of file ICommand.h.

void ICommand::execute ( )

Delegate the command to the one that should do the work

Definition at line 61 of file ICommand.cpp.

Here is the call graph for this function:

const boost::any ICommand::findData ( const std::string &  key) const throw (std::invalid_argument)

Find Data in Command

Returns the data associated in the map to the given key

param key to search for

Returns:
boost::any object with the data
Exceptions:
std::invalid_argument{ throws this if data is not existant. The data of the invalid_argument is the key which was not found }

Definition at line 73 of file ICommand.cpp.

int ICommand::getCmd ( ) const

Getter for the private cmd field (field is for Commandees use)

Definition at line 68 of file ICommand.cpp.

void ICommand::mergeData ( const ICommand other)

Definition at line 84 of file ICommand.cpp.

void ICommand::RemoveData ( const std::string &  key) [inline]

Remove Data from Command

Removes the named key from the data list of the command.

Note:
: As the underlaying storage is a std::map, the associated boost::any object will be deleted.

Definition at line 114 of file ICommand.h.

void ICommand::setCmd ( int  cmd) [inline]

Definition at line 98 of file ICommand.h.

void ICommand::setTrgt ( ICommandTarget trgt) [inline]

Definition at line 103 of file ICommand.h.


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