IC8 Python API:RLPy RCustomValue
Contents
- 1 Description
- 2 Constructor & Destructor
- 3 Member Functions
- 3.1 AssignTo (self, kTargetValue)
- 3.2 Clear (self)
- 3.3 GetType (self)
- 3.4 GetValue (self, *args)
- 3.5 SetValue (self, *args)
- 3.6 ToBoolean (self)
- 3.7 ToChar (self)
- 3.8 ToDouble (self)
- 3.9 ToFloat (self)
- 3.10 ToHandle (self)
- 3.11 ToInt64 (self)
- 3.12 ToInteger (self)
- 3.13 ToMap (self)
- 3.14 ToString (self)
- 3.15 ToWString (self)
- 3.16 __eq__ (self, kValue)
- 4 Properties
Description
This class stores a dynamically typed custom value and exposes conversions to supported scalar, string, handle, array, and map forms.
Constructor & Destructor
__init__ (self, *args)
Initializes a new custom value instance.
Parameters
- args
Member Functions
AssignTo (self, kTargetValue)
Assigns this custom value to the target custom value.
Parameters
- kTargetValue
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
Clear (self)
Clears the value stored by this custom value.
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
GetType (self)
Returns the type.
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
GetValue (self, *args)
Returns the value stored in this custom value.
Parameters
- args
SetValue (self, *args)
Stores a value in this custom value.
Parameters
- args
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
ToBoolean (self)
Converts the stored custom value to a Boolean.
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
ToChar (self)
Returns the stored custom value as a character.
ToDouble (self)
Converts the stored custom value to a double-precision number.
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
ToFloat (self)
Converts the stored custom value to a floating-point number.
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
ToHandle (self)
Returns the stored value as a handle, or None when the value is not a handle.
ToInt64 (self)
Converts the stored custom value to a 64-bit integer.
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
ToInteger (self)
Converts the stored custom value to an integer.
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
ToMap (self)
Returns the stored value as a custom-value map.
ToString (self)
Converts the stored custom value to a string.
ToWString (self)
Converts the stored custom value to a wide string.
__eq__ (self, kValue)
Reports whether this value equals another value.
Parameters
- kValue
Sample code
Demonstrates calls to `RLPy.RCustomValue.AssignTo`, `RLPy.RCustomValue.Clear`, `RLPy.RCustomValue.GetType`, `RLPy.RCustomValue.SetValue`, `RLPy.RCustomValue.ToBoolean`, `RLPy.RCustomValue.ToDouble`, `RLPy.RCustomValue.ToFloat`, `RLPy.RCustomValue.ToInt64`, `RLPy.RCustomValue.ToInteger`, and `RLPy.RCustomValue.__eq__` using the example's inputs.
import RLPy
def run_script():
integer_value = RLPy.RCustomValue(17)
float_value = RLPy.RCustomValue(1.75)
text_value = RLPy.RCustomValue("sample")
boolean_value = RLPy.RCustomValue(True)
numeric_results = (
integer_value.ToInteger(),
integer_value.ToInt64(),
float_value.ToFloat(),
float_value.ToDouble(),
)
boolean_result = boolean_value.ToBoolean()
equality_result = integer_value == RLPy.RCustomValue(17)
target = RLPy.RCustomValue()
integer_value.AssignTo(target)
moved_results = (integer_value.GetType(), target.ToInteger())
mutable = RLPy.RCustomValue()
mutable.SetValue(22)
set_integer = mutable.ToInteger()
mutable.SetValue(3.25)
set_float = mutable.ToDouble()
mutable.SetValue("updated")
set_text_type = mutable.GetType()
mutable.SetValue(False)
set_boolean = mutable.ToBoolean()
cleared = RLPy.RCustomValue(33)
cleared.Clear()
clear_type = cleared.GetType()
return {
"types": (float_value.GetType(), text_value.GetType(), boolean_value.GetType(), set_text_type, clear_type),
"numeric": numeric_results,
"boolean": boolean_result,
"equal": equality_result,
"assigned": moved_results,
"set_value": (set_integer, set_float, set_text_type, set_boolean),
}
Properties
thisown
Indicates whether this SWIG proxy owns the underlying C++ object.