IRSOL
C++ code implementing socket server for interacting with Baumer camera.
irsol::protocol::Command Struct Reference

Represents a command invocation in the protocol. More...

#include <command.hpp>

Public Member Functions

 Command (const std::string &identifier)
 Constructs a Command.
 
std::string toString () const
 Converts the command to a human-readable string.
 

Public Attributes

std::string identifier
 The name of the command to execute.
 

Detailed Description

Represents a command invocation in the protocol.

A command consists of a valid identifier and typically does not carry a value. It is used to trigger predefined actions such as "start", "stop", or "reset".

Can be stored in a irsol::protocol::InMessage variant.

Definition at line 32 of file command.hpp.

Constructor & Destructor Documentation

◆ Command()

irsol::protocol::Command::Command ( const std::string &  identifier)

Constructs a Command.

Parameters
identifierThe command name; must start with a character and contain alphanumeric characters or underscores.

Definition at line 9 of file command.cpp.

10{}
std::string validateIdentifier(const std::string &identifier)
Validate that a string is a valid protocol identifier.
Definition utils.hpp:55
std::string identifier
The name of the command to execute.
Definition command.hpp:42

Member Function Documentation

◆ toString()

std::string irsol::protocol::Command::toString ( ) const

Converts the command to a human-readable string.

Returns
A string representation of the command.

Definition at line 13 of file command.cpp.

14{
15 std::ostringstream oss;
16 oss << "Command{"
17 << "identifier: '" << identifier << "'}";
18 return oss.str();
19}

Member Data Documentation

◆ identifier

std::string irsol::protocol::Command::identifier

The name of the command to execute.

Definition at line 42 of file command.hpp.


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