ORE Studio 0.0.4
Loading...
Searching...
No Matches
dimension_protocol.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_DQ_MESSAGING_DIMENSION_PROTOCOL_HPP
21#define ORES_DQ_MESSAGING_DIMENSION_PROTOCOL_HPP
22
23#include <span>
24#include <iosfwd>
25#include <vector>
26#include <expected>
27#include "ores.comms/messaging/message_types.hpp"
28#include "ores.comms/messaging/message_traits.hpp"
29#include "ores.dq/domain/nature_dimension.hpp"
30#include "ores.dq/domain/origin_dimension.hpp"
31#include "ores.dq/domain/treatment_dimension.hpp"
32
33namespace ores::dq::messaging {
34
35// ============================================================================
36// Nature Dimension Messages
37// ============================================================================
38
43 std::vector<std::byte> serialize() const;
44 static std::expected<get_nature_dimensions_request,
45 ores::utility::serialization::error_code>
46 deserialize(std::span<const std::byte> data);
47};
48
49std::ostream& operator<<(std::ostream& s, const get_nature_dimensions_request& v);
50
55 std::vector<domain::nature_dimension> dimensions;
56
57 std::vector<std::byte> serialize() const;
58 static std::expected<get_nature_dimensions_response,
59 ores::utility::serialization::error_code>
60 deserialize(std::span<const std::byte> data);
61};
62
63std::ostream& operator<<(std::ostream& s, const get_nature_dimensions_response& v);
64
70
71 std::vector<std::byte> serialize() const;
72 static std::expected<save_nature_dimension_request,
73 ores::utility::serialization::error_code>
74 deserialize(std::span<const std::byte> data);
75};
76
77std::ostream& operator<<(std::ostream& s, const save_nature_dimension_request& v);
78
83 bool success;
84 std::string message;
85
86 std::vector<std::byte> serialize() const;
87 static std::expected<save_nature_dimension_response,
88 ores::utility::serialization::error_code>
89 deserialize(std::span<const std::byte> data);
90};
91
92std::ostream& operator<<(std::ostream& s, const save_nature_dimension_response& v);
93
98 std::string code;
99 bool success;
100 std::string message;
101};
102
103std::ostream& operator<<(std::ostream& s, const delete_nature_dimension_result& v);
104
109 std::vector<std::string> codes;
110
111 std::vector<std::byte> serialize() const;
112 static std::expected<delete_nature_dimension_request,
113 ores::utility::serialization::error_code>
114 deserialize(std::span<const std::byte> data);
115};
116
117std::ostream& operator<<(std::ostream& s, const delete_nature_dimension_request& v);
118
123 std::vector<delete_nature_dimension_result> results;
124
125 std::vector<std::byte> serialize() const;
126 static std::expected<delete_nature_dimension_response,
127 ores::utility::serialization::error_code>
128 deserialize(std::span<const std::byte> data);
129};
130
131std::ostream& operator<<(std::ostream& s, const delete_nature_dimension_response& v);
132
137 std::string code;
138
139 std::vector<std::byte> serialize() const;
140 static std::expected<get_nature_dimension_history_request,
141 ores::utility::serialization::error_code>
142 deserialize(std::span<const std::byte> data);
143};
144
145std::ostream& operator<<(std::ostream& s, const get_nature_dimension_history_request& v);
146
151 bool success;
152 std::string message;
153 std::vector<domain::nature_dimension> versions;
154
155 std::vector<std::byte> serialize() const;
156 static std::expected<get_nature_dimension_history_response,
157 ores::utility::serialization::error_code>
158 deserialize(std::span<const std::byte> data);
159};
160
161std::ostream& operator<<(std::ostream& s, const get_nature_dimension_history_response& v);
162
163// ============================================================================
164// Origin Dimension Messages
165// ============================================================================
166
171 std::vector<std::byte> serialize() const;
172 static std::expected<get_origin_dimensions_request,
173 ores::utility::serialization::error_code>
174 deserialize(std::span<const std::byte> data);
175};
176
177std::ostream& operator<<(std::ostream& s, const get_origin_dimensions_request& v);
178
183 std::vector<domain::origin_dimension> dimensions;
184
185 std::vector<std::byte> serialize() const;
186 static std::expected<get_origin_dimensions_response,
187 ores::utility::serialization::error_code>
188 deserialize(std::span<const std::byte> data);
189};
190
191std::ostream& operator<<(std::ostream& s, const get_origin_dimensions_response& v);
192
197 domain::origin_dimension dimension;
198
199 std::vector<std::byte> serialize() const;
200 static std::expected<save_origin_dimension_request,
201 ores::utility::serialization::error_code>
202 deserialize(std::span<const std::byte> data);
203};
204
205std::ostream& operator<<(std::ostream& s, const save_origin_dimension_request& v);
206
211 bool success;
212 std::string message;
213
214 std::vector<std::byte> serialize() const;
215 static std::expected<save_origin_dimension_response,
216 ores::utility::serialization::error_code>
217 deserialize(std::span<const std::byte> data);
218};
219
220std::ostream& operator<<(std::ostream& s, const save_origin_dimension_response& v);
221
226 std::string code;
227 bool success;
228 std::string message;
229};
230
231std::ostream& operator<<(std::ostream& s, const delete_origin_dimension_result& v);
232
237 std::vector<std::string> codes;
238
239 std::vector<std::byte> serialize() const;
240 static std::expected<delete_origin_dimension_request,
241 ores::utility::serialization::error_code>
242 deserialize(std::span<const std::byte> data);
243};
244
245std::ostream& operator<<(std::ostream& s, const delete_origin_dimension_request& v);
246
251 std::vector<delete_origin_dimension_result> results;
252
253 std::vector<std::byte> serialize() const;
254 static std::expected<delete_origin_dimension_response,
255 ores::utility::serialization::error_code>
256 deserialize(std::span<const std::byte> data);
257};
258
259std::ostream& operator<<(std::ostream& s, const delete_origin_dimension_response& v);
260
265 std::string code;
266
267 std::vector<std::byte> serialize() const;
268 static std::expected<get_origin_dimension_history_request,
269 ores::utility::serialization::error_code>
270 deserialize(std::span<const std::byte> data);
271};
272
273std::ostream& operator<<(std::ostream& s, const get_origin_dimension_history_request& v);
274
279 bool success;
280 std::string message;
281 std::vector<domain::origin_dimension> versions;
282
283 std::vector<std::byte> serialize() const;
284 static std::expected<get_origin_dimension_history_response,
285 ores::utility::serialization::error_code>
286 deserialize(std::span<const std::byte> data);
287};
288
289std::ostream& operator<<(std::ostream& s, const get_origin_dimension_history_response& v);
290
291// ============================================================================
292// Treatment Dimension Messages
293// ============================================================================
294
299 std::vector<std::byte> serialize() const;
300 static std::expected<get_treatment_dimensions_request,
301 ores::utility::serialization::error_code>
302 deserialize(std::span<const std::byte> data);
303};
304
305std::ostream& operator<<(std::ostream& s, const get_treatment_dimensions_request& v);
306
311 std::vector<domain::treatment_dimension> dimensions;
312
313 std::vector<std::byte> serialize() const;
314 static std::expected<get_treatment_dimensions_response,
315 ores::utility::serialization::error_code>
316 deserialize(std::span<const std::byte> data);
317};
318
319std::ostream& operator<<(std::ostream& s, const get_treatment_dimensions_response& v);
320
326
327 std::vector<std::byte> serialize() const;
328 static std::expected<save_treatment_dimension_request,
329 ores::utility::serialization::error_code>
330 deserialize(std::span<const std::byte> data);
331};
332
333std::ostream& operator<<(std::ostream& s, const save_treatment_dimension_request& v);
334
339 bool success;
340 std::string message;
341
342 std::vector<std::byte> serialize() const;
343 static std::expected<save_treatment_dimension_response,
344 ores::utility::serialization::error_code>
345 deserialize(std::span<const std::byte> data);
346};
347
348std::ostream& operator<<(std::ostream& s, const save_treatment_dimension_response& v);
349
354 std::string code;
355 bool success;
356 std::string message;
357};
358
359std::ostream& operator<<(std::ostream& s, const delete_treatment_dimension_result& v);
360
365 std::vector<std::string> codes;
366
367 std::vector<std::byte> serialize() const;
368 static std::expected<delete_treatment_dimension_request,
369 ores::utility::serialization::error_code>
370 deserialize(std::span<const std::byte> data);
371};
372
373std::ostream& operator<<(std::ostream& s, const delete_treatment_dimension_request& v);
374
379 std::vector<delete_treatment_dimension_result> results;
380
381 std::vector<std::byte> serialize() const;
382 static std::expected<delete_treatment_dimension_response,
383 ores::utility::serialization::error_code>
384 deserialize(std::span<const std::byte> data);
385};
386
387std::ostream& operator<<(std::ostream& s, const delete_treatment_dimension_response& v);
388
393 std::string code;
394
395 std::vector<std::byte> serialize() const;
396 static std::expected<get_treatment_dimension_history_request,
397 ores::utility::serialization::error_code>
398 deserialize(std::span<const std::byte> data);
399};
400
401std::ostream& operator<<(std::ostream& s, const get_treatment_dimension_history_request& v);
402
407 bool success;
408 std::string message;
409 std::vector<domain::treatment_dimension> versions;
410
411 std::vector<std::byte> serialize() const;
412 static std::expected<get_treatment_dimension_history_response,
413 ores::utility::serialization::error_code>
414 deserialize(std::span<const std::byte> data);
415};
416
417std::ostream& operator<<(std::ostream& s, const get_treatment_dimension_history_response& v);
418
419}
420
421namespace ores::comms::messaging {
422
423// Nature Dimension traits
424template<>
425struct message_traits<dq::messaging::get_nature_dimensions_request> {
428 static constexpr message_type request_message_type =
429 message_type::get_nature_dimensions_request;
430};
431
432template<>
433struct message_traits<dq::messaging::save_nature_dimension_request> {
436 static constexpr message_type request_message_type =
437 message_type::save_nature_dimension_request;
438};
439
440template<>
441struct message_traits<dq::messaging::delete_nature_dimension_request> {
442 using request_type = dq::messaging::delete_nature_dimension_request;
443 using response_type = dq::messaging::delete_nature_dimension_response;
444 static constexpr message_type request_message_type =
445 message_type::delete_nature_dimension_request;
446};
447
448template<>
449struct message_traits<dq::messaging::get_nature_dimension_history_request> {
450 using request_type = dq::messaging::get_nature_dimension_history_request;
451 using response_type = dq::messaging::get_nature_dimension_history_response;
452 static constexpr message_type request_message_type =
453 message_type::get_nature_dimension_history_request;
454};
455
456// Origin Dimension traits
457template<>
458struct message_traits<dq::messaging::get_origin_dimensions_request> {
459 using request_type = dq::messaging::get_origin_dimensions_request;
460 using response_type = dq::messaging::get_origin_dimensions_response;
461 static constexpr message_type request_message_type =
462 message_type::get_origin_dimensions_request;
463};
464
465template<>
466struct message_traits<dq::messaging::save_origin_dimension_request> {
467 using request_type = dq::messaging::save_origin_dimension_request;
468 using response_type = dq::messaging::save_origin_dimension_response;
469 static constexpr message_type request_message_type =
470 message_type::save_origin_dimension_request;
471};
472
473template<>
474struct message_traits<dq::messaging::delete_origin_dimension_request> {
475 using request_type = dq::messaging::delete_origin_dimension_request;
476 using response_type = dq::messaging::delete_origin_dimension_response;
477 static constexpr message_type request_message_type =
478 message_type::delete_origin_dimension_request;
479};
480
481template<>
482struct message_traits<dq::messaging::get_origin_dimension_history_request> {
483 using request_type = dq::messaging::get_origin_dimension_history_request;
484 using response_type = dq::messaging::get_origin_dimension_history_response;
485 static constexpr message_type request_message_type =
486 message_type::get_origin_dimension_history_request;
487};
488
489// Treatment Dimension traits
490template<>
491struct message_traits<dq::messaging::get_treatment_dimensions_request> {
492 using request_type = dq::messaging::get_treatment_dimensions_request;
493 using response_type = dq::messaging::get_treatment_dimensions_response;
494 static constexpr message_type request_message_type =
495 message_type::get_treatment_dimensions_request;
496};
497
498template<>
499struct message_traits<dq::messaging::save_treatment_dimension_request> {
500 using request_type = dq::messaging::save_treatment_dimension_request;
501 using response_type = dq::messaging::save_treatment_dimension_response;
502 static constexpr message_type request_message_type =
503 message_type::save_treatment_dimension_request;
504};
505
506template<>
507struct message_traits<dq::messaging::delete_treatment_dimension_request> {
508 using request_type = dq::messaging::delete_treatment_dimension_request;
509 using response_type = dq::messaging::delete_treatment_dimension_response;
510 static constexpr message_type request_message_type =
511 message_type::delete_treatment_dimension_request;
512};
513
514template<>
515struct message_traits<dq::messaging::get_treatment_dimension_history_request> {
516 using request_type = dq::messaging::get_treatment_dimension_history_request;
517 using response_type = dq::messaging::get_treatment_dimension_history_response;
518 static constexpr message_type request_message_type =
519 message_type::get_treatment_dimension_history_request;
520};
521
522}
523
524#endif
Contains messaging related infrastructure in the comms library.
Definition assets_protocol.hpp:122
Classifies datasets by their data nature (actual vs. synthetic).
Definition nature_dimension.hpp:39
Classifies datasets by their origin or source type.
Definition origin_dimension.hpp:39
Classifies datasets by their processing treatment level.
Definition treatment_dimension.hpp:40
Request to retrieve all nature dimensions.
Definition dimension_protocol.hpp:42
Response containing all nature dimensions.
Definition dimension_protocol.hpp:54
Request to save a nature dimension (create or update).
Definition dimension_protocol.hpp:68
Response confirming nature dimension save operation.
Definition dimension_protocol.hpp:82
Result for a single nature dimension deletion.
Definition dimension_protocol.hpp:97
Request to delete one or more nature dimensions.
Definition dimension_protocol.hpp:108
Response confirming nature dimension deletion(s).
Definition dimension_protocol.hpp:122
Request to retrieve version history for a nature dimension.
Definition dimension_protocol.hpp:136
Response containing nature dimension version history.
Definition dimension_protocol.hpp:150
Request to retrieve all origin dimensions.
Definition dimension_protocol.hpp:170
Response containing all origin dimensions.
Definition dimension_protocol.hpp:182
Request to save an origin dimension (create or update).
Definition dimension_protocol.hpp:196
Response confirming origin dimension save operation.
Definition dimension_protocol.hpp:210
Result for a single origin dimension deletion.
Definition dimension_protocol.hpp:225
Request to delete one or more origin dimensions.
Definition dimension_protocol.hpp:236
Response confirming origin dimension deletion(s).
Definition dimension_protocol.hpp:250
Request to retrieve version history for an origin dimension.
Definition dimension_protocol.hpp:264
Response containing origin dimension version history.
Definition dimension_protocol.hpp:278
Request to retrieve all treatment dimensions.
Definition dimension_protocol.hpp:298
Response containing all treatment dimensions.
Definition dimension_protocol.hpp:310
Request to save a treatment dimension (create or update).
Definition dimension_protocol.hpp:324
Response confirming treatment dimension save operation.
Definition dimension_protocol.hpp:338
Result for a single treatment dimension deletion.
Definition dimension_protocol.hpp:353
Request to delete one or more treatment dimensions.
Definition dimension_protocol.hpp:364
Response confirming treatment dimension deletion(s).
Definition dimension_protocol.hpp:378
Request to retrieve version history for a treatment dimension.
Definition dimension_protocol.hpp:392
Response containing treatment dimension version history.
Definition dimension_protocol.hpp:406