Class Datapoint
Data point abstraction. Consists of a timestamp and a double or string value
Inherited Members
Namespace: Cognite.Extensions
Assembly: Cognite.Extensions.dll
Syntax
public class Datapoint
Constructors
| Edit this page View SourceDatapoint(DateTime, bool, StatusCode?, bool)
Creates a data point without a value. You still need to specify whether the time series it is being written to is a string or numeric time series. Default quality is bad.
Declaration
public Datapoint(DateTime timestamp, bool isString, StatusCode? statusCode = null, bool isState = false)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | timestamp | Timestamp |
| bool | isString | Whether the time series is string. |
| StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
| bool | isState | Whether the time series is a state time series. |
Datapoint(DateTime, double, StatusCode?)
Creates a numeric data point
Declaration
public Datapoint(DateTime timestamp, double numericValue, StatusCode? statusCode = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | timestamp | Timestamp |
| double | numericValue | double value |
| StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(DateTime, double, string, StatusCode?)
Creates a state data point with a string and numeric value. This is used for the beta state timeseries endpoint.
Declaration
public Datapoint(DateTime timestamp, double numericValue, string str, StatusCode? statusCode = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | timestamp | Timestamp |
| double | numericValue | double value |
| string | str | string value |
| StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(DateTime, string?, StatusCode?)
Creates a string data point
Declaration
public Datapoint(DateTime timestamp, string? stringValue, StatusCode? statusCode = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | timestamp | Timestamp |
| string | stringValue | string value |
| StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(long, bool, StatusCode?, bool)
Creates a data point without a value. You still need to specify whether the time series it is being written to is a string or numeric time series.
Declaration
public Datapoint(long timestamp, bool isString, StatusCode? statusCode = null, bool isState = false)
Parameters
| Type | Name | Description |
|---|---|---|
| long | timestamp | Timestamp |
| bool | isString | Whether the time series is string. |
| StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
| bool | isState | Whether the time series is a state time series. |
Datapoint(long, double, StatusCode?)
Creates a numeric data point
Declaration
public Datapoint(long timestamp, double numericValue, StatusCode? statusCode = null)
Parameters
| Type | Name | Description |
|---|---|---|
| long | timestamp | Timestamp |
| double | numericValue | double value |
| StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(long, double?, string?, StatusCode?)
Creates a state data point with a string and/or numeric value. This is used for the beta state timeseries endpoint.
Declaration
public Datapoint(long timestamp, double? numericValue, string? str, StatusCode? statusCode = null)
Parameters
| Type | Name | Description |
|---|---|---|
| long | timestamp | Timestamp |
| double? | numericValue | double value |
| string | str | string value |
| StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(long, string?, StatusCode?)
Creates a string data point
Declaration
public Datapoint(long timestamp, string? stringValue, StatusCode? statusCode = null)
Parameters
| Type | Name | Description |
|---|---|---|
| long | timestamp | Timestamp |
| string | stringValue | string value |
| StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Properties
| Edit this page View SourceIsState
True if datapoint is a state datapoint, carrying both a numeric and a string value. This is used for the beta state timeseries endpoint.
Declaration
public bool IsState { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsString
True if datapoint is string
Declaration
public bool IsString { get; }
Property Value
| Type | Description |
|---|---|
| bool |
NumericValue
Optional double value
Declaration
public double? NumericValue { get; }
Property Value
| Type | Description |
|---|---|
| double? |
Status
Datapoint status code.
Declaration
public StatusCode Status { get; }
Property Value
| Type | Description |
|---|---|
| StatusCode |
StringValue
Optional string value
Declaration
public string? StringValue { get; }
Property Value
| Type | Description |
|---|---|
| string |
Timestamp
Timestamp in Unix time milliseconds
Declaration
public long Timestamp { get; }
Property Value
| Type | Description |
|---|---|
| long |
Methods
| Edit this page View SourceFromStream(Stream)
Initializes Datapoint by reading from a stream. Requires that the next bytes in the stream represent a datapoint.
Declaration
public static Datapoint? FromStream(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | Stream to read from |
Returns
| Type | Description |
|---|---|
| Datapoint |
ToStorableBytes()
Convert datapoint into an array of bytes on the form [long timestamp][byte kind (0 = numeric, 1 = string, 2 = state)][ulong statusCode] {[double value] or [ushort length][string value] or [double value][ushort length][string value]}. The kind byte occupies the same slot and size as the old boolean isString flag, so existing numeric (0)/string (1) records on disk remain readable.
Declaration
public byte[] ToStorableBytes()
Returns
| Type | Description |
|---|---|
| byte[] |