SRS-control 0.1.4
Loading...
Searching...
No Matches
StructDeserializer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <zpp_bits.h>
4
5#include <srs/Application.hpp>
7
8namespace srs::process
9{
10 class StructDeserializer : public DataConverterBase<std::string_view, const StructData*>
11 {
12 public:
13 using DataElementType = std::bitset<common::HIT_DATA_BIT_LENGTH>;
14 using ReceiveDataSquence = std::vector<DataElementType>;
15 static constexpr auto ConverterOption = std::array{ structure };
16
17 explicit StructDeserializer(asio::thread_pool& thread_pool)
18 : DataConverterBase{ generate_coro(thread_pool.get_executor()) }
19 {
20 }
21
22 [[nodiscard]] auto data() const -> const auto& { return output_data_; }
23
24 private:
27
29
30 // NOLINTNEXTLINE(readability-static-accessed-through-instance)
31 auto generate_coro(asio::any_io_executor /*unused*/) -> CoroType;
32 auto convert(std::string_view binary_data) -> std::size_t;
33 void translate_raw_data(StructData& struct_data);
35 static auto check_is_hit(const DataElementType& element) -> bool
36 {
37 return element.test(common::FLAG_BIT_POSITION);
38 }
39 };
40
41} // namespace srs::process
asio::experimental::coro< OutputType(std::optional< InputType >)> CoroType
std::vector< DataElementType > ReceiveDataSquence
std::bitset< common::HIT_DATA_BIT_LENGTH > DataElementType
StructDeserializer(asio::thread_pool &thread_pool)
void translate_raw_data(StructData &struct_data)
static auto check_is_hit(const DataElementType &element) -> bool
auto convert(std::string_view binary_data) -> std::size_t
auto generate_coro(asio::any_io_executor) -> CoroType
auto data() const -> const auto &
constexpr auto FLAG_BIT_POSITION
void reset_struct_data(StructData &struct_data)