MNE-CPP  0.1.9
A Framework for Electrophysiology
Signals | Public Member Functions | List of all members
COMMUNICATIONLIB::CommandManager Class Reference

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 (UTILSLIB::Subject *p_pSubject)
 
Commandoperator[] (const QString &key)
 
const Command operator[] (const QString &key) const
 
- Public Member Functions inherited from UTILSLIB::IObserver
virtual ~IObserver ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 36 of file commandmanager.h.

Inheritance diagram for COMMUNICATIONLIB::CommandManager:
Inheritance graph

Member Function Documentation

◆ clear()

void CommandManager::clear ( )

Clears the command manager

Definition at line 72 of file commandmanager.cpp.

◆ commandMap()

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

Returns the lookup table of all available commands.

Returns
the command lookup table.

Definition at line 184 of file commandmanager.h.

◆ hasCommand()

bool COMMUNICATIONLIB::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 191 of file commandmanager.h.

◆ insert() [1/3]

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 85 of file commandmanager.cpp.

◆ insert() [2/3]

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 117 of file commandmanager.cpp.

◆ insert() [3/3]

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 109 of file commandmanager.cpp.

◆ isActive()

bool COMMUNICATIONLIB::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 198 of file commandmanager.h.

◆ operator[]() [1/2]

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 165 of file commandmanager.cpp.

◆ operator[]() [2/2]

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 172 of file commandmanager.cpp.

◆ response

void COMMUNICATIONLIB::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

◆ setStatus()

void COMMUNICATIONLIB::CommandManager::setStatus ( bool  status)
inline

Sets the activation status of the CommandManager.

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

Definition at line 205 of file commandmanager.h.

◆ triggered

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

Is emitted when a command is ready to send

Parameters
p_commandCommand which should be send.

◆ update()

void CommandManager::update ( UTILSLIB::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 UTILSLIB::IObserver.

Definition at line 127 of file commandmanager.cpp.


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