Chemical Data Processing Library Python API - Version 1.1.1
|
An array of std::string
objects.
More...
Public Member Functions | |
None | __init__ () |
Creates an empty array. | |
None | __init__ (SArray array) |
Initializes a copy of the SArray instance array. More... | |
int | getObjectID () |
Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
int | getSize () |
Returns the number of elements stored in the array. More... | |
bool | isEmpty () |
Tells whether the array is empty (getSize() == 0). More... | |
None | resize (int num_elem, str value) |
Inserts or erases elements at the end so that the size becomes num_elem. More... | |
None | reserve (int num_elem) |
Preallocates memory for (at least) num_elem elements. More... | |
int | getCapacity () |
Returns the number of elements for which memory has been allocated. More... | |
None | clear () |
Erases all elements. | |
SArray | assign (SArray array) |
Replaces the current state of self with a copy of the state of the SArray instance array. More... | |
None | assign (int num_elem, str value) |
This function fills the array with num_elem copies of the given value. More... | |
None | addElement (str value) |
Inserts a new element at the end of the array. More... | |
None | addElements (SArray values) |
None | insertElement (int idx, str value) |
Inserts a new element before the location specified by the index idx. More... | |
None | insertElements (int idx, int num_elem, str value) |
Inserts num_elem copies of value before the location specified by the index idx. More... | |
None | insertElements (int index, SArray values) |
None | popLastElement () |
Removes the last element of the array. More... | |
None | removeElement (int idx) |
Removes the element at the position specified by the index idx. More... | |
None | removeElements (int begin_idx, int end_idx) |
str | getFirstElement () |
Returns a reference to the first element of the array. More... | |
str | getLastElement () |
Returns a reference to the last element of the array. More... | |
str | getElement (int idx) |
Returns a reference to the element at index idx. More... | |
None | setElement (int idx, str value) |
Assigns a new value to the element specified by the index idx. More... | |
None | __delitem__ (int idx) |
str | __getitem__ (int idx) |
int | __len__ () |
None | __setitem__ (int index, str value) |
bool | __eq__ (SArray array) |
Returns the result of the comparison operation self == array . More... | |
bool | __ne__ (SArray array) |
Returns the result of the comparison operation self != array . More... | |
bool | __le__ (SArray array) |
Returns the result of the comparison operation self <= array . More... | |
bool | __ge__ (SArray array) |
Returns the result of the comparison operation self >= array . More... | |
bool | __lt__ (SArray array) |
Returns the result of the comparison operation self < array . More... | |
bool | __gt__ (SArray array) |
Returns the result of the comparison operation self > array . More... | |
Properties | |
objectID = property(getObjectID) | |
size = property(getSize) | |
An array of std::string
objects.
None CDPL.Util.SArray.__init__ | ( | SArray | array | ) |
Initializes a copy of the SArray instance array.
array | The SArray instance to copy. |
int CDPL.Util.SArray.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python SArray instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b
thus cannot tell reliably whether the two SArray instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID()
.
int CDPL.Util.SArray.getSize | ( | ) |
Returns the number of elements stored in the array.
bool CDPL.Util.SArray.isEmpty | ( | ) |
Tells whether the array is empty (getSize() == 0).
True
if the array is empty, False
otherwise. None CDPL.Util.SArray.resize | ( | int | num_elem, |
str | value | ||
) |
Inserts or erases elements at the end so that the size becomes num_elem.
num_elem | The new size. |
value | The value for newly inserted elements. |
None CDPL.Util.SArray.reserve | ( | int | num_elem | ) |
Preallocates memory for (at least) num_elem elements.
If num_elem is less than or equal to the current capacity, this call has no effect. Otherwise, it is a request for allocation of additional memory. If the request is successful, then the capacity is greater than or equal to num_elem. Otherwise, the capacity is unchanged. In either case, the number of elements will not change.
num_elem | The number of elements to reserve memory for. |
int CDPL.Util.SArray.getCapacity | ( | ) |
Returns the number of elements for which memory has been allocated.
The capacity is always greater than or equal to the number of currently stored elements.
Replaces the current state of self with a copy of the state of the SArray instance array.
array | The SArray instance to copy. |
None CDPL.Util.SArray.assign | ( | int | num_elem, |
str | value | ||
) |
This function fills the array with num_elem copies of the given value.
Note that the assignment completely changes the array and the new size is the same as the number of elements assigned. Old data will be lost.
num_elem | The number of elements to be assigned. |
value | The value to be assigned. |
None CDPL.Util.SArray.addElement | ( | str | value | ) |
Inserts a new element at the end of the array.
value | The value of the new element. |
None CDPL.Util.SArray.addElements | ( | SArray | values | ) |
values |
None CDPL.Util.SArray.insertElement | ( | int | idx, |
str | value | ||
) |
Inserts a new element before the location specified by the index idx.
idx | The location where to insert the new element. |
value | The value of the element to insert. |
Base.IndexError | if the array is empty or idx is not in the range [0, getSize()]. |
None CDPL.Util.SArray.insertElements | ( | int | idx, |
int | num_elem, | ||
str | value | ||
) |
Inserts num_elem copies of value before the location specified by the index idx.
idx | The location where to insert the new elements. |
num_elem | The number of elements to insert. |
value | The value of the elements to insert. |
Base.IndexError | if idx is not in the range [0, getSize()]. |
None CDPL.Util.SArray.insertElements | ( | int | index, |
SArray | values | ||
) |
index | |
values |
None CDPL.Util.SArray.popLastElement | ( | ) |
Removes the last element of the array.
Base.OperationFailed | if the array is empty. |
None CDPL.Util.SArray.removeElement | ( | int | idx | ) |
Removes the element at the position specified by the index idx.
idx | The zero-based index of the element to remove. |
Base.IndexError | if the array is empty or idx is not in the range [0, getSize() - 1]. |
None CDPL.Util.SArray.removeElements | ( | int | begin_idx, |
int | end_idx | ||
) |
begin_idx | |
end_idx |
str CDPL.Util.SArray.getFirstElement | ( | ) |
Returns a reference to the first element of the array.
Base.OperationFailed | if the array is empty. |
str CDPL.Util.SArray.getLastElement | ( | ) |
Returns a reference to the last element of the array.
Base.OperationFailed | if the array is empty. |
str CDPL.Util.SArray.getElement | ( | int | idx | ) |
Returns a reference to the element at index idx.
The method is equivalent to operator[](std::size_t).
idx | The zero-based index of the element. |
Base.IndexError | if the array is empty or idx is not in the range [0, getSize() - 1]. |
None CDPL.Util.SArray.setElement | ( | int | idx, |
str | value | ||
) |
Assigns a new value to the element specified by the index idx.
idx | The zero-based index of the element for which to assign a new value. |
value | The new value of the element after assignment. |
Base.IndexError | if the array is empty or idx is not in the range [0, getSize() - 1]. |
None CDPL.Util.SArray.__delitem__ | ( | int | idx | ) |
idx |
str CDPL.Util.SArray.__getitem__ | ( | int | idx | ) |
idx |
int CDPL.Util.SArray.__len__ | ( | ) |
None CDPL.Util.SArray.__setitem__ | ( | int | index, |
str | value | ||
) |
index | |
value |
bool CDPL.Util.SArray.__eq__ | ( | SArray | array | ) |
Returns the result of the comparison operation self == array
.
array | The SArray instance to be compared with. |
bool CDPL.Util.SArray.__ne__ | ( | SArray | array | ) |
Returns the result of the comparison operation self != array
.
array | The SArray instance to be compared with. |
bool CDPL.Util.SArray.__le__ | ( | SArray | array | ) |
Returns the result of the comparison operation self <= array
.
array | The SArray instance to be compared with. |
bool CDPL.Util.SArray.__ge__ | ( | SArray | array | ) |
Returns the result of the comparison operation self >= array
.
array | The SArray instance to be compared with. |
bool CDPL.Util.SArray.__lt__ | ( | SArray | array | ) |
Returns the result of the comparison operation self < array
.
array | The SArray instance to be compared with. |
bool CDPL.Util.SArray.__gt__ | ( | SArray | array | ) |
Returns the result of the comparison operation self > array
.
array | The SArray instance to be compared with. |