xentara-plugin v1.2
The Xentara Plugin Framework
|
A Xentara attribute. More...
#include <model/Attribute.hpp>
Classes | |
class | Role |
A built-in attribute role. More... | |
Public Types | |
enum | Category { Configuration , Setting , Information , State } |
Categories of attributes. More... | |
enum | Access { ReadOnly , WriteOnly , ReadWrite } |
An Access type for an attribute. More... | |
Public Member Functions | |
constexpr | Attribute (const Role &role, Access access, std::reference_wrapper< const data::DataType > dataType) |
Constructor for attributes with built-in roles. | |
constexpr | Attribute (const utils::core::Uuid &uuid, std::string_view name, Access access, std::reference_wrapper< const data::DataType > dataType, io::Directions ioDirections={}) |
Constructor for custom attributes. | |
auto | name () const -> const std::string_view & |
Gets the name. | |
auto | uuid () const -> const utils::core::Uuid & |
Gets the UUID. | |
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 | setAccess (Access access) -> void |
Sets the access modes. | |
auto | setDataType (std::reference_wrapper< const data::DataType > dataType) -> void |
Sets the data type. | |
auto | setIoDirections (io::Directions ioDirections) -> void |
Sets the relevant I/O directions. | |
auto | operator== (const Attribute &rhs) const -> bool |
Checks whether a reference refers to this attribute. | |
template<std::equality_comparable_with< std::string_view > String> | |
auto | operator== (const String &rhs) const -> bool |
Checks the name of the attribute. | |
Static Public Member Functions | |
template<std::equality_comparable_with< std::string_view > String, typename... Attributes> | |
static auto | resolve (const String &name, const Attribute &firstAttribute, const Attributes &... moreAttributes) -> const Attribute * |
Checks the name of a list of attributes and returns the first one that matches. | |
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 | 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 Roles | |
static const Role | kValue |
The role for a value. | |
static const Role | kError |
The standard name for an error. | |
static const Role | kWriteError |
The standard name for a write error. | |
Standard Names | |
static const std::string_view | kAddress |
The standard name for an address. | |
static const std::string_view | kOffset |
The standard name for an offset. | |
static const std::string_view | kLength |
The standard name for a length. | |
static const std::string_view | kChannel |
The standard name for a channel. | |
static const std::string_view | kDataType |
The role for a data type. | |
A Xentara attribute.
This class merely identifies the attribute, it does not represent the attribute of an individual element. To access the attribute of an element, use the type alias xentara::model::AttributeReference
|
constexpr |
Constructor for attributes with built-in roles.
role | The role of the attribute. |
access | The possible access modes for the attribute |
dataType | The data type of the attribute |
|
constexpr |
Constructor for custom attributes.
uuid | The UUID of the attribute |
name | The name of the attribute, in UTF-8 encoding. The string data the view references to is not copied. It must remain valid for the lifetime of the plugin. |
To keep naming conventions as consistent as possible between plugins, Xentara provides a set of predefined attribute names. All things being equal, you should prefer using one of the predefines names. If the documentation, the specification, or common usage for your plugin use different nomenclature, however, you should prefer that over the standard names.
If your attribute references another element, you sould use the name of the element. If your attribute references an I/O device, for example, you should use xentara::io::ComponentClass::kDevice as the name.
access | The possible access modes for the attribute |
dataType | The data type of the attribute |
ioDirections | The relevant 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 I/O points. If the directions contain the flag io::Direction::Input, then the data point will inherit this attribute from its input I/O point. If the directions contain the flag io::Direction::Output, then the data point will inherit this attribute from its output I/O point. If you do not set either flag (the default), then the attribute will not be considered an I/O attribute and will not be inherited.
auto xentara::model::Attribute::access | ( | ) | const -> Access |
Gets the access modes.
auto xentara::model::Attribute::dataType | ( | ) | const -> const data::DataType & |
Gets the data type.
auto xentara::model::Attribute::ioDirections | ( | ) | const -> io::Directions |
Gets the relevant I/O directions.
auto xentara::model::Attribute::name | ( | ) | const -> const std::string_view & |
Gets the name.
auto xentara::model::Attribute::operator== | ( | const Attribute & | rhs | ) | const -> bool |
Checks whether a reference refers to this attribute.
This operator checks the identity of the objects, not the properties. The operator returns true only if the rhs refers to the same object as this. It is equivalent to this == std::addressof(rhs)
.
auto xentara::model::Attribute::operator== | ( | const String & | rhs | ) | const -> bool |
Checks the name of the attribute.
This is a convenience operator you can use to check the name of an attribute when resolving it. It is equivalent to name() == rhs
.
|
static |
Checks the name of a list of attributes and returns the first one that matches.
This function can be used in xentara::io::Component::resolveAttribute(), xentara::io::Io::resolveAttribute(), xentara::io::IoBatch::resolveAttribute(), or xentara::process::Microservice::resolveAttribute() to resolve a list of attributes by name.
name | The name of the desired attribute, in UTF-8 encoding |
firstAttribute | The first attribute to check |
moreAttributes | Additional attributes to check |
auto xentara::model::Attribute::setAccess | ( | Access | access | ) | -> void |
Sets the access modes.
auto xentara::model::Attribute::setDataType | ( | std::reference_wrapper< const data::DataType > | dataType | ) | -> void |
Sets the data type.
auto xentara::model::Attribute::setIoDirections | ( | io::Directions | ioDirections | ) | -> void |
Sets the relevant I/O directions.
ioDirections | The desired 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 I/O points. |
auto xentara::model::Attribute::uuid | ( | ) | const -> const utils::core::Uuid & |
Gets the UUID.
|
static |
The standard name for an address.
|
static |
The attribute for the change time stamp of a value.
|
static |
The standard name for a channel.
|
static |
The role for a data type.
|
static |
The attribute for the state of a device.
|
static |
The standard name for an error.
|
static |
The standard name for a length.
|
static |
The attribute for the name of an element.
|
static |
The standard name for an offset.
|
static |
The attribute for the primary key of an element.
|
static |
The attribute for the quality of a value.
|
static |
The attribute for the time stamp of a value provided by the data source, like the device.
|
static |
The attribute for the update time stamp of a value.
|
static |
The attribute for the UUID of an element.
|
static |
The role for a value.
|
static |
The standard name for a write error.
|
static |
The attribute for the time stamp of the last attempted write operation of an output.