xentara-plugin v2.0.4
The Xentara Plugin Framework
|
Classes | |
class | DataType |
A custom type. More... | |
class | FixedValue |
A helper class that allows constructing read handles that return fixed values. More... | |
class | ReadHandle |
A handle for reading a data value. More... | |
class | WriteHandle |
A handle for writing a data value. More... | |
Typedefs | |
template<NativeType kNativeType, TypeUsage kUsage = TypeUsage::Get> | |
using | NativeTypeToCppType = typename __opaque_find_native_cpp_type__< kNativeType, kUsage >::type |
The C++ type associated with a specific NativeType enum. | |
using | Qualities = utils::core::Flags< Quality > |
A combination of different qualities. | |
Enumerations | |
enum class | NativeType { Boolean , Integer , UnsignedInteger , FloatingPoint , String , WString , U8String , U16String , U32String , TimePoint , Uuid , Quality , ElementCategory , ErrorCode , Custom , None } |
An enum describing different types of native C++ data used in read and write handles. More... | |
enum class | TypeUsage { Get , Put } |
usage for a type when converting between NativeType and C++ types More... | |
enum class | Quality : std::uint8_t { Good , Acceptable , Unreliable , Bad , internal } |
A Quality for a data point value. More... | |
Functions | |
template<typename CppType > | |
constexpr auto | cppTypeToNativeType (TypeUsage usage=TypeUsage::Put) noexcept -> NativeType |
Find the correct NativeType enum to use for a C++ type. | |
template<utils::tools::CharType Char> | |
auto | toBasicString (Quality quality) -> std::basic_string_view< Char > |
Converts a quality value to a string. | |
template auto | toBasicString< char > (Quality quality) -> std::basic_string_view< char > |
template auto | toBasicString< wchar_t > (Quality quality) -> std::basic_string_view< wchar_t > |
template auto | toBasicString< char8_t > (Quality quality) -> std::basic_string_view< char8_t > |
template auto | toBasicString< char16_t > (Quality quality) -> std::basic_string_view< char16_t > |
template auto | toBasicString< char32_t > (Quality quality) -> std::basic_string_view< char32_t > |
auto | toString (Quality quality) -> std::string_view |
Converts a quality value to a string of type char | |
auto | toWString (Quality quality) -> std::wstring_view |
Converts a quality value to a string of type wchar_t | |
auto | toU8String (Quality quality) -> std::u8string_view |
Converts a quality value to a string of type char8_t | |
auto | toU16String (Quality quality) -> std::u16string_view |
Converts a quality value to a string of type char16_t | |
auto | toU32String (Quality quality) -> std::u32string_view |
Converts a number to a string of type char32_t | |
constexpr auto | isBetter (Quality quality, Quality referenceQuality) noexcept -> bool |
Determines if one quality is better than another quality. | |
constexpr auto | isWorse (Quality quality, Quality referenceQuality) noexcept -> bool |
Determines if one quality is worse than another quality. | |
template<std::convertible_to< Quality >... MoreQualities> | |
constexpr auto | combine (Quality firstQuality, MoreQualities &&... moreQualities) noexcept -> Quality |
Picks the worse of a number of qualities. | |
constexpr auto | isUsable (Quality quality) noexcept -> bool |
Determines if a quality is usable, i.e. if the corresponding value can be relied upon. | |
template<typename Error1 , typename Error2 > | |
constexpr auto | selectError (Quality quality1, Error1 &&error1, Quality quality2, Error2 &&error2) -> std::common_type< Error1, Error2 > |
Selects one of two error messages depending on two corresponding qualities. | |
auto | operator<< (std::ostream &stream, Quality quality) -> std::ostream & |
Stream insertion operator for qualities. | |
auto | operator<< (utils::cbor::Encoder &encoder, Quality quality) -> utils::cbor::Encoder & |
Encodes a quality to a CBOR encoder. | |
auto | operator>> (utils::cbor::Decoder &decoder, Quality &quality) -> utils::cbor::Decoder & |
Decodes a quality from a CBOR encoder. | |
template<class Type > | |
FixedValue (Type) -> FixedValue< Type > | |
Deduction guide for a fixed value passed by value. | |
template auto | ReadHandle::read< std::string > () const -> utils::eh::expected< std::string, std::error_code > |
template auto | ReadHandle::read< std::wstring > () const -> utils::eh::expected< std::wstring, std::error_code > |
template auto | ReadHandle::read< std::u8string > () const -> utils::eh::expected< std::u8string, std::error_code > |
template auto | ReadHandle::read< std::u16string > () const -> utils::eh::expected< std::u16string, std::error_code > |
template auto | ReadHandle::read< std::u32string > () const -> utils::eh::expected< std::u32string, std::error_code > |
template auto | ReadHandle::read< std::chrono::system_clock::time_point > () const -> utils::eh::expected< std::chrono::system_clock::time_point, std::error_code > |
template auto | ReadHandle::read< utils::core::Uuid > () const -> utils::eh::expected< utils::core::Uuid, std::error_code > |
template auto | ReadHandle::read< model::ElementCategory > () const -> utils::eh::expected< model::ElementCategory, std::error_code > |
template auto | ReadHandle::read< std::error_code > () const -> utils::eh::expected< std::error_code, std::error_code > |
using xentara::data::NativeTypeToCppType = typedef typename __opaque_find_native_cpp_type__<kNativeType, kUsage>::type |
The C++ type associated with a specific NativeType enum.
This type alias represents the C++ type associated with a particular NativeType value.
Special cases:
kNativeType | The native type to use. If kNativeType is NativeType::None, this type is an alias for a non-existent type. |
kUsage | The usage for the C++ type, used to determine how handle string types. If you specify TypeUsage::Get, then string types will map to the appropriate specialization of std::basic_string, suitable for storing strings. If you specify TypeUsage::Put, then string types will will map to the appropriate specialization of std::basic_string_view, suitable for passing stored strings to consumers. |
using xentara::data::Qualities = typedef utils::core::Flags<Quality> |
A combination of different qualities.
#include <xentara/data/Quality.hpp>
|
strong |
An enum describing different types of native C++ data used in read and write handles.
This enum provides a hint as to the best C++ data type to use when calling ReadHandle::read() or WriteHandle::write().
Enumerator | |
---|---|
Boolean | The best C++ type is bool |
Integer | The best C++ type is std::intmax_t. |
UnsignedInteger | The best C++ type is std::uintmax_t. |
FloatingPoint | The best C++ type is double |
String | The best C++ type is std::string for reading and std::string_view for writing. |
WString | The best C++ type is std::wstring for reading and std::wstring_view for writing. |
U8String | The best C++ type is std::u8string for reading and std::u8string_view for writing. |
U16String | The best C++ type is std::u16string for reading and std::u16string_view for writing. |
U32String | The best C++ type is std::u32string for reading and std::u32string_view for writing. |
TimePoint | The best C++ type is std::chrono::system_clock::time_point. |
Uuid | The best C++ type is xentara::utils::core::Uuid. |
Quality | The best C++ type is xentara::data::Quality. |
ElementCategory | The best C++ type is xentara::model::ElementCategory. |
ErrorCode | The best C++ type is std::error_code. |
Custom | The best C++ type is some custom type specific to some plugin. This enum value denotes that the data is stored internally as some custom type specific to a plugin, like a custom enum type. |
None | The handle is does not represent any data. This type is used for error handles. Error handles are handles that never read or write any data, but always return an error from [read()](@ref ReadHandle::read()) or [write(@ref ]WriteHandle::write()). |
|
strong |
A Quality for a data point value.
#include <xentara/data/Quality.hpp>
Enumerator | |
---|---|
Good | The value was successfully acquired. Values with this quality have been acquired in the normal way without any errors or issues. |
Acceptable | The value was acquired in an acceptable way, but some problem occurred. Values with this quality were acquired successfully, but may have reduced precision or accuracy. This may be due to using an alternate, inferior data source, to some non-critical error situation, or because a sensor or such is operating under conditions where the accuracy is reduced. Values with quality Quality::Acceptable can still be used as inputs to control circuits, simulations, etc., but the results may not be as good as when using values with quality Quality::Good. Calculated or derived values that are based on values with this quality should themselves not be flagged with a quality better than Quality::Acceptable. |
Unreliable | There was a problem acquiring the value, and it should not be relied upon. Values with this quality can used for informational purposes, but are not reliable enough for system critical uses, such as control ciruits, safety systems, etc. Calculated or derived values that are based on values with this quality should themselves not be flagged with a quality better than Quality::Unreliable. |
Bad | The value could not be acquired correctly. Values with this quality either could not be acquired at all, or a serious error was encountered, like exceeding the range of a sensor. Calculated or derived values that are based on values with this quality should themselves be flagged as Quality::Bad. Expensive operations, such as executing FMUs or AI models, can be skipped altogether, and some default or fallback value used as the output instead (also with quality Quality::Bad, of course). |
|
strong |
|
constexprnoexcept |
Picks the worse of a number of qualities.
firstQuality | The first quality to consider |
moreQualities | Any number of additional qualities to consider |
#include <xentara/data/Quality.hpp>
|
constexprnoexcept |
Find the correct NativeType enum to use for a C++ type.
This function returns the NativeType value that is used for a specific C++ type.
This template is available for all C++ types, not only the canonical native C++ type, as returned by NativeTypeToCppType. For non-canonical types, the function will return the best fitting native type.
If no suitable standard NativeType value is exists, then the function will return value NativeType::Custom.
CppType | The C++ type to convert. References and cv-qualifiers are removed using std::remove_cvref before checking the type. The type is not limited to the canonical native C++ type, as returned by NativeTypeToCppType, any C++ type can be used, and the best fitting NativeType value will be returned. |
usage | The usage for the C++ type. Specify TypeUsage::Get if you are reading the value from producer, and TypeUsage::Put if you are writing the value to a aconsumer. This will affect some types:
|
xentara::data::FixedValue | ( | Type | ) | -> FixedValue< Type > |
Deduction guide for a fixed value passed by value.
|
constexprnoexcept |
Determines if one quality is better than another quality.
quality | The quality value to check |
referenceQuality | The quality value to compare with |
#include <xentara/data/Quality.hpp>
|
constexprnoexcept |
Determines if a quality is usable, i.e. if the corresponding value can be relied upon.
quality | The quality value to check |
#include <xentara/data/Quality.hpp>
|
constexprnoexcept |
Determines if one quality is worse than another quality.
quality | The quality value to check |
referenceQuality | The quality value to compare with |
#include <xentara/data/Quality.hpp>
auto xentara::data::operator<< | ( | std::ostream & | stream, |
Quality | quality | ||
) | -> std::ostream & |
Stream insertion operator for qualities.
stream | The stream |
quality | The quality value |
#include <xentara/data/Quality.hpp>
auto xentara::data::operator<< | ( | utils::cbor::Encoder & | encoder, |
Quality | quality | ||
) | -> utils::cbor::Encoder & |
Encodes a quality to a CBOR encoder.
encoder | The encoder |
quality | The quality |
auto xentara::data::operator>> | ( | utils::cbor::Decoder & | decoder, |
Quality & | quality | ||
) | -> utils::cbor::Decoder & |
Decodes a quality from a CBOR encoder.
decoder | The decoder |
quality | The quality |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
constexpr |
Selects one of two error messages depending on two corresponding qualities.
quality1 | The quality that corresponds to error1 |
error1 | The error that corresponds to quality1 |
quality2 | The quality that corresponds to error2 |
error2 | The error that corresponds to quality2 |
#include <xentara/data/Quality.hpp>
auto xentara::data::toBasicString | ( | Quality | quality | ) | -> std::basic_string_view< Char > |
Converts a quality value to a string.
quality | The quality value |
#include <xentara/data/Quality.hpp>
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
auto xentara::data::toString | ( | Quality | quality | ) | -> std::string_view |
Converts a quality value to a string of type char
quality | The quality value |
#include <xentara/data/Quality.hpp>
auto xentara::data::toU16String | ( | Quality | quality | ) | -> std::u16string_view |
Converts a quality value to a string of type char16_t
quality | The quality value |
#include <xentara/data/Quality.hpp>
auto xentara::data::toU32String | ( | Quality | quality | ) | -> std::u32string_view |
Converts a number to a string of type char32_t
quality | The quality value |
#include <xentara/data/Quality.hpp>
auto xentara::data::toU8String | ( | Quality | quality | ) | -> std::u8string_view |
Converts a quality value to a string of type char8_t
quality | The quality value |
#include <xentara/data/Quality.hpp>
auto xentara::data::toWString | ( | Quality | quality | ) | -> std::wstring_view |
Converts a quality value to a string of type wchar_t
quality | The quality value |
#include <xentara/data/Quality.hpp>