10 from ctrlxdatalayer.clib_variant
import C_DLR_VARIANT
12 FILE_TIME_EPOCH = datetime.datetime(1601, 1, 1)
14 FILE_TIME_MICROSECOND = 10
21 status of function call
24 OK_NO_CONTENT = 0x00000001
27 INVALID_ADDRESS = 0x80010001
28 UNSUPPORTED = 0x80010002
29 OUT_OF_MEMORY = 0x80010003
30 LIMIT_MIN = 0x80010004
31 LIMIT_MAX = 0x80010005
32 TYPE_MISMATCH = 0x80010006
33 SIZE_MISMATCH = 0x80010007
34 INVALID_FLOATINGPOINT = 0x80010009
35 INVALID_HANDLE = 0x8001000A
36 INVALID_OPERATION_MODE = 0x8001000B
37 INVALID_CONFIGURATION = 0x8001000C
38 INVALID_VALUE = 0x8001000D
39 SUBMODULE_FAILURE = 0x8001000E
41 ALREADY_EXISTS = 0x80010010
42 CREATION_FAILED = 0x80010011
43 VERSION_MISMATCH = 0x80010012
44 DEPRECATED = 0x80010013
45 PERMISSION_DENIED = 0x80010014
46 NOT_INITIALIZED = 0x80010015
47 MISSING_ARGUMENT = 0x80010016
48 TOO_MANY_ARGUMENTS = 0x80010017
49 RESOURCE_UNAVAILABLE = 0x80010018
50 COMMUNICATION_ERROR = 0x80010019
51 TOO_MANY_OPERATIONS = 0x8001001A
52 WOULD_BLOCK = 0x8001001B
55 COMM_PROTOCOL_ERROR = 0x80020001
56 COMM_INVALID_HEADER = 0x80020002
58 CLIENT_NOT_CONNECTED = 0x80030001
62 RT_NOT_OPEN = 0x80060001
63 RT_INVALID_OBJECT = 0x80060002
64 RT_WRONG_REVISION = 0x80060003
65 RT_NO_VALID_DATA = 0x80060004
66 RT_MEMORY_LOCKED = 0x80060005
67 RT_INVALID_MEMORY_MAP = 0x80060006
68 RT_INVALID_RETAIN = 0x80060007
69 RT_INVALID_ERROR = 0x80060008
70 RT_MALLOC_FAILED = 0x80060009
73 sec_noSEC_NO_TOKEN_token = 0x80070001
74 SEC_INVALID_SESSION = 0x80070002
75 SEC_INVALID_TOKEN_CONTENT = 0x80070003
76 SEC_UNAUTHORIZED = 0x80070004
77 SEC_PAYMENT_REQUIRED = 0x80070005
80 def _missing_(cls, value):
84 i = 0xFFFFFFFF & value
89 if (i >= 0x80010001)
and (i <= Result.WOULD_BLOCK.value):
91 if (i >= 0x80020001)
and (i <= 0x80020002):
95 if (i >= 0x80060001)
and (i <= Result.RT_MALLOC_FAILED.value):
97 if (i >= 0x80070001)
and (i <= Result.SEC_PAYMENT_REQUIRED.value):
136 ARRAY_OF_TIMESTAMP = 28
141 Variant is a container for a many types of data.
143 Hint: see python context manager for instance handling
146 __slots__ = [
'_variant',
'__closed']
148 def __init__(self, c_variant: C_DLR_VARIANT =
None):
153 if c_variant
is None:
154 self.
_variant_variant = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantCreate()
161 use the python context manager
165 def __exit__(self, exc_type, exc_val, exc_tb):
167 use the python context manager
179 closes the variant instance
184 ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantDelete(self.
_variant_variant)
188 handle value of variant
194 Returns the type of the variant
195 @returns <VariantType>
197 return VariantType(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetType(self.
_variant_variant))
201 Returns the pointer to the data of the variant
202 @returns array of bytes
204 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetSize(
206 c_data = ctypes.string_at(
207 ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetData(self.
_variant_variant), length)
208 return bytearray(c_data)
212 @returns size of the type in bytes
214 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetSize(self.
_variant_variant)
218 Returns the count of elements in the variant (scalar data types = 1, array = count of elements in array)
219 @returns count of a type
221 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(self.
_variant_variant)
225 Checks whether the variant can be converted to another type
226 @returns <Result>, status of function call
228 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantCheckConvert(
229 self.
_variant_variant, datatype.value))
232 def copy(c_variant: C_DLR_VARIANT):
234 copies the content of a variant to another variant
235 @returns tuple (Result, Variant)
236 @return <Result>, status of function call,
237 @return <Variant>, copy of variant
240 result =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantCopy(
241 dest._variant, c_variant))
246 clones the content of a variant to another variant
247 @returns tuple (Result, Variant)
248 @return <Result>, status of function call,
249 @return <Variant>, clones of variant
251 return Variant.copy(self.
_variant_variant)
255 Returns the value of the variant as a bool (auto convert if possible) otherwise 0
256 @returns [True, False]
258 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetBOOL8(self.
_variant_variant)
262 Returns the value of the variant as an int8 (auto convert if possible) otherwise 0
265 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetINT8(self.
_variant_variant)
269 Returns the value of the variant as an uint8 (auto convert if possible) otherwise 0
272 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetUINT8(self.
_variant_variant)
276 Returns the value of the variant as an int16 (auto convert if possible) otherwise 0
277 @returns [-32768, 32767]
279 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetINT16(self.
_variant_variant)
283 Returns the value of the variant as an uint16 (auto convert if possible) otherwise 0
286 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetUINT16(self.
_variant_variant)
290 Returns the value of the variant as an int32 (auto convert if possible) otherwise 0
291 @returns [-2.147.483.648, 2.147.483.647]
293 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetINT32(self.
_variant_variant)
297 Returns the value of the variant as an Uint32 (auto convert if possible) otherwise 0
298 @returns [0, 4.294.967.295]
300 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetUINT32(self.
_variant_variant)
304 Returns the value of the variant as an int64 (auto convert if possible) otherwise 0
305 @returns [-9.223.372.036.854.775.808, 9.223.372.036.854.775.807]
307 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetINT64(self.
_variant_variant)
311 Returns the value of the variant as an uint64 (auto convert if possible) otherwise 0
312 @returns [0, 18446744073709551615]
314 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetUINT64(self.
_variant_variant)
318 Returns the value of the variant as a float (auto convert if possible) otherwise 0
319 @returns [1.2E-38, 3.4E+38]
321 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetFLOAT32(self.
_variant_variant)
325 Returns the value of the variant as a double (auto convert if possible) otherwise 0
326 @returns [2.3E-308, 1.7E+308]
328 return ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetFLOAT64(self.
_variant_variant)
332 Returns the array of bool8 if the type is an array of bool otherwise null
335 if self.
check_convertcheck_convert(VariantType.STRING) != Result.OK:
337 b = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetSTRING(
341 return b.decode(
'utf-8')
345 Returns the flatbuffers if the type is a flatbuffers otherwise null
346 @returns flatbuffer (bytearray)
348 if self.
check_convertcheck_convert(VariantType.FLATBUFFERS) != Result.OK:
354 """datetime object as timestamp (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)
357 datetime.datetime: datetime object
360 return Variant.from_filetime(d)
364 Returns the array of int8 if the type is an array of int8 otherwise null
365 @returns array of bool8
367 if self.
check_convertcheck_convert(VariantType.ARRAY_BOOL8) != Result.OK:
370 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfBOOL8(
372 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
374 return [c_data[i]
for i
in range(length)]
378 Returns the array of int8 if the type is an array of int8 otherwise null
379 @returns array of int8
381 if self.
check_convertcheck_convert(VariantType.ARRAY_INT8) != Result.OK:
383 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfINT8(
385 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
387 return [c_data[i]
for i
in range(length)]
391 Returns the array of uint8 if the type is an array of uint8 otherwise null
392 @returns array of uint8
394 if self.
check_convertcheck_convert(VariantType.ARRAY_UINT8) != Result.OK:
396 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfUINT8(
398 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
400 return [c_data[i]
for i
in range(length)]
404 Returns the array of int16 if the type is an array of int16 otherwise null
405 @returns array of int16
407 if self.
check_convertcheck_convert(VariantType.ARRAY_INT16) != Result.OK:
409 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfINT16(
411 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
413 return [c_data[i]
for i
in range(length)]
417 Returns the array of uint16 if the type is an array of uint16 otherwise null
418 @returns array of uint16
420 if self.
check_convertcheck_convert(VariantType.ARRAY_UINT16) != Result.OK:
422 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfUINT16(
424 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
426 return [c_data[i]
for i
in range(length)]
430 Returns the array of int32 if the type is an array of int32 otherwise null
431 @returns array of int32
433 if self.
check_convertcheck_convert(VariantType.ARRAY_INT32) != Result.OK:
435 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfINT32(
437 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
439 return [c_data[i]
for i
in range(length)]
443 Returns the array of uint32 if the type is an array of uint32 otherwise null
444 @returns array of uint32
446 if self.
check_convertcheck_convert(VariantType.ARRAY_UINT32) != Result.OK:
448 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfUINT32(
450 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
452 return [c_data[i]
for i
in range(length)]
456 Returns the array of int64 if the type is an array of int64 otherwise null
457 @returns array of int64
459 if self.
check_convertcheck_convert(VariantType.ARRAY_INT64) != Result.OK:
461 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfINT64(
463 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
465 return [c_data[i]
for i
in range(length)]
469 Returns the array of uint64 if the type is an array of uint64 otherwise null
470 @returns array of uint64
472 if self.
check_convertcheck_convert(VariantType.ARRAY_UINT64) != Result.OK
and self.
check_convertcheck_convert(VariantType.ARRAY_OF_TIMESTAMP) != Result.OK:
475 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfUINT64(
477 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
479 return [c_data[i]
for i
in range(length)]
483 Returns the array of float if the type is an array of float otherwise null
484 @returns array of float32
486 if self.
check_convertcheck_convert(VariantType.ARRAY_FLOAT32) != Result.OK:
488 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfFLOAT32(
490 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
492 return [c_data[i]
for i
in range(length)]
496 Returns the array of double if the type is an array of double otherwise null
497 @returns array of float64
499 if self.
check_convertcheck_convert(VariantType.ARRAY_FLOAT64) != Result.OK:
501 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfFLOAT64(
503 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
505 return [c_data[i]
for i
in range(length)]
509 Returns the type of the variant
510 @returns array of strings
512 if self.
check_convertcheck_convert(VariantType.ARRAY_STRING) != Result.OK:
514 c_data = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetArrayOfSTRING(
516 length = ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantGetCount(
518 return [c_data[i].decode(
'utf-8')
for i
in range(length)]
521 """datetime objects as timestamp (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)
524 array of datetime.datetime: datetime object
527 return [Variant.from_filetime(ft)
for ft
in vals]
529 def set_bool8(self, data: bool) -> Result:
532 @returns <Result>, status of function call
535 return Result.NOT_INITIALIZED
536 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetBOOL8(self.
_variant_variant, data))
538 def set_int8(self, data: int) -> Result:
541 @returns <Result>, status of function call
544 return Result.NOT_INITIALIZED
545 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetINT8(self.
_variant_variant, data))
547 def set_uint8(self, data: int) -> Result:
550 @returns <Result>, status of function call
553 return Result.NOT_INITIALIZED
554 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetUINT8(self.
_variant_variant, data))
556 def set_int16(self, data: int) -> Result:
559 @returns <Result>, status of function call
562 return Result.NOT_INITIALIZED
563 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetINT16(self.
_variant_variant, data))
568 @returns <Result>, status of function call
571 return Result.NOT_INITIALIZED
572 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetUINT16(self.
_variant_variant, data))
574 def set_int32(self, data: int) -> Result:
577 @returns <Result>, status of function call
580 return Result.NOT_INITIALIZED
581 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetINT32(self.
_variant_variant, data))
586 @returns <Result>, status of function call
589 return Result.NOT_INITIALIZED
590 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetUINT32(self.
_variant_variant, data))
592 def set_int64(self, data: int) -> Result:
595 @returns <Result>, status of function call
598 return Result.NOT_INITIALIZED
599 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetINT64(self.
_variant_variant, data))
604 @returns <Result>, status of function call
607 return Result.NOT_INITIALIZED
608 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetUINT64(self.
_variant_variant, data))
613 @returns <Result>, status of function call
616 return Result.NOT_INITIALIZED
617 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetFLOAT32(self.
_variant_variant, data))
622 @returns <Result>, status of function call
625 return Result.NOT_INITIALIZED
626 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetFLOAT64(self.
_variant_variant, data))
631 @returns <Result>, status of function call
633 b_data = data.encode(
'utf-8')
635 return Result.NOT_INITIALIZED
636 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetSTRING(self.
_variant_variant, b_data))
641 @returns <Result>, status of function call
644 return Result.NOT_INITIALIZED
645 buf = (ctypes.c_byte * len(data)).from_buffer(data)
646 c_data = ctypes.cast(buf, ctypes.POINTER(ctypes.c_byte))
647 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetFlatbuffers(
652 def set_timestamp(self, data: int) -> Result:
654 Set a timestamp value
655 data <int>: timestamp (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)
656 @returns <Result>, status of function call
659 return Result.NOT_INITIALIZED
660 return Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetTimestamp(self.
_variant_variant, data))
663 """Set a timestamp value as datetime object
666 dt (datetime): datetime object
669 Result: status of function call
671 ft = Variant.to_filetime(dt)
676 """convert filetime to datetime
679 filetime (int): (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)
682 datetime: datetime object
685 return FILE_TIME_EPOCH + datetime.timedelta(microseconds=(filetime // FILE_TIME_MICROSECOND))
689 """convert datetime to filetime
692 dt (datetime): datetime to convert
695 int: (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)
697 microseconds_since_file_time_epoch = (
698 dt - FILE_TIME_EPOCH) // datetime.timedelta(microseconds=1)
699 return microseconds_since_file_time_epoch * FILE_TIME_MICROSECOND
704 @returns <Result>, status of function call
707 return Result.NOT_INITIALIZED
708 c_data = (ctypes.c_bool * len(data))(*data)
709 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_BOOL8(
710 self.
_variant_variant, c_data, len(data)))
717 @returns <Result>, status of function call
720 return Result.NOT_INITIALIZED
721 c_data = (ctypes.c_int8 * len(data))(*data)
722 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_INT8(
723 self.
_variant_variant, c_data, len(data)))
730 @returns <Result>, status of function call
733 return Result.NOT_INITIALIZED
734 c_data = (ctypes.c_uint8 * len(data))(*data)
735 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_UINT8(
736 self.
_variant_variant, c_data, len(data)))
743 @returns <Result>, status of function call
746 return Result.NOT_INITIALIZED
747 c_data = (ctypes.c_int16 * len(data))(*data)
748 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_INT16(
749 self.
_variant_variant, c_data, len(data)))
756 @returns <Result>, status of function call
759 return Result.NOT_INITIALIZED
760 c_data = (ctypes.c_uint16 * len(data))(*data)
761 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_UINT16(
762 self.
_variant_variant, c_data, len(data)))
769 @returns <Result>, status of function call
772 return Result.NOT_INITIALIZED
773 c_data = (ctypes.c_int32 * len(data))(*data)
774 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_INT32(
775 self.
_variant_variant, c_data, len(data)))
782 @returns <Result>, status of function call
785 return Result.NOT_INITIALIZED
786 c_data = (ctypes.c_uint32 * len(data))(*data)
787 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_UINT32(
788 self.
_variant_variant, c_data, len(data)))
795 @returns <Result>, status of function call
798 return Result.NOT_INITIALIZED
799 c_data = (ctypes.c_int64 * len(data))(*data)
800 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_INT64(
801 self.
_variant_variant, c_data, len(data)))
808 @returns <Result>, status of function call
811 return Result.NOT_INITIALIZED
812 c_data = (ctypes.c_uint64 * len(data))(*data)
813 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_UINT64(
814 self.
_variant_variant, c_data, len(data)))
821 @returns <Result>, status of function call
824 return Result.NOT_INITIALIZED
825 c_data = (ctypes.c_float * len(data))(*data)
826 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_FLOAT32(
827 self.
_variant_variant, c_data, len(data)))
834 @returns <Result>, status of function call
837 return Result.NOT_INITIALIZED
838 c_data = (ctypes.c_double * len(data))(*data)
839 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_FLOAT64(
840 self.
_variant_variant, c_data, len(data)))
847 @returns <Result>, status of function call
850 return Result.NOT_INITIALIZED
851 c_data = (ctypes.c_char_p * len(data))(*
852 [d.encode(
'utf-8')
for d
in data])
853 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_STRING(
860 Set array of timestamp (uint64)
861 @returns <Result>, status of function call
864 return Result.NOT_INITIALIZED
865 c_data = (ctypes.c_uint64 * len(data))(*data)
866 r =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantSetARRAY_OF_TIMESTAMP(
867 self.
_variant_variant, c_data, len(data)))
873 Set array of datetime
874 @returns <Result>, status of function call
877 return Result.NOT_INITIALIZED
881 def copy(dest: Variant, src: Variant):
883 copies the content of a variant to another variant
884 @returns tuple (Result, Variant)
885 @return <Result>, status of function call,
887 result =
Result(ctrlxdatalayer.clib.libcomm_datalayer.DLR_variantCopy(
888 dest.get_handle(), src.get_handle()))
894 Variant Helper interface,
895 Important: store not an instance of VariantRef, uses the clone/copy function
898 def __init__(self, c_variant: C_DLR_VARIANT =
None):
910 def __exit__(self, exc_type, exc_val, exc_tb):
def __exit__(self, exc_type, exc_val, exc_tb)
exit
def __init__(self, C_DLR_VARIANT c_variant=None)
generate Variant
Variant is a container for a many types of data.
Result set_array_datetime(self, typing.List[datetime.datetime] data)
Set array of datetime.
Result set_array_float64(self, typing.List[float] data)
Set array of float64.
def clone(self)
clones the content of a variant to another variant
int get_uint8(self)
Returns the value of the variant as an uint8 (auto convert if possible) otherwise 0.
Result check_convert(self, VariantType datatype)
Checks whether the variant can be converted to another type.
typing.List[int] get_array_uint16(self)
Returns the array of uint16 if the type is an array of uint16 otherwise null.
def __exit__(self, exc_type, exc_val, exc_tb)
use the python context manager
Result set_uint16(self, int data)
Set a uint16 value.
Result set_array_uint8(self, typing.List[int] data)
Set array of uint8.
Result set_array_int64(self, typing.List[int] data)
Set array of int64.
typing.List[float] get_array_float32(self)
Returns the array of float if the type is an array of float otherwise null.
int get_int64(self)
Returns the value of the variant as an int64 (auto convert if possible) otherwise 0.
Result set_uint64(self, int data)
Set a uint64 value.
Result set_array_int32(self, typing.List[int] data)
Set array of int32.
def __enter__(self)
use the python context manager
Result set_int16(self, int data)
Set an int16 value.
VariantType get_type(self)
Returns the type of the variant.
int get_uint64(self)
Returns the value of the variant as an uint64 (auto convert if possible) otherwise 0.
Result set_array_int8(self, typing.List[int] data)
Set array of int8.
def __init__(self, C_DLR_VARIANT c_variant=None)
generate Variant
int get_uint16(self)
Returns the value of the variant as an uint16 (auto convert if possible) otherwise 0.
Result set_float32(self, float data)
Set a float value.
Result set_array_string(self, typing.List[str] data)
Set array of strings.
bytearray get_flatbuffers(self)
Returns the flatbuffers if the type is a flatbuffers otherwise null.
int get_count(self)
Returns the count of elements in the variant (scalar data types = 1, array = count of elements in arr...
typing.List[datetime.datetime] get_array_datetime(self)
datetime objects as timestamp (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)
Result set_array_int16(self, typing.List[int] data)
Set array of int16.
Result set_array_uint64(self, typing.List[int] data)
Set array of uint64.
Result set_bool8(self, bool data)
Set a bool value.
Result set_timestamp(self, int data)
float get_float64(self)
Returns the value of the variant as a double (auto convert if possible) otherwise 0.
def copy(C_DLR_VARIANT c_variant)
copies the content of a variant to another variant
typing.List[int] get_array_int64(self)
Returns the array of int64 if the type is an array of int64 otherwise null.
typing.List[int] get_array_uint8(self)
Returns the array of uint8 if the type is an array of uint8 otherwise null.
Result set_array_float32(self, typing.List[float] data)
Set array of float32.
bool get_bool8(self)
Returns the value of the variant as a bool (auto convert if possible) otherwise 0.
typing.List[int] get_array_int8(self)
Returns the array of int8 if the type is an array of int8 otherwise null.
int get_int32(self)
Returns the value of the variant as an int32 (auto convert if possible) otherwise 0.
int get_int16(self)
Returns the value of the variant as an int16 (auto convert if possible) otherwise 0.
datetime from_filetime(filetime)
convert filetime to datetime
typing.List[float] get_array_float64(self)
Returns the array of double if the type is an array of double otherwise null.
Result set_flatbuffers(self, bytearray data)
Set a flatbuffers.
datetime.datetime get_datetime(self)
datetime object as timestamp (FILETIME) 64 bit 100ns since 1.1.1601 (UTC)
def close(self)
closes the variant instance
Result set_int64(self, int data)
Set an int64 value.
int to_filetime(datetime dt)
convert datetime to filetime
typing.List[int] get_array_int32(self)
Returns the array of int32 if the type is an array of int32 otherwise null.
Result set_uint32(self, int data)
Set a uint32 value.
typing.List[bool] get_array_bool8(self)
Returns the array of int8 if the type is an array of int8 otherwise null.
typing.List[int] get_array_uint32(self)
Returns the array of uint32 if the type is an array of uint32 otherwise null.
typing.List[int] get_array_uint64(self)
Returns the array of uint64 if the type is an array of uint64 otherwise null.
Result set_int32(self, int data)
Set an int32 value.
def get_handle(self)
handle value of variant
Result set_array_uint32(self, typing.List[int] data)
Set array of uint32.
Result set_datetime(self, datetime dt)
Set a timestamp value as datetime object.
bytearray get_data(self)
Returns the pointer to the data of the variant.
Result set_int8(self, int data)
Set an int8 value.
Result set_array_uint16(self, typing.List[int] data)
Set array of uint16.
Result set_float64(self, float data)
Set a double value.
Result set_array_bool8(self, typing.List[bool] data)
Set array of bool8.
str get_string(self)
Returns the array of bool8 if the type is an array of bool otherwise null.
int get_int8(self)
Returns the value of the variant as an int8 (auto convert if possible) otherwise 0.
Result set_uint8(self, int data)
Set a uint8 value.
Result set_array_timestamp(self, typing.List[int] data)
Set array of timestamp (uint64)
float get_float32(self)
Returns the value of the variant as a float (auto convert if possible) otherwise 0.
typing.List[int] get_array_int16(self)
Returns the array of int16 if the type is an array of int16 otherwise null.
typing.List[str] get_array_string(self)
Returns the type of the variant.
Result set_string(self, str data)
Set a string.
int get_uint32(self)
Returns the value of the variant as an Uint32 (auto convert if possible) otherwise 0.