-
- def AOM_ask_value_strings(object_tag, prop_name__py_str):
- '''
- Input:
- tag_t object_tag (I) -- < (I) Unique identifier (tag) of the object instance.
- const char* prop_name (I) -- < (I) A property name of the object instance.
- Output:
- char*** values (OL(num)F) -- < (OF) num Actual values of the property. This must be a list or array
- of constant chars. If the property is an array, the number of
- values passed in must equal the size of the array.
- Iterate through the output array and call MEM_free on each element to de-allocate
- the nested memory block and then free the memory pointed by itself using MEM_free.
-
- Asks one or more values of a property. The property can be single-valued or multi-valued (i.e., array or list).
-
- This function uses #PROP_ask_value_strings_msg if multi-valued and #PROP_ask_value_string_msg if single-valued.
- To customize the behavior of this function, register a method against one of these messages.
- '''
- num = ffi.new('int*')
- values = ffi.new('char***')
- prop_name = prop_name__py_str if prop_name__py_str != None else ffi.NULL
- __pytk__ifail__return__ = itklib.AOM_ask_value_strings(object_tag, prop_name, num, values)
- iFail2Exception(__pytk__ifail__return__)
- values__py_list = [ffi.string(values[0][pytk_i]) if values[0][pytk_i] != ffi.NULL else None for pytk_i in xrange(num[0])]
- for pytk_i in xrange(num[0]):
- itklib.MEM_free(values[0][pytk_i])
- itklib.MEM_free(values[0])
- return values__py_list
- def AOM_ask_value_tag(object_tag, prop_name__py_str):
- '''
- Input:
- tag_t object_tag (I) -- < (I) Unique identifier (tag) of the object instance.
- const char* prop_name (I) -- < (I) A property name of the object instance.
- Output:
- tag_t* value (O) -- < (O) Actual value of the property.
-
- Asks value of a single-valued property.
-
- This function uses #PROP_ask_value_tag_msg.
- To customize the behavior of this function, register a method against this message name.
- '''
- value = ffi.new('tag_t*')
- prop_name = prop_name__py_str if prop_name__py_str != None else ffi.NULL
- __pytk__ifail__return__ = itklib.AOM_ask_value_tag(object_tag, prop_name, value)
- iFail2Exception(__pytk__ifail__return__)
- return value[0]
- def AOM_ask_value_tag_at(object_tag, prop_name__py_str, position):
- '''
- Input:
- tag_t object_tag (I) -- < (I) Unique identifier (tag) of the object instance.
- const char* prop_name (I) -- < (I) A property name of the object instance.
- int position (I) -- < (I) The position of the specified property in an array or list.
- The first position is 0. For example, if the property is
- an array of size 3 and the third value in the array is to be modified,
- then position = 2.
- Output:
- tag_t* value (O) -- < (O) Actual value of the property at the specified index position.
-
- Asks value of a multi-valued (i.e., list or array) property at a particular index position.
- The property can be single-valued if position = 0.
-
- This function uses #PROP_ask_value_tag_at_msg if the property is multi-valued or
- #PROP_ask_value_tag_msg if the property is single-valued and position = 0.
- To customize the behavior of this function, register a method against one of these messages.
- '''
- value = ffi.new('tag_t*')
- prop_name = prop_name__py_str if prop_name__py_str != None else ffi.NULL
- __pytk__ifail__return__ = itklib.AOM_ask_value_tag_at(object_tag, prop_name, position, value)
- iFail2Exception(__pytk__ifail__return__)
- return value[0]
- def AOM_ask_value_tags(object_tag, prop_name__py_str):
- '''
- Input:
- tag_t object_tag (I) -- < (I) Unique identifier (tag) of the object instance.
- const char* prop_name (I) -- < (I) A property name of the object instance.
- Output:
- tag_t** values (OL(num)F) -- < (OF) num Actual values of the property. This must be a list or array of
- constant chars. If the property is an array, the number of values
- passed in must equal the size of the array.
-
- Asks one or more values of a property. The property can be single-valued or multi-valued (i.e., array or list).
-
- This function uses #PROP_ask_value_tags_msg if multi-valued and #PROP_ask_value_tag_msg if single-valued.
- To customize the behavior of this function, register a method against one of these messages.
- '''
- num = ffi.new('int*')
- values = ffi.new('tag_t**')
- prop_name = prop_name__py_str if prop_name__py_str != None else ffi.NULL
- __pytk__ifail__return__ = itklib.AOM_ask_value_tags(object_tag, prop_name, num, values)
- iFail2Exception(__pytk__ifail__return__)
- values__py_list = [values[0][pytk_i] for pytk_i in xrange(num[0])]
- itklib.MEM_free(values[0])
- return values__py_list
-