Attribute subtypes¶
Several Attribute subclasses have been defined to answer the reusable characteristics of the
attributes needed for various EFLR objects. The overview can be seen in the diagram below.
---
title: Attribute and its subtypes
---
classDiagram
Attribute <|-- EFLRAttribute
EFLRAttribute <|-- EFLROrTextAttribute
Attribute <|-- DTimeAttribute
Attribute <|-- NumericAttribute
NumericAttribute <|-- DimensionAttribute
Attribute <|-- StatusAttribute
Attribute <|-- TextAttribute
Attribute <|-- IdentAttribute
IdentAttribute <|-- PropertiesAttribute
class Attribute{
+str label
+Any value
+str units
+int count
+RepresentationCode representation_code
+[EFLRItem, EFLRSet] parent_eflr
+Callable converter
+bool multivalued
+bool multidimensional
-tuple _valid_repr_codes
-bool _units_settable
-RepresentationCode _default_repr_code
+convert_value()
+get_as_bytes()
+copy()
}
class EFLRAttribute{
-type _object_class
-_convert_value()
}
class DTimeAttribute{
+list~str~ dtime_formats
-bool _allow_float
+parse_dtime()
}
class NumericAttribute{
-bool _int_only
-bool _float_only
-_int_parser()
-_float_parser()
-_convert_number()
}
class StatusAttribute{
+convert_status()
}
class TextAttribute{
_check_string()
}
class IdentAttribute{
}
class PropertiesAttribute{
}
EFLRAttribute has been defined to deal with attributes which should keep reference to other
EFLRItems - for example, Channels of Frame, Zones of Splice,
Calibration Coefficients and Calibration Measurements of Calibration.
The value of an EFLRAttribute is an instance of (usually specific subtype of) EFLRItem.
The representation code can be either OBNAME or OBJREF. The unit should not be defined (is meaningless).
Its subclass, EFLROrTextAttribute, is similar, but in addition accepts plain text as value
(represented as ASCII). This subclass is meant for the long_name attribute of Channel,
Process, and Computation; the value of this attribute can be either text
or a LongNameItem object (see Long Name).
DTimeAttribute is meant for keeping time reference, either in the form of a datetime.datetime object
or a number, indicating time since a specific event. The representation code is adapted
to the value: DTIME for datetime objects, otherwise any numeric code (e.g. FDOUBl, USHORT, etc.)
The unit should be defined if the value is a number and should express the unit of time
(‘s’ for seconds, ‘min’ for minutes, etc.).
NumericAttribute keeps numerical data - in the form of int(s) or float(s). It is possible
to restrict the type of accepted values to ints only or floats only at initialisation of the attribute.
DimensionAttribute is a subclass of NumericAttribute. It limits the above to ints only and is always
multivalued (always a list of integers). It is mainly used in Channel objects where it describes
the shape of the data (only the width, i.e. the number of columns).
StatusAttribute encodes the status of Tool and Equipment objects.
Its value can only be 0 or 1.
IdentAttribute is any Attribute represented using the IDENT representation code.
PropertiesAttribute is meant for properties Attribute of Channel, Computation, and Process.
It includes a converter which checks if all the provided values belong to the standard-specified set.
PropertiesAttribute is always multivalued.