Astarte device API for C++ 0.7.1
Astarte device SDK for C++
Loading...
Searching...
No Matches
AstarteDeviceSdk::AstarteData Class Reference

Astarte data class, representing the basic Astarte types. More...

#include <data.hpp>

Public Member Functions

template<AstarteDataAllowedType T>
 AstarteData (T value)
 Constructor for the AstarteData class.
 
template<AstarteDataAllowedType T>
auto into () const -> const T &
 Convert the Astarte data class to the appropriate data type.
 
template<AstarteDataAllowedType T>
auto try_into () const -> std::optional< T >
 Convert the Astarte data class to the given type if it's the correct variant.
 
auto get_type () const -> AstarteType
 Get the type of the data contained in this class instance.
 
auto get_raw_data () const -> const std::variant< int32_t, int64_t, double, bool, std::string, std::vector< uint8_t >, std::chrono::system_clock::time_point, std::vector< int32_t >, std::vector< int64_t >, std::vector< double >, std::vector< bool >, std::vector< std::string >, std::vector< std::vector< uint8_t > >, std::vector< std::chrono::system_clock::time_point > > &
 Return the raw data contained in this class instance.
 
auto operator== (const AstarteData &other) const -> bool
 Overloader for the comparison operator ==.
 
auto operator!= (const AstarteData &other) const -> bool
 Overloader for the comparison operator !=.
 

Detailed Description

Astarte data class, representing the basic Astarte types.

Constructor & Destructor Documentation

◆ AstarteData()

template<AstarteDataAllowedType T>
AstarteDeviceSdk::AstarteData::AstarteData ( T value)
inlineexplicit

Constructor for the AstarteData class.

Parameters
valueThe content of the Astarte data instance.

Member Function Documentation

◆ get_raw_data()

auto AstarteDeviceSdk::AstarteData::get_raw_data ( ) const -> const std::variant< int32_t, int64_t, double, bool, std::string, std::vector< uint8_t >, std::chrono::system_clock::time_point, std::vector< int32_t >, std::vector< int64_t >, std::vector< double >, std::vector< bool >, std::vector< std::string >, std::vector< std::vector< uint8_t > >, std::vector< std::chrono::system_clock::time_point > > &
nodiscard

Return the raw data contained in this class instance.

Returns
The raw data contained in this class instance. This is a variant containing one of the possible data types.

◆ get_type()

auto AstarteDeviceSdk::AstarteData::get_type ( ) const -> AstarteType
nodiscard

Get the type of the data contained in this class instance.

Returns
The type of the content of this class instance.

◆ into()

template<AstarteDataAllowedType T>
auto AstarteDeviceSdk::AstarteData::into ( ) const -> const T&
inline

Convert the Astarte data class to the appropriate data type.

Returns
The value contained in the class instance.

◆ operator!=()

auto AstarteDeviceSdk::AstarteData::operator!= ( const AstarteData & other) const -> bool
nodiscard

Overloader for the comparison operator !=.

Parameters
otherThe object to compare to.
Returns
True when different, false otherwise.

◆ operator==()

auto AstarteDeviceSdk::AstarteData::operator== ( const AstarteData & other) const -> bool
nodiscard

Overloader for the comparison operator ==.

Parameters
otherThe object to compare to.
Returns
True when equal, false otherwise.

◆ try_into()

template<AstarteDataAllowedType T>
auto AstarteDeviceSdk::AstarteData::try_into ( ) const -> std::optional<T>
inline

Convert the Astarte data class to the given type if it's the correct variant.

Returns
The value contained in the class instance or nullopt.

The documentation for this class was generated from the following file: