ORE Studio 0.0.4
Loading...
Searching...
No Matches
coding_scheme_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_CODING_SCHEME_PROTOCOL_HPP
21#define ORES_DQ_MESSAGING_CODING_SCHEME_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/coding_scheme.hpp"
30#include "ores.dq/domain/coding_scheme_authority_type.hpp"
31
32namespace ores::dq::messaging {
33
34// ============================================================================
35// Coding Scheme Messages
36// ============================================================================
37
42 std::vector<std::byte> serialize() const;
43 static std::expected<get_coding_schemes_request,
44 ores::utility::serialization::error_code>
45 deserialize(std::span<const std::byte> data);
46};
47
48std::ostream& operator<<(std::ostream& s, const get_coding_schemes_request& v);
49
54 std::vector<domain::coding_scheme> schemes;
55
56 std::vector<std::byte> serialize() const;
57 static std::expected<get_coding_schemes_response,
58 ores::utility::serialization::error_code>
59 deserialize(std::span<const std::byte> data);
60};
61
62std::ostream& operator<<(std::ostream& s, const get_coding_schemes_response& v);
63
68 std::string authority_type;
69
70 std::vector<std::byte> serialize() const;
72 ores::utility::serialization::error_code>
73 deserialize(std::span<const std::byte> data);
74};
75
76std::ostream& operator<<(std::ostream& s, const get_coding_schemes_by_authority_type_request& v);
77
82 std::vector<domain::coding_scheme> schemes;
83
84 std::vector<std::byte> serialize() const;
86 ores::utility::serialization::error_code>
87 deserialize(std::span<const std::byte> data);
88};
89
90std::ostream& operator<<(std::ostream& s, const get_coding_schemes_by_authority_type_response& v);
91
97
98 std::vector<std::byte> serialize() const;
99 static std::expected<save_coding_scheme_request,
100 ores::utility::serialization::error_code>
101 deserialize(std::span<const std::byte> data);
102};
103
104std::ostream& operator<<(std::ostream& s, const save_coding_scheme_request& v);
105
110 bool success;
111 std::string message;
112
113 std::vector<std::byte> serialize() const;
114 static std::expected<save_coding_scheme_response,
115 ores::utility::serialization::error_code>
116 deserialize(std::span<const std::byte> data);
117};
118
119std::ostream& operator<<(std::ostream& s, const save_coding_scheme_response& v);
120
125 std::string code;
126 bool success;
127 std::string message;
128};
129
130std::ostream& operator<<(std::ostream& s, const delete_coding_scheme_result& v);
131
136 std::vector<std::string> codes;
137
138 std::vector<std::byte> serialize() const;
139 static std::expected<delete_coding_scheme_request,
140 ores::utility::serialization::error_code>
141 deserialize(std::span<const std::byte> data);
142};
143
144std::ostream& operator<<(std::ostream& s, const delete_coding_scheme_request& v);
145
150 std::vector<delete_coding_scheme_result> results;
151
152 std::vector<std::byte> serialize() const;
153 static std::expected<delete_coding_scheme_response,
154 ores::utility::serialization::error_code>
155 deserialize(std::span<const std::byte> data);
156};
157
158std::ostream& operator<<(std::ostream& s, const delete_coding_scheme_response& v);
159
164 std::string code;
165
166 std::vector<std::byte> serialize() const;
167 static std::expected<get_coding_scheme_history_request,
168 ores::utility::serialization::error_code>
169 deserialize(std::span<const std::byte> data);
170};
171
172std::ostream& operator<<(std::ostream& s, const get_coding_scheme_history_request& v);
173
178 bool success;
179 std::string message;
180 std::vector<domain::coding_scheme> versions;
181
182 std::vector<std::byte> serialize() const;
183 static std::expected<get_coding_scheme_history_response,
184 ores::utility::serialization::error_code>
185 deserialize(std::span<const std::byte> data);
186};
187
188std::ostream& operator<<(std::ostream& s, const get_coding_scheme_history_response& v);
189
190// ============================================================================
191// Coding Scheme Authority Type Messages
192// ============================================================================
193
198 std::vector<std::byte> serialize() const;
200 ores::utility::serialization::error_code>
201 deserialize(std::span<const std::byte> data);
202};
203
204std::ostream& operator<<(std::ostream& s, const get_coding_scheme_authority_types_request& v);
205
210 std::vector<domain::coding_scheme_authority_type> authority_types;
211
212 std::vector<std::byte> serialize() const;
214 ores::utility::serialization::error_code>
215 deserialize(std::span<const std::byte> data);
216};
217
218std::ostream& operator<<(std::ostream& s, const get_coding_scheme_authority_types_response& v);
219
225
226 std::vector<std::byte> serialize() const;
228 ores::utility::serialization::error_code>
229 deserialize(std::span<const std::byte> data);
230};
231
232std::ostream& operator<<(std::ostream& s, const save_coding_scheme_authority_type_request& v);
233
238 bool success;
239 std::string message;
240
241 std::vector<std::byte> serialize() const;
243 ores::utility::serialization::error_code>
244 deserialize(std::span<const std::byte> data);
245};
246
247std::ostream& operator<<(std::ostream& s, const save_coding_scheme_authority_type_response& v);
248
253 std::string code;
254 bool success;
255 std::string message;
256};
257
258std::ostream& operator<<(std::ostream& s, const delete_coding_scheme_authority_type_result& v);
259
264 std::vector<std::string> codes;
265
266 std::vector<std::byte> serialize() const;
268 ores::utility::serialization::error_code>
269 deserialize(std::span<const std::byte> data);
270};
271
272std::ostream& operator<<(std::ostream& s, const delete_coding_scheme_authority_type_request& v);
273
278 std::vector<delete_coding_scheme_authority_type_result> results;
279
280 std::vector<std::byte> serialize() const;
282 ores::utility::serialization::error_code>
283 deserialize(std::span<const std::byte> data);
284};
285
286std::ostream& operator<<(std::ostream& s, const delete_coding_scheme_authority_type_response& v);
287
292 std::string code;
293
294 std::vector<std::byte> serialize() const;
296 ores::utility::serialization::error_code>
297 deserialize(std::span<const std::byte> data);
298};
299
300std::ostream& operator<<(std::ostream& s, const get_coding_scheme_authority_type_history_request& v);
301
306 bool success;
307 std::string message;
308 std::vector<domain::coding_scheme_authority_type> versions;
309
310 std::vector<std::byte> serialize() const;
312 ores::utility::serialization::error_code>
313 deserialize(std::span<const std::byte> data);
314};
315
316std::ostream& operator<<(std::ostream& s, const get_coding_scheme_authority_type_history_response& v);
317
318}
319
320namespace ores::comms::messaging {
321
322// Coding Scheme traits
323template<>
324struct message_traits<dq::messaging::get_coding_schemes_request> {
326 using response_type = dq::messaging::get_coding_schemes_response;
327 static constexpr message_type request_message_type =
328 message_type::get_coding_schemes_request;
329};
330
331template<>
332struct message_traits<dq::messaging::get_coding_schemes_by_authority_type_request> {
335 static constexpr message_type request_message_type =
336 message_type::get_coding_schemes_by_authority_type_request;
337};
338
339template<>
340struct message_traits<dq::messaging::save_coding_scheme_request> {
341 using request_type = dq::messaging::save_coding_scheme_request;
342 using response_type = dq::messaging::save_coding_scheme_response;
343 static constexpr message_type request_message_type =
344 message_type::save_coding_scheme_request;
345};
346
347template<>
348struct message_traits<dq::messaging::delete_coding_scheme_request> {
349 using request_type = dq::messaging::delete_coding_scheme_request;
350 using response_type = dq::messaging::delete_coding_scheme_response;
351 static constexpr message_type request_message_type =
352 message_type::delete_coding_scheme_request;
353};
354
355template<>
356struct message_traits<dq::messaging::get_coding_scheme_history_request> {
357 using request_type = dq::messaging::get_coding_scheme_history_request;
358 using response_type = dq::messaging::get_coding_scheme_history_response;
359 static constexpr message_type request_message_type =
360 message_type::get_coding_scheme_history_request;
361};
362
363// Coding Scheme Authority Type traits
364template<>
365struct message_traits<dq::messaging::get_coding_scheme_authority_types_request> {
366 using request_type = dq::messaging::get_coding_scheme_authority_types_request;
367 using response_type = dq::messaging::get_coding_scheme_authority_types_response;
368 static constexpr message_type request_message_type =
369 message_type::get_coding_scheme_authority_types_request;
370};
371
372template<>
373struct message_traits<dq::messaging::save_coding_scheme_authority_type_request> {
374 using request_type = dq::messaging::save_coding_scheme_authority_type_request;
375 using response_type = dq::messaging::save_coding_scheme_authority_type_response;
376 static constexpr message_type request_message_type =
377 message_type::save_coding_scheme_authority_type_request;
378};
379
380template<>
381struct message_traits<dq::messaging::delete_coding_scheme_authority_type_request> {
382 using request_type = dq::messaging::delete_coding_scheme_authority_type_request;
383 using response_type = dq::messaging::delete_coding_scheme_authority_type_response;
384 static constexpr message_type request_message_type =
385 message_type::delete_coding_scheme_authority_type_request;
386};
387
388template<>
389struct message_traits<dq::messaging::get_coding_scheme_authority_type_history_request> {
390 using request_type = dq::messaging::get_coding_scheme_authority_type_history_request;
391 using response_type = dq::messaging::get_coding_scheme_authority_type_history_response;
392 static constexpr message_type request_message_type =
393 message_type::get_coding_scheme_authority_type_history_request;
394};
395
396}
397
398#endif
Contains messaging related infrastructure in the comms library.
Definition assets_protocol.hpp:122
Defines a coding or identification standard used to identify entities.
Definition coding_scheme.hpp:36
Classifies coding schemes by the type of authority that defines them.
Definition coding_scheme_authority_type.hpp:40
Request to retrieve all coding schemes.
Definition coding_scheme_protocol.hpp:41
Response containing all coding schemes.
Definition coding_scheme_protocol.hpp:53
Request to retrieve coding schemes for a specific authority type.
Definition coding_scheme_protocol.hpp:67
Response containing coding schemes for an authority type.
Definition coding_scheme_protocol.hpp:81
Request to save a coding scheme (create or update).
Definition coding_scheme_protocol.hpp:95
Response confirming coding scheme save operation.
Definition coding_scheme_protocol.hpp:109
Result for a single coding scheme deletion.
Definition coding_scheme_protocol.hpp:124
Request to delete one or more coding schemes.
Definition coding_scheme_protocol.hpp:135
Response confirming coding scheme deletion(s).
Definition coding_scheme_protocol.hpp:149
Request to retrieve version history for a coding scheme.
Definition coding_scheme_protocol.hpp:163
Response containing coding scheme version history.
Definition coding_scheme_protocol.hpp:177
Request to retrieve all coding scheme authority types.
Definition coding_scheme_protocol.hpp:197
Response containing all coding scheme authority types.
Definition coding_scheme_protocol.hpp:209
Request to save a coding scheme authority type (create or update).
Definition coding_scheme_protocol.hpp:223
Response confirming coding scheme authority type save operation.
Definition coding_scheme_protocol.hpp:237
Result for a single coding scheme authority type deletion.
Definition coding_scheme_protocol.hpp:252
Request to delete one or more coding scheme authority types.
Definition coding_scheme_protocol.hpp:263
Response confirming coding scheme authority type deletion(s).
Definition coding_scheme_protocol.hpp:277
Request to retrieve version history for a coding scheme authority type.
Definition coding_scheme_protocol.hpp:291
Response containing coding scheme authority type version history.
Definition coding_scheme_protocol.hpp:305