DataObject¶
Description¶
The DataObject object provides common properties and metadata for all kinds of objects storing data.
› Inherits: | Object |
---|---|
› Inherited by: | ConfigurationItem, DateTime, Event, Measurement |
Properties¶
data¶
This property holds the actual data represented by the object. It can be of any of the supported data types. Any actual changes to value or type of the value will trigger the dataChanged() signal.
› Type: | Variant |
---|---|
› Signal: | dataChanged() |
› Attributes: | Writable |
dataType¶
This property can be used to explicitely specify the data type for cases where the data property is not yet initialized and the default data value has is used instead. This is primarily used for initializing database table structures with correct data types for the columns.
› Type: | DataType |
---|---|
› Default: | DataObject.Invalid |
› Signal: | dataTypeChanged() |
› Attributes: | Writable, Optional |
description¶
This property holds a description of the data object and may contain an arbitrarily formatted string, usually used for display and user interface purposes.
› Type: | String |
---|---|
› Signal: | descriptionChanged() |
› Attributes: | Writable, Optional |
name¶
This property holds the name of the data object and may contain an arbitrarily formatted string, usually used for display and user interface purposes.
› Type: | String |
---|---|
› Signal: | nameChanged() |
› Attributes: | Writable, Optional |
timestamp¶
This property holds a timestamp in milliseconds of the last data update. The timestamp is updated even if writing the data property did not actually change it due to identical data. It therefore can be used to retrieve, e.g. the time of the last successful measurement or when an event was fired.
› Type: | SignedBigInteger |
---|---|
› Signal: | timestampChanged() |
› Attributes: | Writable |
uuid¶
This property holds a UUID (Universally Unique Identifier). The UUID can be used for identifying data objects across applications.
› Type: | String |
---|---|
› Signal: | uuidChanged() |
› Attributes: | Writable, Optional |
view¶
This property holds an optionally attached view for the data object. Views are used for representing and displaying a DataObject in a user-defined frontend. See the documentation of DataObjectView for details.
› Type: | DataObjectView |
---|---|
› Signal: | viewChanged() |
› Attributes: | Writable, Optional |
Methods¶
Enumerations¶
DataType¶
This enumeration describes all possible types of data which can be represented by the data property.
Name | Value | Description |
---|---|---|
DataObject.Invalid |
0 |
An invalid data type used for representing null values. |
DataObject.Boolean |
1 |
A boolean which can be true or false . |
DataObject.Date |
2 |
A date object representing a calendar date without time. |
DataObject.Time |
3 |
A time object representing a relative time without a date. |
DataObject.DateTime |
4 |
A date time object representing an absolute date and time. |
DataObject.Float |
5 |
A single precision floating point number. |
DataObject.Double |
6 |
A double precision floating point number. |
DataObject.SignedInteger |
7 |
A signed 32 bit integer. |
DataObject.UnsignedInteger |
8 |
An unsigned 32 bit integer. |
DataObject.SignedBigInteger |
9 |
A signed 64 bit integer. |
DataObject.UnsignedBigInteger |
10 |
An unsigned 64 bit integer. |
DataObject.String |
11 |
A variable-length UTF-8 character string. |
DataObject.StringList |
12 |
A list of variable-length UTF-8 character strings. |
DataObject.SignedSmallInteger |
13 |
A signed 16 bit integer. |
DataObject.UnsignedSmallInteger |
14 |
An unsigned 16 bit integer. |
Example¶
import InCore.Foundation 2.5
Application {
DataObject {
id: testObject
// name of this object - used for example by DataObjectWriters (e.g. CsvWriter)
name: "Awesome object"
description: "This is your awesome object example."
// data can be of any supported data type but usually it is some numeric value
data: 42
// a signed 64 bit integer
dataType: DataObject.SignedBigInteger
onTimestampChanged: console.log( "data has been changed to", data )
view: DataObjectView {
hidden: false // default
readOnly: true // only a hint for the frontend
orderIndex: 0 // would appear at first if other widget would be added
widget: DataObjectView.Slider // show a read only slider
}
}
}