Named, parameterised command exchanged with mne_rt_server; supports both JSON and CLI serialisation.
More...
#include <command.h>
Public Types | |
| typedef QSharedPointer< Command > | SPtr |
| typedef QSharedPointer< const Command > | ConstSPtr |
| Public Types inherited from UTILSLIB::ICommand | |
| typedef QSharedPointer< ICommand > | SPtr |
| typedef QSharedPointer< const ICommand > | ConstSPtr |
Signals | |
| void | executed (Command p_command) |
Public Member Functions | |
| Command (bool p_bIsJson=true, QObject *parent=0) | |
| Command (const QString &p_sCommand, const QJsonObject &p_qCommandContent, bool p_bIsJson=true, QObject *parent=0) | |
| Command (const QString &p_sCommand, const QString &p_sDescription, bool p_bIsJson=true, QObject *parent=0) | |
| Command (const QString &p_sCommand, const QString &p_sDescription, const QStringList &p_qListParamNames, const QList< QVariant > &p_qListParamValues, bool p_bIsJson=true, QObject *parent=0) | |
| Command (const QString &p_sCommand, const QString &p_sDescription, const QStringList &p_qListParamNames, const QList< QVariant > &p_qListParamValues, const QStringList &p_vecParameterDescriptions, bool p_bIsJson=true, QObject *parent=0) | |
| Command (const Command &p_Command) | |
| virtual | ~Command () |
| QString | command () const |
| quint32 | count () const |
| QString | description () const |
| virtual void | execute () |
| bool & | isJson () |
| QList< QString > | pDescriptions () const |
| QList< QString > | pNames () const |
| QList< QVariant > & | pValues () |
| void | reply (const QString &p_sReply) |
| void | send () |
| QJsonObject | toJsonObject () const |
| QStringList | toStringList () const |
| QString | toStringReadySend () const |
| Command & | operator= (const Command &rhs) |
| QVariant & | operator[] (const QString &key) |
| QVariant & | operator[] (qint32 idx) |
| const QVariant | operator[] (const QString &key) const |
| Public Member Functions inherited from UTILSLIB::ICommand | |
| virtual | ~ICommand () |
Public Attributes | |
| QString | m_sCommand |
| QString | m_sDescription |
| QStringList | m_qListParamNames |
| QList< QVariant > | m_qListParamValues |
| QStringList | m_qListParamDescriptions |
| bool | m_bIsJson |
Named, parameterised command exchanged with mne_rt_server; supports both JSON and CLI serialisation.
Holds the command keyword, description, parallel lists of parameter names / values / descriptions, and a JSON-vs-CLI flag. Constructible either from a parsed QJsonObject (when echoing the server’s advertised command list) or from explicit string/value lists (when authoring a request). Implements UTILSLIB::ICommand so it can be dispatched through CommandManager and surfaces parameter access by both name (operator[](QString)) and index (operator[](qint32)).

| typedef QSharedPointer<const Command> COMLIB::Command::ConstSPtr |
| typedef QSharedPointer<Command> COMLIB::Command::SPtr |
|
explicit |
Constructs a Command
| [in] | p_bIsJson | If is received/should be send as JSON (optional, default true). |
| [in] | parent | Parent QObject (optional). |
Definition at line 47 of file command.cpp.
|
explicit |
Constructor which parses a command stored in a json object
| [in] | p_sCommand | Command. |
| [in] | p_qCommandContent | Content encapsulated in a JsonObject. |
| [in] | p_bIsJson | If is received/should be send as JSON (optional, default true). |
| [in] | parent | Parent QObject (optional). |
Definition at line 57 of file command.cpp.
|
explicit |
Constructs a command without parameters
| [in] | p_sCommand | Command. |
| [in] | p_sDescription | Command description. |
| [in] | p_bIsJson | If is received/should be send as JSON (optional, default true). |
| [in] | parent | Parent QObject (optional). |
Definition at line 81 of file command.cpp.
|
explicit |
Constructor which assembles a command from single parts
| [in] | p_sCommand | Command. |
| [in] | p_sDescription | Command description. |
| [in] | p_qListParamNames | Parameter names. |
| [in] | p_qListParamValues | Parameter values/types. |
| [in] | p_bIsJson | If is received/should be send as JSON (optional, default true). |
| [in] | parent | Parent QObject (optional). |
Definition at line 91 of file command.cpp.
|
explicit |
Constructor which assembles a command from single parts
| [in] | p_sCommand | Command. |
| [in] | p_sDescription | Command description. |
| [in] | p_qListParamNames | Parameter names. |
| [in] | p_qListParamValues | Parameter values/types. |
| [in] | p_vecParameterDescriptions | Parameter descriptions;. |
Definition at line 107 of file command.cpp.
| Command::Command | ( | const Command & | p_Command | ) |
Copy constructor.
| [in] | p_Command | Command to be copied. |
Definition at line 132 of file command.cpp.
|
virtual |
Destroys the command
Definition at line 145 of file command.cpp.
|
inline |
|
inline |
|
inline |
|
virtual |
Inherited by ICommand
Implements UTILSLIB::ICommand.
Definition at line 151 of file command.cpp.
|
signal |
Signal which is emitted when command patterns execute method is processed.
| [in] | p_command | the executed command. |
|
inline |
Assignment Operator
| [in] | rhs | Command which should be assigned. |
Definition at line 243 of file command.cpp.
| QVariant & Command::operator[] | ( | const QString & | key | ) |
Subscript operator [] to access parameter values by name
| [in] | key | the parameter name. |
Definition at line 259 of file command.cpp.
| const QVariant Command::operator[] | ( | const QString & | key | ) | const |
Subscript operator []
| [in] | key | the parameter name. |
Definition at line 279 of file command.cpp.
| QVariant & Command::operator[] | ( | qint32 | idx | ) |
Subscript operator [] to access parameter values by index
| [in] | idx | the parameter index. |
Definition at line 269 of file command.cpp.
|
inline |
|
inline |
|
inline |
| void Command::reply | ( | const QString & | p_sReply | ) |
Inherited command reply channel.
| [in] | p_sReply | command reply. |
Definition at line 158 of file command.cpp.
| void Command::send | ( | ) |
Sender slot which emmits triggered signal
Definition at line 169 of file command.cpp.
| QJsonObject Command::toJsonObject | ( | ) | const |
Creates a JSON Command Object
Definition at line 180 of file command.cpp.
| QStringList Command::toStringList | ( | ) | const |
Creates a StringList with three items. First item is the command, second the parameter list and thrid the description.
Definition at line 200 of file command.cpp.
| QString Command::toStringReadySend | ( | ) | const |
Creates a string JSON formatted ready send command.
Definition at line 222 of file command.cpp.
| bool COMLIB::Command::m_bIsJson |
| QStringList COMLIB::Command::m_qListParamDescriptions |
| QStringList COMLIB::Command::m_qListParamNames |
| QList<QVariant> COMLIB::Command::m_qListParamValues |
| QString COMLIB::Command::m_sDescription |