ValueVector

class dsviper.ValueVector

Bases: object

A class used to represent a value of type vector<element_type>. Seamless with a Python seq[object].

Or use Value.create(type_vector [, initial_value]).

append(value: _InputValues) None

Append value to the end of the vector.

at(index: int, *, encoded: bool = True) _OutputValues

Return the value at index.

back(*, encoded: bool = True) _OutputValues

Return the back element or raise.

capacity() int

Return the capacity.

static cast(value: Value) ValueVector

Return a vector<element_type> or raise.

clear() None

Remove all items.

contains(value: _InputValues) bool

Return True if the value is present.

copy() ValueVector

Return a deep copy.

count(value: _InputValues) int

Return the number of occurrences for the value.

description(*, namespace: NameSpace | None = None) str

Return the description.

empty() bool

Return True if the container is empty.

exchange(idx1: int, idx2: int) None

Exchange the value at idx1 with the value at idx2.

extend(values: Sequence | ValueVector) None

Extend the vector by appending the values.

front(*, encoded: bool = True) _OutputValues

Return the front element or raise.

hash() int

Return the hash value.

index(value: _InputValues) int

Return the first index of value.

insert(index: int, value: _InputValues) None

Insert object before index.

is_pack_sized() bool

Return True if the vector packs elements in a contiguous array of binary encoded elements.

pop(index: int = -1, *, encoded: bool = True) _OutputValues

Remove and return item at index (default last). Raises error if the vector is empty or the index is out of range.

remove(value: _InputValues) None

Remove first occurrence of value. Raises error if the value is not present.

representation() str

Return the representation.

reserve(size: int) None

Reserve space for size.

resize(size: int) None

Resize the vector for size.

set(index: int, value: _InputValues) None

Set the value at index.

shrink_to_fit() None

Shrink to fit.

size() int

Return the number of elements.

type() Type

Return the type.

type_code() str

Return the type code.

type_vector() TypeVector

Return the type vector<element_type>.