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

Command. More...

#include <command.h>

Public Types

typedef QSharedPointer< CommandSPtr
 
typedef QSharedPointer< const CommandConstSPtr
 
- Public Types inherited from UTILSLIB::ICommand
typedef QSharedPointer< ICommandSPtr
 
typedef QSharedPointer< const ICommandConstSPtr
 

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
 
Commandoperator= (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
 

Detailed Description

Command.

Command, which includes beside command name also command parameters

Definition at line 77 of file command.h.

Inheritance diagram for COMMUNICATIONLIB::Command:
Inheritance graph

Constructor & Destructor Documentation

◆ Command() [1/6]

Command::Command ( bool  p_bIsJson = true,
QObject *  parent = 0 
)
explicit

Constructs a Command

Parameters
[in]p_bIsJsonIf is received/should be send as JSON (optional, default true).
[in]parentParent QObject (optional).

Definition at line 27 of file command.cpp.

◆ Command() [2/6]

Command::Command ( const QString &  p_sCommand,
const QJsonObject &  p_qCommandContent,
bool  p_bIsJson = true,
QObject *  parent = 0 
)
explicit

Constructor which parses a command stored in a json object

Parameters
[in]p_sCommandCommand.
[in]p_qCommandContentContent encapsulated in a JsonObject.
[in]p_bIsJsonIf is received/should be send as JSON (optional, default true).
[in]parentParent QObject (optional).

Definition at line 37 of file command.cpp.

◆ Command() [3/6]

Command::Command ( const QString &  p_sCommand,
const QString &  p_sDescription,
bool  p_bIsJson = true,
QObject *  parent = 0 
)
explicit

Constructs a command without parameters

Parameters
[in]p_sCommandCommand.
[in]p_sDescriptionCommand description.
[in]p_bIsJsonIf is received/should be send as JSON (optional, default true).
[in]parentParent QObject (optional).

Definition at line 61 of file command.cpp.

◆ Command() [4/6]

Command::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 
)
explicit

Constructor which assembles a command from single parts

Parameters
[in]p_sCommandCommand.
[in]p_sDescriptionCommand description.
[in]p_qListParamNamesParameter names.
[in]p_qListParamValuesParameter values/types.
[in]p_bIsJsonIf is received/should be send as JSON (optional, default true).
[in]parentParent QObject (optional).

Definition at line 71 of file command.cpp.

◆ Command() [5/6]

Command::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 
)
explicit

Constructor which assembles a command from single parts

Parameters
[in]p_sCommandCommand.
[in]p_sDescriptionCommand description.
[in]p_qListParamNamesParameter names.
[in]p_qListParamValuesParameter values/types.
[in]p_vecParameterDescriptionsParameter descriptions;.

Definition at line 87 of file command.cpp.

◆ Command() [6/6]

Command::Command ( const Command p_Command)

Copy constructor.

Parameters
[in]p_CommandCommand to be copied.

Definition at line 112 of file command.cpp.

◆ ~Command()

Command::~Command ( )
virtual

Destroys the command

Definition at line 125 of file command.cpp.

Member Function Documentation

◆ command()

QString COMMUNICATIONLIB::Command::command ( ) const
inline

Short command for this request

Returns
Short command representation.

Definition at line 319 of file command.h.

◆ count()

quint32 COMMUNICATIONLIB::Command::count ( ) const
inline

Returns the number of parameters.

Returns
number of parameters.

Definition at line 326 of file command.h.

◆ description()

QString COMMUNICATIONLIB::Command::description ( ) const
inline

Gets the help text or description of this command.

Returns
Help text.

Definition at line 333 of file command.h.

◆ execute()

void Command::execute ( )
virtual

Inherited by ICommand

Returns
emits received.

Implements UTILSLIB::ICommand.

Definition at line 131 of file command.cpp.

◆ executed

void COMMUNICATIONLIB::Command::executed ( Command  p_command)
signal

Signal which is emitted when command patterns execute method is processed.

Parameters
[in]p_commandthe executed command.

◆ isJson()

bool & COMMUNICATIONLIB::Command::isJson ( )
inline

If received command was Json fomratted or triggered command should be Json formatted.

Returns
Json formatted.

Definition at line 340 of file command.h.

◆ operator=()

Command & Command::operator= ( const Command rhs)

Assignment Operator

Parameters
[in]rhsCommand which should be assigned.

Definition at line 223 of file command.cpp.

◆ operator[]() [1/3]

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

Subscript operator [] to access parameter values by name

Parameters
[in]keythe parameter name.
Returns
Parameter value related to the parameter name.

Definition at line 239 of file command.cpp.

◆ operator[]() [2/3]

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

Subscript operator []

Parameters
[in]keythe parameter name.
Returns
Parameter value related to the parameter name.

Definition at line 259 of file command.cpp.

◆ operator[]() [3/3]

QVariant & Command::operator[] ( qint32  idx)

Subscript operator [] to access parameter values by index

Parameters
[in]idxthe parameter index.
Returns
Parameter value related to the parameter index.

Definition at line 249 of file command.cpp.

◆ pDescriptions()

QList< QString > COMMUNICATIONLIB::Command::pDescriptions ( ) const
inline

Get parameter descriptions

Returns
parameter descriptions.

Definition at line 347 of file command.h.

◆ pNames()

QList< QString > COMMUNICATIONLIB::Command::pNames ( ) const
inline

Get parameter names

Returns
parameter names.

Definition at line 354 of file command.h.

◆ pValues()

QList< QVariant > & COMMUNICATIONLIB::Command::pValues ( )
inline

Returns parameter values

Returns
parameter values.

Definition at line 361 of file command.h.

◆ reply()

void Command::reply ( const QString &  p_sReply)

Inherited command reply channel.

Parameters
[in]p_sReplycommand reply.

Definition at line 138 of file command.cpp.

◆ send()

void Command::send ( )

Sender slot which emmits triggered signal

Definition at line 149 of file command.cpp.

◆ toJsonObject()

QJsonObject Command::toJsonObject ( ) const

Creates a JSON Command Object

Returns
Command converted to a JSON Object.

Definition at line 160 of file command.cpp.

◆ toStringList()

QStringList Command::toStringList ( ) const

Creates a StringList with three items. First item is the command, second the parameter list and thrid the description.

Returns
Command as a StringList.

Definition at line 180 of file command.cpp.

◆ toStringReadySend()

QString Command::toStringReadySend ( ) const

Creates a string JSON formatted ready send command.

Returns
Command as a JSON formatted string which contains parameter values too.

Definition at line 202 of file command.cpp.


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