ctrlX Data Layer API for Python  3.3.0
The ctrlX Data Layer API allows access to the ctrlX Data Layer with Python
Variant Class Reference
+ Inheritance diagram for Variant:

Public Member Functions

def __init__ (self, C_DLR_VARIANT c_variant=None)
 
def __del__ (self)
 
def __enter__ (self)
 
def __exit__ (self, exc_type, exc_val, exc_tb)
 
Result check_convert (self, VariantType datatype)
 
def clone (self)
 
def close (self)
 
typing.List[bool] get_array_bool8 (self)
 
typing.List[datetime.datetime] get_array_datetime (self)
 
typing.List[float] get_array_float32 (self)
 
typing.List[float] get_array_float64 (self)
 
typing.List[int] get_array_int16 (self)
 
typing.List[int] get_array_int32 (self)
 
typing.List[int] get_array_int64 (self)
 
typing.List[int] get_array_int8 (self)
 
typing.List[str] get_array_string (self)
 
typing.List[int] get_array_uint16 (self)
 
typing.List[int] get_array_uint32 (self)
 
typing.List[int] get_array_uint64 (self)
 
typing.List[int] get_array_uint8 (self)
 
bool get_bool8 (self)
 
int get_count (self)
 
bytearray get_data (self)
 
datetime.datetime get_datetime (self)
 
bytearray get_flatbuffers (self)
 
float get_float32 (self)
 
float get_float64 (self)
 
def get_handle (self)
 
int get_int16 (self)
 
int get_int32 (self)
 
int get_int64 (self)
 
int get_int8 (self)
 
int get_size (self)
 
str get_string (self)
 
VariantType get_type (self)
 
int get_uint16 (self)
 
int get_uint32 (self)
 
int get_uint64 (self)
 
int get_uint8 (self)
 
Result set_array_bool8 (self, typing.List[bool] data)
 
Result set_array_datetime (self, typing.List[datetime.datetime] data)
 
Result set_array_float32 (self, typing.List[float] data)
 
Result set_array_float64 (self, typing.List[float] data)
 
Result set_array_int16 (self, typing.List[int] data)
 
Result set_array_int32 (self, typing.List[int] data)
 
Result set_array_int64 (self, typing.List[int] data)
 
Result set_array_int8 (self, typing.List[int] data)
 
Result set_array_string (self, typing.List[str] data)
 
Result set_array_timestamp (self, typing.List[int] data)
 
Result set_array_uint16 (self, typing.List[int] data)
 
Result set_array_uint32 (self, typing.List[int] data)
 
Result set_array_uint64 (self, typing.List[int] data)
 
Result set_array_uint8 (self, typing.List[int] data)
 
Result set_bool8 (self, bool data)
 
Result set_datetime (self, datetime dt)
 
Result set_flatbuffers (self, bytearray data)
 
Result set_float32 (self, float data)
 
Result set_float64 (self, float data)
 
Result set_int16 (self, int data)
 
Result set_int32 (self, int data)
 
Result set_int64 (self, int data)
 
Result set_int8 (self, int data)
 
Result set_string (self, str data)
 
Result set_timestamp (self, int data)
 
Result set_uint16 (self, int data)
 
Result set_uint32 (self, int data)
 
Result set_uint64 (self, int data)
 
Result set_uint8 (self, int data)
 

Static Public Member Functions

def copy (C_DLR_VARIANT c_variant)
 
datetime from_filetime (filetime)
 
int to_filetime (datetime dt)
 

Detailed Description

Variant is a container for a many types of data.

Hint see python context manager for instance handling

Definition at line 150 of file variant.py.

Member Function Documentation

◆ check_convert()

◆ clone()

def clone (   self)

clones the content of a variant to another variant

Returns
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, clones of variant

Definition at line 256 of file variant.py.

References Variant._variant.

◆ copy()

def copy ( C_DLR_VARIANT  c_variant)
static

copies the content of a variant to another variant

Returns
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, copy of variant

Definition at line 244 of file variant.py.

Referenced by Variant.set_array_datetime().

◆ from_filetime()

datetime from_filetime (   filetime)
static

convert filetime to datetime

Parameters
filetime(FILETIME) 64 bit 100ns since 1.1.1601 (UTC)
Returns
datetime datetime object

Definition at line 689 of file variant.py.

◆ get_array_bool8()

typing.List[bool] get_array_bool8 (   self)

Returns the array of int8 if the type is an array of int8 otherwise null.

Returns
array of bool8

Definition at line 372 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_datetime()

typing.List[datetime.datetime] get_array_datetime (   self)

datetime objects as timestamp (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)

Returns
array of datetime.datetime: datetime object

Definition at line 531 of file variant.py.

References Variant.get_array_uint64().

◆ get_array_float32()

typing.List[float] get_array_float32 (   self)

Returns the array of float if the type is an array of float otherwise null.

Returns
array of float32

Definition at line 491 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_float64()

typing.List[float] get_array_float64 (   self)

Returns the array of double if the type is an array of double otherwise null.

Returns
array of float64

Definition at line 504 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_int16()

typing.List[int] get_array_int16 (   self)

Returns the array of int16 if the type is an array of int16 otherwise null.

Returns
array of int16

Definition at line 412 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_int32()

typing.List[int] get_array_int32 (   self)

Returns the array of int32 if the type is an array of int32 otherwise null.

Returns
array of int32

Definition at line 438 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_int64()

typing.List[int] get_array_int64 (   self)

Returns the array of int64 if the type is an array of int64 otherwise null.

Returns
array of int64

Definition at line 464 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_int8()

typing.List[int] get_array_int8 (   self)

Returns the array of int8 if the type is an array of int8 otherwise null.

Returns
array of int8

Definition at line 386 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_string()

typing.List[str] get_array_string (   self)

Returns the type of the variant.

Returns
array of strings

Definition at line 517 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_uint16()

typing.List[int] get_array_uint16 (   self)

Returns the array of uint16 if the type is an array of uint16 otherwise null.

Returns
array of uint16

Definition at line 425 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_uint32()

typing.List[int] get_array_uint32 (   self)

Returns the array of uint32 if the type is an array of uint32 otherwise null.

Returns
array of uint32

Definition at line 451 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_array_uint64()

typing.List[int] get_array_uint64 (   self)

Returns the array of uint64 if the type is an array of uint64 otherwise null.

Returns
array of uint64

Definition at line 477 of file variant.py.

References Variant._variant, and Variant.check_convert().

Referenced by Variant.get_array_datetime().

◆ get_array_uint8()

typing.List[int] get_array_uint8 (   self)

Returns the array of uint8 if the type is an array of uint8 otherwise null.

Returns
array of uint8

Definition at line 399 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_bool8()

bool get_bool8 (   self)

Returns the value of the variant as a bool (auto convert if possible) otherwise 0.

Returns
[True, False]

Definition at line 263 of file variant.py.

References Variant._variant.

◆ get_count()

int get_count (   self)

Returns the count of elements in the variant (scalar data types = 1, array = count of elements in array)

Returns
count of a type

Definition at line 226 of file variant.py.

References Variant._variant.

◆ get_data()

bytearray get_data (   self)

Returns the pointer to the data of the variant.

Returns
array of bytes

Definition at line 209 of file variant.py.

References Variant._variant.

Referenced by Variant.get_flatbuffers().

◆ get_datetime()

datetime.datetime get_datetime (   self)

datetime object as timestamp (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)

Returns
datetime datetime object

Definition at line 364 of file variant.py.

References Variant.get_uint64().

◆ get_flatbuffers()

bytearray get_flatbuffers (   self)

Returns the flatbuffers if the type is a flatbuffers otherwise null.

Returns
flatbuffer (bytearray)

Definition at line 353 of file variant.py.

References Variant.check_convert(), Response.get_data(), _Request.get_data(), NotifyItemPublish.get_data(), NotifyItem.get_data(), and Variant.get_data().

◆ get_float32()

float get_float32 (   self)

Returns the value of the variant as a float (auto convert if possible) otherwise 0.

Returns
[1.2E-38, 3.4E+38]

Definition at line 326 of file variant.py.

References Variant._variant.

◆ get_float64()

float get_float64 (   self)

Returns the value of the variant as a double (auto convert if possible) otherwise 0.

Returns
[2.3E-308, 1.7E+308]

Definition at line 333 of file variant.py.

References Variant._variant.

◆ get_int16()

int get_int16 (   self)

Returns the value of the variant as an int16 (auto convert if possible) otherwise 0.

Returns
[-32768, 32767]

Definition at line 284 of file variant.py.

References Variant._variant.

◆ get_int32()

int get_int32 (   self)

Returns the value of the variant as an int32 (auto convert if possible) otherwise 0.

Returns
[-2.147.483.648, 2.147.483.647]

Definition at line 298 of file variant.py.

References Variant._variant.

◆ get_int64()

int get_int64 (   self)

Returns the value of the variant as an int64 (auto convert if possible) otherwise 0.

Returns
[-9.223.372.036.854.775.808, 9.223.372.036.854.775.807]

Definition at line 312 of file variant.py.

References Variant._variant.

◆ get_int8()

int get_int8 (   self)

Returns the value of the variant as an int8 (auto convert if possible) otherwise 0.

Returns
[-128, 127]

Definition at line 270 of file variant.py.

References Variant._variant.

◆ get_size()

int get_size (   self)
Returns
size of the type in bytes

Definition at line 219 of file variant.py.

References Variant._variant.

◆ get_string()

str get_string (   self)

Returns the array of bool8 if the type is an array of bool otherwise null.

Returns
string

Definition at line 340 of file variant.py.

References Variant._variant, and Variant.check_convert().

◆ get_type()

VariantType get_type (   self)

Returns the type of the variant.

Returns
<VariantType>

Definition at line 202 of file variant.py.

References Variant._variant.

◆ get_uint16()

int get_uint16 (   self)

Returns the value of the variant as an uint16 (auto convert if possible) otherwise 0.

Returns
[0, 65.535]

Definition at line 291 of file variant.py.

References Variant._variant.

◆ get_uint32()

int get_uint32 (   self)

Returns the value of the variant as an Uint32 (auto convert if possible) otherwise 0.

Returns
[0, 4.294.967.295]

Definition at line 305 of file variant.py.

References Variant._variant.

◆ get_uint64()

int get_uint64 (   self)

Returns the value of the variant as an uint64 (auto convert if possible) otherwise 0.

Returns
[0, 18446744073709551615]

Definition at line 319 of file variant.py.

References Variant._variant.

Referenced by Variant.get_datetime().

◆ get_uint8()

int get_uint8 (   self)

Returns the value of the variant as an uint8 (auto convert if possible) otherwise 0.

Returns
[0, 255]

Definition at line 277 of file variant.py.

References Variant._variant.

◆ set_array_bool8()

Result set_array_bool8 (   self,
typing.List[bool]  data 
)

Set array of bool8.

Returns
<Result>, status of function call

Definition at line 711 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_datetime()

Result set_array_datetime (   self,
typing.List[datetime.datetime]  data 
)

Set array of datetime.

Returns
<Result>, status of function call

Definition at line 881 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, Variant.copy(), and Variant.set_array_timestamp().

◆ set_array_float32()

Result set_array_float32 (   self,
typing.List[float]  data 
)

Set array of float32.

Returns
<Result>, status of function call

Definition at line 828 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_float64()

Result set_array_float64 (   self,
typing.List[float]  data 
)

Set array of float64.

Returns
<Result>, status of function call

Definition at line 841 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_int16()

Result set_array_int16 (   self,
typing.List[int]  data 
)

Set array of int16.

Returns
<Result>, status of function call

Definition at line 750 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_int32()

Result set_array_int32 (   self,
typing.List[int]  data 
)

Set array of int32.

Returns
<Result>, status of function call

Definition at line 776 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_int64()

Result set_array_int64 (   self,
typing.List[int]  data 
)

Set array of int64.

Returns
<Result>, status of function call

Definition at line 802 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_int8()

Result set_array_int8 (   self,
typing.List[int]  data 
)

Set array of int8.

Returns
<Result>, status of function call

Definition at line 724 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_string()

Result set_array_string (   self,
typing.List[str]  data 
)

Set array of strings.

Returns
<Result>, status of function call

Definition at line 854 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_timestamp()

Result set_array_timestamp (   self,
typing.List[int]  data 
)

Set array of timestamp (uint64)

Returns
<Result>, status of function call

Definition at line 868 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

Referenced by Variant.set_array_datetime().

◆ set_array_uint16()

Result set_array_uint16 (   self,
typing.List[int]  data 
)

Set array of uint16.

Returns
<Result>, status of function call

Definition at line 763 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_uint32()

Result set_array_uint32 (   self,
typing.List[int]  data 
)

Set array of uint32.

Returns
<Result>, status of function call

Definition at line 789 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_uint64()

Result set_array_uint64 (   self,
typing.List[int]  data 
)

Set array of uint64.

Returns
<Result>, status of function call

Definition at line 815 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_array_uint8()

Result set_array_uint8 (   self,
typing.List[int]  data 
)

Set array of uint8.

Returns
<Result>, status of function call

Definition at line 737 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_bool8()

Result set_bool8 (   self,
bool  data 
)

Set a bool value.

Returns
<Result>, status of function call

Definition at line 539 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_datetime()

Result set_datetime (   self,
datetime  dt 
)

Set a timestamp value as datetime object.

Parameters
dtdatetime object
Returns
Result status of function call

Definition at line 676 of file variant.py.

References NotifyInfoPublish.set_timestamp(), and Variant.set_timestamp().

◆ set_flatbuffers()

Result set_flatbuffers (   self,
bytearray  data 
)

Set a flatbuffers.

Returns
<Result>, status of function call

Definition at line 648 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_float32()

Result set_float32 (   self,
float  data 
)

Set a float value.

Returns
<Result>, status of function call

Definition at line 620 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_float64()

Result set_float64 (   self,
float  data 
)

Set a double value.

Returns
<Result>, status of function call

Definition at line 629 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_int16()

Result set_int16 (   self,
int  data 
)

Set an int16 value.

Returns
<Result>, status of function call

Definition at line 566 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_int32()

Result set_int32 (   self,
int  data 
)

Set an int32 value.

Returns
<Result>, status of function call

Definition at line 584 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_int64()

Result set_int64 (   self,
int  data 
)

Set an int64 value.

Returns
<Result>, status of function call

Definition at line 602 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_int8()

Result set_int8 (   self,
int  data 
)

Set an int8 value.

Returns
<Result>, status of function call

Definition at line 548 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_string()

Result set_string (   self,
str  data 
)

Set a string.

Returns
<Result>, status of function call

Definition at line 638 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_uint16()

Result set_uint16 (   self,
int  data 
)

Set a uint16 value.

Returns
<Result>, status of function call

Definition at line 575 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_uint32()

Result set_uint32 (   self,
int  data 
)

Set a uint32 value.

Returns
<Result>, status of function call

Definition at line 593 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_uint64()

Result set_uint64 (   self,
int  data 
)

Set a uint64 value.

Returns
<Result>, status of function call

Definition at line 611 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ set_uint8()

Result set_uint8 (   self,
int  data 
)

Set a uint8 value.

Returns
<Result>, status of function call

Definition at line 557 of file variant.py.

References Client.__closed, Provider.__closed, ProviderNode.__closed, SubscriptionAsync.__closed, SubscriptionSync.__closed, System.__closed, Variant.__closed, and Variant._variant.

◆ to_filetime()

int to_filetime ( datetime  dt)
static

convert datetime to filetime

Parameters
dtdatetime to convert
Returns
int (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)

Definition at line 702 of file variant.py.