Command
Command
#include <icy/symple/command.h>Inherits:
Message
Symple command message with a node path and action verb.
The node field is a colon-delimited path (e.g. "camera:zoom:in"). Individual path segments can be retrieved with param().
Public Methods
| Return | Name | Description |
|---|---|---|
Command | Constructs an empty command with type set to "command". | |
Command | Constructs a command from a JSON value. | |
Command | Copy constructor. | |
std::string | node const | Returns the colon-delimited node path (e.g. "camera:zoom"). |
std::string | action const | Returns the action verb (defaults to "execute"). |
void | setNode | Sets the node path field. |
void | setAction | Sets the action verb field. |
bool | valid virtual const | Returns true if the base message is valid and the node field is set. |
std::string | param const | Returns the nth colon-separated segment of the node path (1-based). Throws std::out_of_range if n exceeds the number of segments. |
std::vector< std::string > | params | Returns all colon-separated segments of the node path. |
bool | matches const | Returns true if the node path matches the given pattern. Uses wildcard node matching via util::matchNodes. |
Command
Command()Constructs an empty command with type set to "command".
Command
Command(const json::Value & root)Constructs a command from a JSON value.
Parameters
rootJSON object to initialise from.
Command
Command(const Command & root)Copy constructor.
Parameters
rootSource command.
node
const
std::string node() constReturns the colon-delimited node path (e.g. "camera:zoom").
action
const
std::string action() constReturns the action verb (defaults to "execute").
setNode
void setNode(std::string_view node)Sets the node path field.
Parameters
nodeColon-delimited node path string.
setAction
void setAction(std::string_view action)Sets the action verb field.
Parameters
actionAction string (e.g. "execute", "get", "set").
valid
virtual const
virtual bool valid() constReturns true if the base message is valid and the node field is set.
param
const
std::string param(int n) constReturns the nth colon-separated segment of the node path (1-based). Throws std::out_of_range if n exceeds the number of segments.
Parameters
n1-based segment index.
Returns
The nth path segment.
params
std::vector< std::string > params()Returns all colon-separated segments of the node path.
Returns
Vector of path segment strings.
matches
const
bool matches(std::string_view xnode) constReturns true if the node path matches the given pattern. Uses wildcard node matching via util::matchNodes.
Parameters
xnodePattern to match against (colon-delimited, supports wildcards).
