xentara-plugin v1.2.1
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::data Namespace Reference

Classes

class  DataType
 A custom type. 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>
using NativeTypeToCppType = __native_cpp_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 ,
  ErrorCode , Custom , None
}
 An enum describing different types of native C++ data used in read and write handles. More...
 
enum class  Quality : std::uint8_t { Good , Acceptable , Unreliable , Bad , internal }
 A Quality for a data point value. More...
 

Functions

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
 
auto operator<< (std::ostream &stream, Quality quality) -> std::ostream &
 Stream insertion operator for qualities.
 
auto make_error_code (ReadHandle::Error errorCode) -> std::error_code
 
auto make_error_code (WriteHandle::Error errorCode) -> std::error_code
 

Typedef Documentation

◆ NativeTypeToCppType

template<NativeType kNativeType>
using xentara::data::NativeTypeToCppType = typedef __native_cpp_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:

◆ Qualities

A combination of different qualities.

Enumeration Type Documentation

◆ NativeType

enum class xentara::data::NativeType
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().

See also
ReadHandle
WriteHandle
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, or a compatible type.

WString 

The best C++ type is std::wstring, or a compatible type.

U8String 

The best C++ type is std::u8string, or a compatible type.

U16String 

The best C++ type is std::u16string, or a compatible type.

U32String 

The best C++ type is std::u32string, or a compatible type.

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.

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()). 

◆ Quality

enum class xentara::data::Quality : std::uint8_t
strong

A Quality for a data point value.

See also
The Quality Attribute in the Xentara user manual
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).

Function Documentation

◆ make_error_code() [1/2]

auto xentara::data::make_error_code ( ReadHandle::Error  errorCode) -> std::error_code

◆ make_error_code() [2/2]

auto xentara::data::make_error_code ( WriteHandle::Error  errorCode) -> std::error_code

◆ operator<<()

auto xentara::data::operator<< ( std::ostream stream,
Quality  quality 
) -> std::ostream &

Stream insertion operator for qualities.

Parameters
streamThe stream
qualityThe quality value
Returns
The stream

◆ toBasicString()

template<utils::tools::CharType Char>
auto xentara::data::toBasicString ( Quality  quality) -> std::basic_string_view< Char >

Converts a quality value to a string.

Parameters
qualityThe quality value
Returns
A string containing the quality as a UTF-8 text

◆ toBasicString< char >()

template auto xentara::data::toBasicString< char > ( Quality  quality) -> std::basic_string_view< char >
extern

◆ toBasicString< char16_t >()

template auto xentara::data::toBasicString< char16_t > ( Quality  quality) -> std::basic_string_view< char16_t >
extern

◆ toBasicString< char32_t >()

template auto xentara::data::toBasicString< char32_t > ( Quality  quality) -> std::basic_string_view< char32_t >
extern

◆ toBasicString< char8_t >()

template auto xentara::data::toBasicString< char8_t > ( Quality  quality) -> std::basic_string_view< char8_t >
extern

◆ toBasicString< wchar_t >()

template auto xentara::data::toBasicString< wchar_t > ( Quality  quality) -> std::basic_string_view< wchar_t >
extern

◆ toString()

auto xentara::data::toString ( Quality  quality) -> std::string_view

Converts a quality value to a string of type char

Parameters
qualityThe quality value
Returns
A string containing the quality

◆ toU16String()

auto xentara::data::toU16String ( Quality  quality) -> std::u16string_view

Converts a quality value to a string of type char16_t

Parameters
qualityThe quality value
Returns
A string containing the quality

◆ toU32String()

auto xentara::data::toU32String ( Quality  quality) -> std::u32string_view

Converts a number to a string of type char32_t

Parameters
qualityThe quality value
Returns
A string containing the quality

◆ toU8String()

auto xentara::data::toU8String ( Quality  quality) -> std::u8string_view

Converts a quality value to a string of type char8_t

Parameters
qualityThe quality value
Returns
A string containing the quality

◆ toWString()

auto xentara::data::toWString ( Quality  quality) -> std::wstring_view

Converts a quality value to a string of type wchar_t

Parameters
qualityThe quality value
Returns
A string containing the quality