IRSOL
C++ code implementing socket server for interacting with Baumer camera.
parser.hpp
Go to the documentation of this file.
1
12#pragma once
13
16
17#include <optional>
18#include <string>
19
20namespace irsol {
21namespace protocol {
22
31class Parser
32{
33public:
66 static std::optional<InMessage> parse(const std::string& line);
67
68private:
93 static internal::ParserResult<Assignment> parseAssignment(const std::string& line);
94
117 static internal::ParserResult<Inquiry> parseInquiry(const std::string& line);
118
141 static internal::ParserResult<Command> parseCommand(const std::string& line);
142
164 static irsol::types::protocol_value_t parseValue(const std::string& valueString);
165};
166
167} // namespace protocol
168} // namespace irsol
Parses raw input strings into structured InMessage instances.
Definition parser.hpp:32
static internal::ParserResult< Inquiry > parseInquiry(const std::string &line)
Parses an inquiry message from a protocol line.
Definition parser.cpp:81
static irsol::types::protocol_value_t parseValue(const std::string &valueString)
Attempts to parse a raw value string into a typed protocol value.
Definition parser.cpp:142
static std::optional< InMessage > parse(const std::string &line)
Attempts to parse a single protocol input line into a structured InMessage.
Definition parser.cpp:11
static internal::ParserResult< Assignment > parseAssignment(const std::string &line)
Parses an assignment message from a protocol line.
Definition parser.cpp:48
static internal::ParserResult< Command > parseCommand(const std::string &line)
Parses a command message from a protocol line.
Definition parser.cpp:113
Wrapper for the result of a protocol parsing attempt.
std::variant< int, double, std::string > protocol_value_t
Variant type representing protocol values that can be one of several types.
Definition types.hpp:150
Encapsulates the result of a protocol parsing operation.