uatools 1.0.0
 
Loading...
Searching...
No Matches
Config.hpp
Go to the documentation of this file.
1
15
16#pragma once
17
18#include <cstdint>
19#include <optional>
20#include <string>
21#include <unordered_map>
22#include <vector>
23
25
33
34 struct WritableNode {
35 std::string node_id;
40 double min{0.0};
41 double max{1.0};
42 };
43
44 struct StateMachine {
45 std::string state_node; // String variable to read
46 std::unordered_map<std::string, std::string>
47 methods; // logical-name -> NodeId
50 std::vector<std::string> cycle;
51 };
52
60
61 struct Scenario {
62 std::string name;
64
67 double rate_hz{0.0};
68
70 std::uint32_t publishing_interval_ms{100};
71
73 std::uint32_t queue_size{10};
74 };
75
76 struct Config {
77 // ---- Connection ----
78 std::string endpoint;
79 std::string username; // empty == anonymous
80 std::string password;
81
82 // ---- Node sets ----
83 std::vector<std::string> readable;
84 std::vector<WritableNode> writable;
85 std::vector<std::string> subscribable;
86
87 // ---- Optional state-machine module ----
88 std::optional<StateMachine> state_machine;
89
90 // ---- Scenarios (keyed by name; CLI --scenario picks one) ----
91 std::unordered_map<std::string, Scenario> scenarios;
92 };
93
96 Config LoadConfig(const std::string& path);
97
99 const char* ScenarioKindName(ScenarioKind k);
100
101} // namespace eso::uatools::uastresstest
Definition Config.cpp:14
WriteType
Definition Config.hpp:26
@ String
Definition Config.hpp:31
@ Boolean
Definition Config.hpp:27
@ Int32
Definition Config.hpp:28
@ Double
Definition Config.hpp:30
@ Int64
Definition Config.hpp:29
Config LoadConfig(const std::string &path)
Load and validate a YAML config file. Throws std::runtime_error on parse or schema errors.
Definition Config.cpp:60
ScenarioKind
Definition Config.hpp:53
@ StateCycle
Definition Config.hpp:57
@ Subscribe
Definition Config.hpp:56
@ ConnectDisconnect
Definition Config.hpp:58
const char * ScenarioKindName(ScenarioKind k)
Convert a kind enum to its YAML token (for logging).
Definition Config.cpp:49
Definition Config.hpp:76
std::vector< WritableNode > writable
Definition Config.hpp:84
std::string endpoint
Definition Config.hpp:78
std::string username
Definition Config.hpp:79
std::string password
Definition Config.hpp:80
std::vector< std::string > readable
Definition Config.hpp:83
std::unordered_map< std::string, Scenario > scenarios
Definition Config.hpp:91
std::vector< std::string > subscribable
Definition Config.hpp:85
std::optional< StateMachine > state_machine
Definition Config.hpp:88
Definition Config.hpp:61
ScenarioKind kind
Definition Config.hpp:63
std::uint32_t publishing_interval_ms
For Subscribe: publishing interval requested from the server.
Definition Config.hpp:70
std::uint32_t queue_size
For Subscribe: queue size hint.
Definition Config.hpp:73
std::string name
Definition Config.hpp:62
double rate_hz
Definition Config.hpp:67
std::string state_node
Definition Config.hpp:45
std::vector< std::string > cycle
Definition Config.hpp:50
std::unordered_map< std::string, std::string > methods
Definition Config.hpp:47
std::string node_id
Definition Config.hpp:35
double min
Definition Config.hpp:40
double max
Definition Config.hpp:41
WriteType type
Definition Config.hpp:36