28 requires std::is_same_v<T, int32_t> || std::is_same_v<T, int64_t> || std::is_same_v<T, double> ||
29 std::is_same_v<T, bool> || std::is_same_v<T, std::string> ||
30 std::is_same_v<T, std::string_view> || std::is_same_v<T, std::vector<uint8_t>> ||
31 std::is_same_v<T, std::chrono::system_clock::time_point> ||
32 std::is_same_v<T, std::vector<int32_t>> || std::is_same_v<T, std::vector<int64_t>> ||
33 std::is_same_v<T, std::vector<double>> || std::is_same_v<T, std::vector<bool>> ||
34 std::is_same_v<T, std::vector<std::string>> ||
35 std::is_same_v<T, std::vector<std::vector<uint8_t>>> ||
36 std::is_same_v<T, std::vector<std::chrono::system_clock::time_point>>;
50 template <AstarteDataAllowedType T>
52 if constexpr (std::is_same_v<T, std::string_view>) {
53 data_ = std::string(value);
63 template <AstarteDataAllowedType T>
64 [[nodiscard]]
auto into() const
65 -> std::conditional_t<std::is_same_v<T, std::string_view>, std::string_view, const T&> {
66 if constexpr (std::is_same_v<T, std::string_view>) {
67 return std::string_view(std::get<std::string>(data_));
69 return std::get<T>(data_);
76 template <AstarteDataAllowedType T>
77 [[nodiscard]]
auto try_into() const -> std::optional<T> {
78 if constexpr (std::is_same_v<T, std::string_view>) {
79 if (std::holds_alternative<std::string>(data_)) {
80 return std::string_view(std::get<std::string>(data_));
83 if (std::holds_alternative<T>(data_)) {
84 return std::get<T>(data_);
101 -> const std::variant<int32_t, int64_t,
double,
bool, std::
string, std::vector<uint8_t>,
102 std::chrono::system_clock::time_point, std::vector<int32_t>,
103 std::vector<int64_t>, std::vector<
double>, std::vector<
bool>,
104 std::vector<std::
string>, std::vector<std::vector<uint8_t>>,
105 std::vector<std::chrono::system_clock::time_point>>&;
111 [[nodiscard]] auto operator==(const
AstarteData& other) const ->
bool;
117 [[nodiscard]] auto operator!=(const
AstarteData& other) const ->
bool;
120 std::variant<int32_t, int64_t,
double,
bool, std::
string, std::vector<uint8_t>,
121 std::chrono::system_clock::time_point, std::vector<int32_t>, std::vector<int64_t>,
122 std::vector<
double>, std::vector<
bool>, std::vector<std::
string>,
123 std::vector<std::vector<uint8_t>>,
124 std::vector<std::chrono::system_clock::time_point>>