MNE-CPP  beta 1.0
Signals | Public Member Functions | List of all members
RTCOMMANDLIB::CommandManager Class Reference
Inheritance diagram for RTCOMMANDLIB::CommandManager:
IObserver

Signals

void commandMapChanged ()
 
void triggered (Command p_command)
 
void response (QString p_sReply, Command p_command)
 

Public Member Functions

 CommandManager (bool p_bIsActive=true, QObject *parent=0)
 
 CommandManager (const QByteArray &p_qByteArrayJsonDoc, bool p_bIsActive=true, QObject *parent=0)
 
 CommandManager (const QJsonDocument &p_jsonDoc, bool p_bIsActive=true, QObject *parent=0)
 
void clear ()
 
QMap< QString, Command > & commandMap ()
 
bool hasCommand (const QString &p_sCommand) const
 
void insert (const QJsonDocument &p_jsonDocument)
 
void insert (const QString &p_sKey, const QString &p_sDescription)
 
void insert (const QString &p_sKey, const Command &p_command)
 
bool isActive () const
 
void setStatus (bool status)
 
virtual void update (Subject *p_pSubject)
 
Commandoperator[] (const QString &key)
 
const Command operator[] (const QString &key) const
 
- Public Member Functions inherited from IObserver
virtual ~IObserver ()
 

Additional Inherited Members

- Public Types inherited from IObserver
typedef QSharedPointer< IObserverSPtr
 
typedef QSharedPointer< const IObserverConstSPtr
 

Detailed Description

Definition at line 50 of file commandmanager.h.

Member Function Documentation

void CommandManager::clear ( )

Clears the command manager

Definition at line 85 of file commandmanager.cpp.

QMap< QString, Command > & RTCOMMANDLIB::CommandManager::commandMap ( )
inline

Returns the lookup table of all available commands.

Returns
the command lookup table

Definition at line 198 of file commandmanager.h.

bool RTCOMMANDLIB::CommandManager::hasCommand ( const QString &  p_sCommand) const
inline

Checks if a command is managed;

Parameters
p_sCommandCOmmand to check.
Returns
true if part of command manager, false otherwise

Definition at line 206 of file commandmanager.h.

void CommandManager::insert ( const QJsonDocument &  p_jsonDocument)

Inserts commands encoded in a json document. Attention existing items are overwritten.

Parameters
p_jsonDocumentJSON document containing commands.

Definition at line 101 of file commandmanager.cpp.

void CommandManager::insert ( const QString &  p_sKey,
const QString &  p_sDescription 
)

Inserts a single command. Attention existing items are overwritten.

Parameters
p_jsonDocumentJSON document containing commands.

Definition at line 126 of file commandmanager.cpp.

void CommandManager::insert ( const QString &  p_sKey,
const Command p_command 
)

Inserts a new command and emmits dataChanged signal.

Parameters
p_sKeyCommand key word.
p_commandCommand content. Attention CommandManager takes ownership of that command by reseting commad's parent;

Definition at line 135 of file commandmanager.cpp.

bool RTCOMMANDLIB::CommandManager::isActive ( ) const
inline

Returns if CommandManager is active. If true, this manager parses incomming commands.

Returns
if true, incomming commands are parsed.

Definition at line 214 of file commandmanager.h.

Command & CommandManager::operator[] ( const QString &  key)

Subscript operator [] to access commands by command name

Parameters
[in]keythe command key word.
Returns
Command object related to command key word.

Definition at line 185 of file commandmanager.cpp.

const Command CommandManager::operator[] ( const QString &  key) const

Subscript operator [] to access commands by command name

Parameters
keythe command key word.
Returns
Command object related to command key word.

Definition at line 193 of file commandmanager.cpp.

void RTCOMMANDLIB::CommandManager::response ( QString  p_sReply,
Command  p_command 
)
signal

Is triggered when a reply is available. Commands are the emmiters of this signal -> access trough parent.

Parameters
p_sReplythe plain or JSON formatted reply
p_commandCommand which send the response
void RTCOMMANDLIB::CommandManager::setStatus ( bool  status)
inline

Sets the activation status of the CommandManager.

Parameters
[in]statusthe new activation status of the CommandManager.

Definition at line 222 of file commandmanager.h.

void RTCOMMANDLIB::CommandManager::triggered ( Command  p_command)
signal

Is emitted when a command is ready to send

Parameters
p_commandCommand which should be send
void CommandManager::update ( Subject p_pSubject)
virtual

Updates the IObserver (CommandManager) when a new command was received.

Parameters
[in]p_pSubjectpointer to the subject (CommandParser) to which observer (CommandManager) is attached to.

Implements IObserver.

Definition at line 146 of file commandmanager.cpp.


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