maxon.BaseArray¶
Description¶
A generic array class template used to stored any kind of data. It is based on
maxon.BaseCollection
and maxon.Collection
.
Methods Signature¶
|
Not Implemented yet, use Resize and []. |
|
|
|
Deletes all elements, but doesn’t free memory (calls destructors though). |
|
Gets the number of array elements. |
|
Inserts a new element at index position. |
|
Deletes all elements (calls destructors and frees memory). |
|
Resizes the array to contain newCnt elements.
|
|
Returns a |
|
Gets the item at the given index in the array. |
|
Initialize the BaseContainer in order to store a given type. At the moment only maxon Data Type are supported.
|
|
Iterates over the values in the array. |
|
Returns the number of elements in array. |
|
|
|
Returns the string representation of a data. |
|
Sets the item for the given index in the array.
|
|
Returns the string representation of a data. |
Methods Definition¶
-
BaseArray.
Append
(value)¶ Not Implemented yet, use Resize and [].
-
BaseArray.
CopyFrom
(other)¶
-
BaseArray.
Flush
()¶ Deletes all elements, but doesn’t free memory (calls destructors though).
-
BaseArray.
GetCount
()¶ Gets the number of array elements.
- Returns
Number of array elements.
- Return type
int
-
BaseArray.
Insert
(index, value)¶ Inserts a new element at index position.
- Parameters
index (int) – position
value (
maxon.Data
) – The value to be copied.
-
BaseArray.
Reset
()¶ Deletes all elements (calls destructors and frees memory).
-
BaseArray.
Resize
(newCnt, resizeFlags=enums.COLLECTION_RESIZE_FLAGS.DEFAULT)¶ - Resizes the array to contain newCnt elements.If newCnt is smaller than
BaseArray.GetCount()
all extra elements are being deleted.If it is greater the array is expanded and the default constructor is called for new elements.- Parameters
newCnt (int) – New array size.
resizeFlags (
maxon.COLLECTION_RESIZE_FLAGS
) – How the resizing should be performed.
-
BaseArray.
ToBlock
()¶ Returns a
maxon.Block
which represents the elements of the array.- Returns
The content of this array as a block.
- Returns
-
BaseArray.
__getitem__
(index)¶ Gets the item at the given index in the array.
- Parameters
index (int) – The index to retrieve the value for.
- Raises
IndexError – When index is out of bounds.
- Returns
The retrieved item.
- Return type
-
BaseArray.
__init__
(ob=None, input=None, count=None)¶ - Initialize the BaseContainer in order to store a given type. At the moment only maxon Data Type are supported.If it is an iterable the items are copied over
- Parameters
ob (Union[str, datatype capsule, WrapperClass] (e.g. maxon.Int32 or maxon.BaseTime)) –
If it’s a string:
Example 1: “net.maxon.interface.string-C” creates an array of string objects
Example 2: “net.maxon.interface.string-C[A]” creates an array of string arrays
If it’s a datatype capsule e.g
maxon.Int32
it will only accept this kind of datatype later.input (Optional(Union[int, collections.Iterable])) – If it’s an integer, resize the array with this number, if it’s an iterable the data are copied.
count (Optional(int)) – Number of elements to fill/copy in case if input is passed.
-
BaseArray.
__iter__
()¶ Iterates over the values in the array.
-
BaseArray.
__len__
()¶ Returns the number of elements in array.
- Returns
Number of elements in the array.
- Return type
int
-
BaseArray.
__maxon_init__
(capsule)¶
-
BaseArray.
__repr__
()¶ Returns the string representation of a data.
- Return type
str
-
BaseArray.
__setitem__
(index, item)¶ - Sets the item for the given index in the array.It is only possible to modify existing items with this function, to add new values, use
- Parameters
index (int) – The index of the value to set.
value (Optional[
maxon.Data
]) – The value to set for index.
- Raises
IndexError – When index is out of bounds.
-
BaseArray.
__str__
()¶ Returns the string representation of a data.
- Return type
str