xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
Loading...
Searching...
No Matches
xentara::workbench::model::Attribute Class Referencefinal

A description of a Xentara attribute. More...

#include <xentara/workbench/model/Attribute.hpp>

Public Types

enum class  Access { ReadOnly , WriteOnly , ReadWrite }
 An Access type for an attribute. More...
 

Public Member Functions

template<std::convertible_to< std::string_view > Name>
 Attribute (Name &&name, Access access, data::DataType dataType, io::Directions ioDirections={})
 Constructor.
 
 Attribute (std::string &&name, Access access, data::DataType dataType, io::Directions ioDirections={})
 Constructor that moves a name from an existing std::string.
 
constexpr auto name () const noexcept -> std::string_view
 Gets the name.
 
auto access () const -> Access
 Gets the access modes.
 
auto dataType () const -> const data::DataType &
 Gets the data type.
 
auto ioDirections () const -> io::Directions
 Gets the relevant I/O directions.
 
auto changeEvent () const &noexcept -> const process::Event &
 Gets the change event associated with this attribute.
 
auto changeEvent () &&noexcept -> process::Event &&
 Gets the change event associated with this attribute.
 
Reconfiguring the Attribute
auto setAccess (Access access) -> bool
 Sets the access modes.
 
auto setDataType (const data::DataType &dataType) -> bool
 Sets the data type.
 

Static Public Attributes

Standard Attributes
static const Attribute kPrimaryKey
 The attribute for the primary key of an element.
 
static const Attribute kName
 The attribute for the name of an element.
 
static const Attribute kUuid
 The attribute for the UUID of an element.
 
static const Attribute kType
 The attribute for the type (class) of an element.
 
static const Attribute kCategory
 The attribute for the element category of an element.
 
static const Attribute kSourceTime
 The attribute for the time stamp of a value provided by the data source, like the device.
 
static const Attribute kUpdateTime
 The attribute for the update time stamp of a value.
 
static const Attribute kChangeTime
 The attribute for the change time stamp of a value.
 
static const Attribute kWriteTime
 The attribute for the time stamp of the last attempted write operation of an output.
 
static const Attribute kQuality
 The attribute for the quality of a value.
 
static const Attribute kDeviceState
 The attribute for the state of a device.
 
Standard Attributes with Templated Properties
template<Access kAccess, data::PrimitiveType kType, int kBitSize = defaultBitSize(kType)>
static const Attribute kValue
 The attribute for a value.
 
template<data::PrimitiveType kType, int kBitSize = defaultBitSize(kType)>
static const Attribute kError
 The attribute for an error.
 
template<data::PrimitiveType kType, int kBitSize = defaultBitSize(kType)>
static const Attribute kWriteError
 The attribute for a write error.
 
Standard Names
static const std::string kAddress
 The standard name for an address.
 
static const std::string kOffset
 The standard name for an offset.
 
static const std::string kLength
 The standard name for a length.
 
static const std::string kChannel
 The standard name for a channel.
 
static const std::string kDataType
 The role for a data type.
 

Detailed Description

A description of a Xentara attribute.

Member Enumeration Documentation

◆ Access

An Access type for an attribute.

Enumerator
ReadOnly 

The attribute supports reading only.

WriteOnly 

The attribute supports writing only.

ReadWrite 

The attribute supports reading and writing.

Constructor & Destructor Documentation

◆ Attribute() [1/2]

template<std::convertible_to< std::string_view > Name>
xentara::workbench::model::Attribute::Attribute ( Name &&  name,
Access  access,
data::DataType  dataType,
io::Directions  ioDirections = {} 
)
explicit

Constructor.

Parameters
nameThe name of the event, in UTF-8 encoding.
accessThe possible access modes for the attribute
dataTypeThe data type of the attribute
ioDirectionsThe I/O directions. The I/O directions are used for I/O attributes to specify whether a data point should inherit this attribute from its attached input and/or output.

◆ Attribute() [2/2]

xentara::workbench::model::Attribute::Attribute ( std::string &&  name,
Access  access,
data::DataType  dataType,
io::Directions  ioDirections = {} 
)
explicit

Constructor that moves a name from an existing std::string.

Parameters
nameThe name of the event, in UTF-8 encoding.
accessThe possible access modes for the attribute
dataTypeThe data type of the attribute
ioDirectionsThe I/O directions. The I/O directions are used for I/O attributes to specify whether a data point should inherit this attribute from its attached input and/or output.

Member Function Documentation

◆ access()

auto xentara::workbench::model::Attribute::access ( ) const -> Access

Gets the access modes.

◆ changeEvent() [1/2]

auto xentara::workbench::model::Attribute::changeEvent ( ) && -> process::Event &&
noexcept

Gets the change event associated with this attribute.

◆ changeEvent() [2/2]

auto xentara::workbench::model::Attribute::changeEvent ( ) const & -> const process::Event &
noexcept

Gets the change event associated with this attribute.

◆ dataType()

auto xentara::workbench::model::Attribute::dataType ( ) const -> const data::DataType &

Gets the data type.

◆ ioDirections()

auto xentara::workbench::model::Attribute::ioDirections ( ) const -> io::Directions

Gets the relevant I/O directions.

Returns
The I/O directions. The I/O directions are used for I/O attributes to specify whether a data point should inherit this attribute from its attached input and/or output.

◆ name()

constexpr auto xentara::workbench::model::Attribute::name ( ) const -> std::string_view
constexprnoexcept

Gets the name.

Returns
The name of the attribute, in UTF-8 encoding.

◆ setAccess()

auto xentara::workbench::model::Attribute::setAccess ( Access  access) -> bool

Sets the access modes.

Parameters
accessThe new access modes
Returns
Returns true if something has changed, or false if the new access mode it the same as the old one

◆ setDataType()

auto xentara::workbench::model::Attribute::setDataType ( const data::DataType dataType) -> bool

Sets the data type.

Parameters
dataTypeThe new data type
Returns
Returns true if something has changed, or false if the new data type it the same as the old one

Member Data Documentation

◆ kAddress

const std::string xentara::workbench::model::Attribute::kAddress
static

The standard name for an address.

◆ kCategory

const Attribute xentara::workbench::model::Attribute::kCategory
static

The attribute for the element category of an element.

◆ kChangeTime

const Attribute xentara::workbench::model::Attribute::kChangeTime
static

The attribute for the change time stamp of a value.

◆ kChannel

const std::string xentara::workbench::model::Attribute::kChannel
static

The standard name for a channel.

◆ kDataType

const std::string xentara::workbench::model::Attribute::kDataType
static

The role for a data type.

◆ kDeviceState

const Attribute xentara::workbench::model::Attribute::kDeviceState
static

The attribute for the state of a device.

◆ kError

template<data::PrimitiveType kPrimitiveType, int kBitSize>
const Attribute xentara::workbench::model::Attribute::kError
static

The attribute for an error.

Template Parameters
kTypeThe primitive type of the attribute’s value
kBitSizeThe bit size of the attribute’s value

◆ kLength

const std::string xentara::workbench::model::Attribute::kLength
static

The standard name for a length.

◆ kName

const Attribute xentara::workbench::model::Attribute::kName
static

The attribute for the name of an element.

◆ kOffset

const std::string xentara::workbench::model::Attribute::kOffset
static

The standard name for an offset.

◆ kPrimaryKey

const Attribute xentara::workbench::model::Attribute::kPrimaryKey
static

The attribute for the primary key of an element.

◆ kQuality

const Attribute xentara::workbench::model::Attribute::kQuality
static

The attribute for the quality of a value.

◆ kSourceTime

const Attribute xentara::workbench::model::Attribute::kSourceTime
static

The attribute for the time stamp of a value provided by the data source, like the device.

◆ kType

const Attribute xentara::workbench::model::Attribute::kType
static

The attribute for the type (class) of an element.

◆ kUpdateTime

const Attribute xentara::workbench::model::Attribute::kUpdateTime
static

The attribute for the update time stamp of a value.

◆ kUuid

const Attribute xentara::workbench::model::Attribute::kUuid
static

The attribute for the UUID of an element.

◆ kValue

template<Attribute::Access kAccess, data::PrimitiveType kPrimitiveType, int kBitSize>
const Attribute xentara::workbench::model::Attribute::kValue
static

The attribute for a value.

Template Parameters
kAccessThe possible access modes for the attribute
kTypeThe primitive type of the attribute’s value
kBitSizeThe bit size of the attribute’s value

◆ kWriteError

template<data::PrimitiveType kPrimitiveType, int kBitSize>
const Attribute xentara::workbench::model::Attribute::kWriteError
static

The attribute for a write error.

Template Parameters
kTypeThe primitive type of the attribute’s value
kBitSizeThe bit size of the attribute’s value

◆ kWriteTime

const Attribute xentara::workbench::model::Attribute::kWriteTime
static

The attribute for the time stamp of the last attempted write operation of an output.