<< Vector_format_info_t
 Top   Types   Functions   Classes   Options   Index   Sources 

struct Vector / Vector_t

Concrete Class


Description

The Vector Class

This class implements dynamically resizable arrays.

Throughout the documentation, the following prefixes will be used:

Global_

The library prefix: for applications, this is typically empty, for an xyz-Library, this is either XYZ_, xyz_ or Xyz, depending on the identifier in occurs in.

TemplateInstantiation
Global_VECTOR_OKXYZ_VECTOR_OK
Global_vector_newxyz_vector_new
Vector_

This is equivalent to Global_vector_oType, or the name that was set with -name=... for this data structure. The case and underbar convention is adjusted, too.

Assuming a library prefix xyz and oType == char, you get:

TemplateInstantiation
Vector_txyz_vector_char_t
Vector_ALLOW_NULLXYZ_VECTOR_CHAR_ALLOW_NULL
Vector_class

This is the name of the data structure type in C++: capitalised and with underbars removed:

Vector_tVector_class
vector_char_tVectorChar

Conventions

It was tried to keep the argument order consistent, with some rules:

Results

Status Codes

These are undef'ed first because there is only one error code for all the arrays in your program. All the functions returing error codes will both return this error and write it into Global_vector_errno.

ConditionDescriptionMacro to use
= Global_VECTOR_OKOk.Global_VECTOR_IS_OK(X)
< Global_VECTOR_OKError: operation did not succeed.Global_VECTOR_IS_ERROR(X)
> Global_VECTOR_OKWarning: operation succeeded but not perfectly. (e.g. rehash failed)Global_VECTOR_IS_WARNING(X)

In all cases, the consistency of the data structure is guaranteed.

Warnings are only visible in Global_vector_errno; the functions still return VECTOR_OK.

Members

voidclear_errno()
voiddelete_array(Vector_element_ptr_t array)
Vector_index_tformat_pos()
boolformat_quoted()
intget_errno()
Vector_cnt_tinline_store_cnt()
Vector_t const &static_zero()
Vector_tstringify(ERWIN_UNSIGNED_LONG_LONG a, int base, int options, int width, int prec = -1)
Vector_tstringify(ERWIN_LONG_LONG a, int base, int options, int width, int prec = -1)
Vector_tstringify(unsigned long a, int base, int options, int width, int prec = -1)
Vector_tstringify(long a, int base, int options, int width, int prec = -1)
Vector_tstringify(unsigned a, int base, int options, int width, int prec = -1)
Vector_tstringify(int a, int base, int options, int width, int prec = -1)
Vector_tstringify(unsigned short a, int base, int options, int width, int prec = -1)
Vector_tstringify(short a, int base, int options, int width, int prec = -1)
Vector_tstringify(double a, int base, int options, int width, int prec = -1)
Vector_tstringify(char a, int options, int width)
Vector_tstringify(char const * a, int options, int width, int prec = -1)
Vector_tstringify(wchar_t const * a, int options, int width, int prec = -1)
Vector_tstringify(Vector_t const * a, int options, int width, int prec = -1)
Vector_tstringify(Vector_t const & a, int options, int width, int prec = -1)
Vector_tstringify(bool a, int options, int width, int prec = -1)
voidoperator delete(void *, size_t)
voidoperator delete[](void *, size_t)
void *operator new(size_t)
void *operator new[](size_t)
Vector()
Vector(Vector_cnt_t initial_size)
Vector(oTypeTouched)
Vector(oTypeTouched, Vector_cnt_t)
Vector(Vector_t const *, bool do_copy = true)
Vector(Vector_t const *, Vector_index_t, Vector_cnt_t, bool do_copy = true)
Vector(oTypeVar const *, bool do_copy = true)
Vector(oTypeVar const *, Vector_cnt_t, bool do_copy = true)
Vector(oType const *)
Vector(oType const *, Vector_cnt_t)
Vector(bool must_be_true, oTypeVar * other, Vector_cnt_t count, Vector_cnt_t alloc)
Vector(bool must_be_true, oTypeVar * other, Vector_cnt_t count, Vector_cnt_t alloc, oTypeTouched zero_element)
Vector(bool must_be_true, Vector_t * other)
Vector(bool must_be_true, Vector_t & other)
Vector(Vector_t const &, bool docopy = true)
Vector(Vector_t const &, Vector_index_t, Vector_cnt_t, bool do_copy = true)
~Vector()
operator Vector_t *()
operator Vector_t const *() const
booloperator!=(Vector_t const & b) const
booloperator!=(Vector_t const * b) const
Vector_element_ref_toperator*()
oTypeResultoperator*() const
Vector_element_ref_toperator*()
oTypeResultoperator*() const
Vector_element_ptr_toperator+(Vector_index_t i)
oType const *operator+(Vector_index_t i) const
Vector_element_ptr_toperator+() const
Vector_element_ptr_toperator+(Vector_index_t i)
oType const *operator+(Vector_index_t i) const
Vector_element_ptr_toperator+() const
booloperator<(Vector_t const & b) const
booloperator<(Vector_t const * b) const
Vector_t &operator<<(oType const * a)
Vector_t &operator<<(oTypeTouched a)
Vector_t &operator<<(Vector_t const * a)
Vector_t &operator<<(Vector_t const & a)
Vector_t &operator<<(ERWIN_UNSIGNED_LONG_LONG a)
Vector_t &operator<<(ERWIN_LONG_LONG a)
Vector_t &operator<<(unsigned long a)
Vector_t &operator<<(signed long a)
Vector_t &operator<<(unsigned int a)
Vector_t &operator<<(signed int a)
Vector_t &operator<<(double a)
Vector_t &operator<<(void * a)
Vector_t &operator<<(unsigned short a)
Vector_t &operator<<(signed short a)
Vector_t &operator<<(bool a)
booloperator<=(Vector_t const & b) const
booloperator<=(Vector_t const * b) const
Vector_t &operator=(Vector_t const &)
Vector_t &operator=(Vector_t const *)
booloperator==(Vector_t const & b) const
booloperator==(Vector_t const * b) const
booloperator>(Vector_t const & b) const
booloperator>(Vector_t const * b) const
booloperator>=(Vector_t const & b) const
booloperator>=(Vector_t const * b) const
oTypeResultoperator[](Vector_index_t i) const
Vector_element_ref_toperator[](Vector_index_t i)
Vector_element_ref_toperator[](Vector_index_t i)
oTypeResultoperator[](Vector_index_t i) const
operatorVector_element_ptr_t() const
void_constructor()
void_destructor()
Vector_t &append(oTypeTouched a)
Vector_t &append(Vector_t const * a)
Vector_t &append(Vector_t const & a)
Vector_t &append(oType const * a)
Vector_t &append_basename(Vector_t const & other)
Vector_t &append_basename(Vector_t const * other)
Vector_t &append_config_file_name(oType const * progname, bool local = false)
Vector_t &append_directory(Vector_t const & other)
Vector_t &append_directory(Vector_t const * other)
Vector_t &append_no_copy(oTypeVar const * a, Vector_cnt_t n)
Vector_t &append_raw(oType const * a, Vector_cnt_t n)
Vector_t &append_string(oType const * a)
Vector_t &append_subvector(Vector_t const & a, Vector_index_t b, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
Vector_t &append_subvector(Vector_t const * a, Vector_index_t b, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
Vector_t &append_vector(Vector_t const * a)
Vector_t &append_vector(Vector_t const & a)
Vector_element_ptr_tas_array() const
Vector_element_ptr_tas_array_detach()
Vector_element_ptr_tas_open_array() const
Vector_element_ptr_tas_open_array_detach()
Vector_index_tbasename_index() const
voidbasename_range(Vector_index_t & no1, Vector_cnt_t & length) const
Vector_index_tbfind(oTypeParam a, Vector_cmp_t f = NULL) const
operatorbool() const
Vector_t &chomp()
Vector_t &chop(Vector_cnt_t n = 1)
Vector_t &chop(bool a, bool b = true)
Vector_t &chop(Vector_cnt_t n, bool a, bool b = true)
Vector_t &chop(Vector_cnt_t n, bool a)
Vector_t &clear()
Vector_t &clear(bool a, bool b = true)
voidclear_errno() const
Vector_t &clear_keep(Vector_cnt_t n)
Vector_t &clear_no_resize()
intcmp(Vector_t const * other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const
intcmp(Vector_t const & other, Vector_cmp_t cmp_func = Vector_CMP_T_NULL) const
Vector_t *copy() const
Vector_t *copy_detach()
Vector_t *copy_err(int * err) const
Vector_t &detach()
Vector_t &detach_as_is()
boolempty() const
Vector_t &ensure_heap_storage()
Vector_t &ensure_size(Vector_cnt_t a)
Vector_t &ensure_size(Vector_cnt_t a, oTypeTouched b)
intensure_table_size(Vector_cnt_t a)
Vector_t &erase(Vector_index_t i, Vector_cnt_t n = -1)
Vector_t &erase(Vector_index_t i, Vector_cnt_t n, bool a, bool b = true)
Vector_t &erase(Vector_index_t i, Vector_cnt_t n, bool a)
Vector_cnt_terase_equals(Vector_cmp_t fcmp = Vector_CMP_T_NULL, Vector_combine_t combine = Vector_COMBINE_T_NULL)
Vector_cnt_terase_if(Vector_feature_t f, bool inv = true, bool a = true, bool b = true)
Vector_cnt_terase_if(Vector_feature_t f, bool inv = true, bool a = true)
Vector_cnt_terase_if_not(Vector_feature_t f, bool inv = true, bool a = true, bool b = true)
Vector_cnt_terase_if_not(Vector_feature_t f, bool inv = true, bool a = true)
Vector_cnt_terase_zero()
Vector_t &fgets(FILE * fileptr, Vector_cnt_t max_count = -1)
Vector_index_tfind(oTypeParam needle) const
Vector_index_tfind(oType const * needle, Vector_cnt_t n) const
Vector_index_tfind(oType const * needle) const
Vector_index_tfind(Vector_t const & needle) const
Vector_index_tfind(Vector_t const * needle) const
Vector_index_tfind(Vector_index_t a, oTypeParam needle) const
Vector_index_tfind(Vector_index_t a, oType const * needle, Vector_cnt_t n) const
Vector_index_tfind(Vector_index_t a, oType const * needle) const
Vector_index_tfind(Vector_index_t a, Vector_t const & needle) const
Vector_index_tfind(Vector_index_t a, Vector_t const * needle) const
Vector_index_tfind_if(Vector_feature_t feature, bool inverted = true)
Vector_index_tfind_if(Vector_index_t start, Vector_feature_t feature, bool inverted = true)
Vector_index_tfind_if_not(Vector_feature_t feature, bool inverted = true)
Vector_index_tfind_if_not(Vector_index_t start, Vector_feature_t feature, bool inverted = true)
Vector_index_tfind_raw(oType const * needle, Vector_cnt_t n) const
Vector_index_tfind_raw(Vector_index_t a, oType const * needle, Vector_cnt_t n) const
Vector_index_tfind_string(oType const * needle) const
Vector_index_tfind_string(Vector_index_t a, oType const * needle) const
Vector_index_tfind_vector(Vector_t const & needle) const
Vector_index_tfind_vector(Vector_t const * needle) const
Vector_index_tfind_vector(Vector_index_t a, Vector_t const & needle) const
Vector_index_tfind_vector(Vector_index_t a, Vector_t const * needle) const
oTypeResultfirst() const
Vector_element_ptr_tfirst_ptr()
Vector_element_ref_tfirst_ref()
oTypeVarfirst_swap_chop1()
Vector_t &format(Tchar const *, ...)
Vector_t &format(unsigned long int, Tchar const *, ...)
Vector_t &format(Vector_format_info_t *, Tchar const *, ...)
Vector_t &format(Vector_format_info_t *, unsigned long int, Tchar const *, ...)
intfread(FILE * fileptr, Vector_cnt_t max_count = -1)
intget_errno() const
boolhas_heap_storage() const
Global_hashval_thash() const
Global_hashval_thash_raw() const
Vector_t &heap_erase(Vector_index_t i, Vector_cmp_t f = Vector_CMP_T_NULL)
oTypeVarheap_extract(Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_index_theap_father(Vector_index_t i) const
Vector_t &heap_fix(Vector_index_t i, Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_t &heap_insert(oTypeParam elem, Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_index_theap_left(Vector_index_t i) const
Vector_t &heap_raise(Vector_index_t i, Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_index_theap_right(Vector_index_t i) const
Vector_t &heap_sink(Vector_index_t i, Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_t &heap_sort(Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_t &insert(Vector_index_t i, oTypeTouched a)
Vector_t &insert(Vector_index_t i, Vector_t const & a, Vector_index_t b, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
Vector_t &insert(Vector_index_t i, Vector_t const * a, Vector_index_t b, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
Vector_t &insert(Vector_index_t i, oType const * a, Vector_cnt_t n)
Vector_t &insert(Vector_index_t i, oType const * a)
Vector_t &insert(Vector_index_t i, Vector_t const * a)
Vector_t &insert(Vector_index_t i, Vector_t const & a)
Vector_t &insert_no_copy(Vector_index_t i, oTypeVar const * a, Vector_cnt_t n)
Vector_t &insert_raw(Vector_index_t i, oType const * a, Vector_cnt_t n)
Vector_t &insert_string(Vector_index_t i, oType const * a)
Vector_t &insert_subvector(Vector_index_t i, Vector_t const * a, Vector_index_t b = 0, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
Vector_t &insert_subvector(Vector_index_t i, Vector_t const & a, Vector_index_t b = 0, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
Vector_t &insert_vector(Vector_index_t i, Vector_t const * a)
Vector_t &insert_vector(Vector_index_t i, Vector_t const & a)
boolis_equal_at(Vector_index_t a, oType const * b, Vector_cnt_t n) const
boolis_equal_at(Vector_index_t a, oType const * b) const
boolis_equal_at(Vector_index_t a, Vector_t const & b) const
boolis_equal_at(Vector_index_t a, Vector_t const * b) const
boolis_equal_at_raw(Vector_index_t a, oType const * b, Vector_cnt_t n) const
boolis_equal_at_string(Vector_index_t a, oType const * b) const
boolis_equal_at_vector(Vector_index_t a, Vector_t const & b) const
boolis_equal_at_vector(Vector_index_t a, Vector_t const * b) const
oTypeResultlast() const
oTypeVarlast_chop1()
Vector_element_ptr_tlast_ptr()
Vector_element_ref_tlast_ref()
boollocate(Vector_index_t & index, oTypeParam element, int how) const
boollocate(Vector_index_t & index, oTypeParam element, Vector_cmp_t fcmp = Vector_CMP_T_NULL, int how = 0) const
Vector_t &ltrim()
Vector_t &ltrim_if(Vector_feature_t feature, bool inverted = true)
Vector_t &ltrim_if_not(Vector_feature_t feature, bool inverted = true)
Vector_t &make_gap(Vector_index_t a, Vector_cnt_t b)
Vector_t &make_gap(Vector_index_t a, oTypeTouched x, Vector_cnt_t b)
Vector_t &make_gap_with(Vector_index_t a, oTypeTouched x, Vector_cnt_t b)
Vector_t &make_heap(Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_t &map(Vector_map_t fmap)
oTypeVarmodify(Vector_index_t i, oTypeTouched v)
Vector_cnt_tnentries() const
Vector_cnt_tnentries() const
boolnon_empty() const
oTypeResultnth(Vector_index_t i) const
oTypeResultnth_char(Vector_index_t i) const
Vector_element_ptr_tnth_ptr(Vector_index_t i)
oType const *nth_ptr(Vector_index_t i) const
Vector_element_ptr_tnth_ptr_char(Vector_index_t i)
oType const *nth_ptr_char(Vector_index_t i) const
Vector_element_ptr_tnth_ptr_check(Vector_index_t i)
oType const *nth_ptr_check(Vector_index_t i) const
Vector_element_ref_tnth_ref(Vector_index_t i)
oType const &nth_ref(Vector_index_t i) const
Vector_element_ref_tnth_ref_char(Vector_index_t i)
oType const &nth_ref_char(Vector_index_t i) const
Vector_element_ref_tnth_ref_check(Vector_index_t i)
oType const &nth_ref_check(Vector_index_t i) const
Vector_t &overwrite(Vector_index_t i, Vector_t const * a, Vector_index_t ia, Vector_cnt_t n)
Vector_t &overwrite(Vector_index_t i, Vector_t const & a, Vector_index_t ia, Vector_cnt_t n)
Vector_t &overwrite(Vector_index_t i, oType const * a, Vector_cnt_t n)
Vector_t &overwrite(Vector_index_t i, oType const * a)
Vector_t &overwrite(Vector_index_t i, Vector_t const * a)
Vector_t &overwrite(Vector_index_t i, Vector_t const & a)
Vector_t &overwrite_flags(Vector_index_t i, oType const * a, Vector_cnt_t n, bool dealloc, bool docopy)
Vector_t &overwrite_raw(Vector_index_t i, oType const * a, Vector_cnt_t n)
Vector_t &overwrite_string(Vector_index_t i, oType const * a)
Vector_t &overwrite_vector(Vector_index_t i, Vector_t const * a)
Vector_t &overwrite_vector(Vector_index_t i, Vector_t const & a)
Vector_index_tpos()
Vector_index_t *pos_ptr()
Vector_index_t &pos_ref()
Vector_t &prepend(oTypeTouched a)
Vector_t &prepend(Vector_t const * a)
Vector_t &prepend(Vector_t const & a)
Vector_t &prepend(oType const * a)
Vector_t &prepend_no_copy(oTypeVar const * a, Vector_cnt_t n)
Vector_t &prepend_raw(oType const * a, Vector_cnt_t n)
Vector_t &prepend_string(oType const * a)
Vector_t &prepend_vector(Vector_t const * a)
Vector_t &prepend_vector(Vector_t const & a)
intpriority_cmp(Vector_t const * other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const
intpriority_cmp(Vector_t const & other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const
Vector_t &qsort(Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_t &reverse()
Vector_index_trfind(oTypeParam needle) const
Vector_index_trfind(oType const * needle, Vector_cnt_t n) const
Vector_index_trfind(oType const * needle) const
Vector_index_trfind(Vector_t const & needle) const
Vector_index_trfind(Vector_t const * needle) const
Vector_index_trfind(Vector_index_t a, oTypeParam needle) const
Vector_index_trfind(Vector_index_t a, oType const * needle, Vector_cnt_t n) const
Vector_index_trfind(Vector_index_t a, oType const * needle) const
Vector_index_trfind(Vector_index_t a, Vector_t const & needle) const
Vector_index_trfind(Vector_index_t a, Vector_t const * needle) const
Vector_index_trfind_if(Vector_feature_t feature, bool inverted = true)
Vector_index_trfind_if(Vector_index_t start, Vector_feature_t feature, bool inverted = true)
Vector_index_trfind_if_not(Vector_feature_t feature, bool inverted = true)
Vector_index_trfind_if_not(Vector_index_t start, Vector_feature_t feature, bool inverted = true)
Vector_index_trfind_raw(oType const * needle, Vector_cnt_t n) const
Vector_index_trfind_raw(Vector_index_t a, oType const * needle, Vector_cnt_t n) const
Vector_index_trfind_string(oType const * needle) const
Vector_index_trfind_string(Vector_index_t a, oType const * needle) const
Vector_index_trfind_vector(Vector_t const & needle) const
Vector_index_trfind_vector(Vector_t const * needle) const
Vector_index_trfind_vector(Vector_index_t a, Vector_t const & needle) const
Vector_index_trfind_vector(Vector_index_t a, Vector_t const * needle) const
Vector_t &rtrim()
Vector_t &rtrim_if(Vector_feature_t feature, bool inv = true)
Vector_t &rtrim_if_not(Vector_feature_t feature, bool inv = true)
Vector_t &set(Vector_index_t i, oTypeTouched v)
voidset_pos(Vector_index_t y)
Vector_t &set_size(Vector_cnt_t a)
Vector_t &set_size(Vector_cnt_t a, oTypeTouched b)
Vector_t &shrink(bool tight = true)
Vector_t &sort(Vector_cmp_t f = Vector_CMP_T_NULL)
Vector_cnt_tstring_length(oType const * a) const
Vector_t *subvector(Vector_index_t b, Vector_cnt_t c) const
Vector_t *subvector(Vector_index_t b, Vector_cnt_t c, bool d) const
Vector_t &swap(Vector_index_t a, Vector_index_t b)
Vector_t &swap_chop(Vector_cnt_t n = 1)
Vector_t &swap_chop(bool a, bool b = true)
Vector_t &swap_chop(Vector_cnt_t n, bool a, bool b = true)
Vector_t &swap_chop(Vector_cnt_t n, bool a)
Vector_t &swap_erase(Vector_index_t i, Vector_cnt_t n = -1)
Vector_t &swap_erase(Vector_index_t i, Vector_cnt_t n, bool a, bool b = true)
Vector_cnt_ttable_size() const
Vector_t &to_lower()
Vector_t &to_upper()
Vector_t &trim()
Vector_t &trim_if(Vector_feature_t feature, bool inv = true)
Vector_t &trim_if_not(Vector_feature_t feature, bool inv = true)
Vector_t &vformat(Tchar const *, va_list)
Vector_t &vformat(unsigned long int, Tchar const *, va_list)
Vector_t &vformat(Vector_format_info_t *, Tchar const *, va_list)
Vector_t &vformat(Vector_format_info_t *, unsigned long int, Tchar const *, va_list)
Vector_t &xchg(Vector_t * other)
Vector_t &xchg(Vector_t & other)
oTypeResultzero() const


Detailed Descriptions


#if !Global_ERWIN_DEFAULT_NEW_DELETE

static void * operator new (size_t)

C++: void * Vector_t::operator new (size_t)
#endif
Declaration  ]


#if !Global_ERWIN_DEFAULT_NEW_DELETE

static void operator delete (void *, size_t)

C++: void Vector_t::operator delete (void *, size_t)
#endif
Declaration  ]


#if !Global_ERWIN_DEFAULT_NEW_DELETE

static void * operator new[] (size_t)

C++: void * Vector_t::operator new[] (size_t)
#endif
Declaration  ]


#if !Global_ERWIN_DEFAULT_NEW_DELETE

static void operator delete[] (void *, size_t)

C++: void Vector_t::operator delete[] (void *, size_t)
#endif
Declaration  ]


[constructor] Vector ()

C++: Vector_t::Vector ()
Declaration  ]


static Vector_t const & static_zero ()

C++: Vector_t const & Vector_t::static_zero ()
Declaration  ]


#if Vector_HAVE_INT_CONSTRUCTOR

[constructor] Vector (Vector_cnt_t initial_size)

C++: Vector_t::Vector (int initial_size)
#endif
Declaration  ]


#if Vector_DYN_ZERO

[constructor] Vector (oTypeTouched)

C++: Vector_t::Vector (oTypeTouched)
#endif
Declaration  ]


#if Vector_DYN_ZERO

[constructor] Vector (oTypeTouched, Vector_cnt_t)

C++: Vector_t::Vector (oTypeTouched, int)
#endif
Declaration  ]


[constructor] Vector (Vector_t const *, bool do_copy = true)

C++: Vector_t::Vector (Vector_t const *, bool do_copy = true)
Declaration  ]


[constructor] Vector (Vector_t const *, Vector_index_t, Vector_cnt_t, bool do_copy = true)

C++: Vector_t::Vector (Vector_t const *, int, int, bool do_copy = true)
Declaration  ]


[constructor] Vector (oTypeVar const *, bool do_copy = true)

C++: Vector_t::Vector (oTypeVar const *, bool do_copy = true)
Declaration  ]


[constructor] Vector (oTypeVar const *, Vector_cnt_t, bool do_copy = true)

C++: Vector_t::Vector (oTypeVar const *, int, bool do_copy = true)
Declaration  ]


[constructor] Vector (oType const *)

C++: Vector_t::Vector (oType const *)
Declaration  ]


[constructor] Vector (oType const *, Vector_cnt_t)

C++: Vector_t::Vector (oType const *, int)
Declaration  ]


[constructor] Vector (bool must_be_true, oTypeVar * other, Vector_cnt_t count, Vector_cnt_t alloc)

C++: Vector_t::Vector (bool must_be_true, oTypeVar * other, int count, int alloc)

alloc may be -1: see Vector_new_from_raw

Declaration  ]


#if Vector_DYN_ZERO

[constructor] Vector (bool must_be_true, oTypeVar * other, Vector_cnt_t count, Vector_cnt_t alloc, oTypeTouched zero_element)

C++: Vector_t::Vector (bool must_be_true, oTypeVar * other, int count, int alloc, oTypeTouched zero_element)

alloc may be -1: see Vector_new_from_raw

#endif
Declaration  ]


[constructor] Vector (bool must_be_true, Vector_t * other)

C++: Vector_t::Vector (bool must_be_true, Vector_t * other)
Declaration  ]


[constructor] Vector (bool must_be_true, Vector_t & other)

C++: Vector_t::Vector (bool must_be_true, Vector_t & other)
Declaration  ]


void _constructor ()

C++: void Vector_t::_constructor ()
Declaration  ]


void _destructor ()

C++: void Vector_t::_destructor ()
Declaration  ]


#if !Global_ERWIN_GLOBAL_ERRNO

int get_errno () const

C++: int Vector_t::get_errno () const
#endif
Declaration & Source  ]


#if !Global_ERWIN_GLOBAL_ERRNO

void clear_errno () const

C++: void Vector_t::clear_errno () const
C: void Vector_clear_errno (Vector_t const * self)

If you compiled Erwin with Global_ERWIN_THREAD_SAFE, this is the way to get the status code of a given vector.

If you do not have a thread-safe Erwin library, there is a macro with the same name as this function.

Error Codes (Global_vector_errno)

#endif
C Declaration  | C++ Declaration & Source  ]


#if Global_ERWIN_GLOBAL_ERRNO

static int get_errno ()

C++: int Vector_t::get_errno ()
#endif
Declaration & Source  ]


#if Global_ERWIN_GLOBAL_ERRNO

static void clear_errno ()

C++: void Vector_t::clear_errno ()
#endif
Declaration & Source  ]


[constructor] Vector (Vector_t const &, bool docopy = true)

C++: Vector_t::Vector (Vector_t const &, bool docopy = true)
Declaration  ]


[constructor] Vector (Vector_t const &, Vector_index_t, Vector_cnt_t, bool do_copy = true)

C++: Vector_t::Vector (Vector_t const &, int, int, bool do_copy = true)
Declaration  ]


Vector_t * copy () const

C++: Vector_t * Vector_t::copy () const
Declaration & Source  ]


Vector_t * copy_err (int * err) const

C++: Vector_t * Vector_t::copy_err (int * err) const
Declaration & Source  ]


Vector_t * copy_detach ()

C++: Vector_t * Vector_t::copy_detach ()
C: Vector_t * Vector_new_from_vector (Vector_t * other)

This might be strange: it makes a new vector from the contents of the other vector and then detaches the data from the other vector. Its purpose is mainly useful in C++ where you can clone vectors from a static vector by this means. E.g.:

 Vector_class a;
 ...
 return Vector_new_from_vector (a);

Or with the same effect, but without the need to use a long functions name: return a.copy_detach();

A related thing is Vector_xchg(), because the above is also roughly equivalent to:

Vector_t a;
...
Vector_t *b= Vector_new();
Vector_xchg(&a, b);
return b;

C Declaration  | C++ Declaration & Source  ]


Vector_t & xchg (Vector_t * other)

C++: Vector_t & Vector_t::xchg (Vector_t * other)
C: void Vector_xchg (Vector_t * self, Vector_t * other)

Exchanges the two vectors' contents. No memory allocation is performed; this is a fast O(1) operation for swapping two values.

C Declaration  | C++ Declaration & Source  ]


Vector_t & xchg (Vector_t & other)

C++: Vector_t & Vector_t::xchg (Vector_t & other)
C: void Vector_xchg (Vector_t * self, Vector_t * other)

Exchanges the two vectors' contents. No memory allocation is performed; this is a fast O(1) operation for swapping two values.

C Declaration  | C++ Declaration & Source  ]


Vector_t * subvector (Vector_index_t b, Vector_cnt_t c) const

C++: Vector_t * Vector_t::subvector (int b, int c) const
Declaration & Source  ]


Vector_t * subvector (Vector_index_t b, Vector_cnt_t c, bool d) const

C++: Vector_t * Vector_t::subvector (int b, int c, bool d) const
Declaration & Source  ]


Vector_t & operator= (Vector_t const &)

C++: Vector_t & Vector_t::operator= (Vector_t const &)
Declaration  ]


Vector_t & operator= (Vector_t const *)

C++: Vector_t & Vector_t::operator= (Vector_t const *)
Declaration  ]


[destructor] ~Vector ()

C++: Vector_t::~Vector ()
Declaration  ]


Vector_t & detach ()

C++: Vector_t & Vector_t::detach ()
C: void Vector_detach (Vector_t * self)

Clears the vector by initialising a new completely empty table not consuming any memory. The effect is mainly that you can use the value of Vector_as_array and Vector_as_open_array independently from the vector. The old function delete_flat is now a sequence of detach() and delete().

Note

This function should be used when the vector is not needed anymore after a cast to a raw array (e.g. by Vector_as_array).

Compare this function with Vector_detach_as_is(). These functions are important to distinguish if you defined Global_oType_UPDATE_POS.

Note

use Vector_delete_array() to deallocate the memory if you retrieve it with, say, Vector_as_open_array().

Note

See the documentation of Vector_delete_array and Vector INLINE_STORE!

C Declaration  | C++ Declaration & Source  ]


Vector_t & detach_as_is ()

C++: Vector_t & Vector_t::detach_as_is ()
C: void Vector_detach_as_is (Vector_t * self)

Like Vector_detach_as_is(), but does not invoke Global_oType_UPDATE_POS for all elements to set them to -1.

This function is only different from Vector_detach if you defined Global_oType_UPDATE_POS. Otherwise, it is the same.

C Declaration  | C++ Declaration & Source  ]


operator Vector_t const * () const

C++: Vector_t::operator Vector_t const * () const
Declaration & Source  ]


operator Vector_t * ()

C++: Vector_t::operator Vector_t * ()
Declaration & Source  ]


#if Vector_MANY_CASTS != 0

operator Vector_element_ptr_t () const

C++: operator Vector_t::Vector_element_ptr_t () const
#endif
Declaration & Source  ]


#if Vector_MANY_CASTS != 0

operator bool () const

C++: operator Vector_t::bool () const
#endif
Declaration & Source  ]


#if Vector_POSITION_POINTER

Vector_index_t * pos_ptr ()

C++: int * Vector_t::pos_ptr ()
#endif
Declaration & Source  ]


#if Vector_POSITION_POINTER

Vector_index_t & pos_ref ()

C++: int & Vector_t::pos_ref ()
#endif
Declaration & Source  ]


#if Vector_POSITION_POINTER

Vector_index_t pos ()

C++: int Vector_t::pos ()
#endif
Declaration & Source  ]


#if Vector_POSITION_POINTER

void set_pos (Vector_index_t y)

C++: void Vector_t::set_pos (int y)
#endif
Declaration & Source  ]


oTypeResult nth (Vector_index_t i) const

C++: oTypeResult Vector_t::nth (int i) const
C: oTypeResult Vector_nth (Vector_t const * self, int index)

Returns the found element or the zero element on failure. If index is out of range, a message is also output to stderr if you defined Global_ERWIN_VERBOSE.

C Declaration  | C++ Declaration & Source  ]


oTypeResult nth_char (Vector_index_t i) const

C++: oTypeResult Vector_t::nth_char (int i) const
C: oTypeResult Vector_nth_char (Vector_t const * self, int index)

Returns the found element or the zero element on failure.

If you access the element just after the end of the vector, then that is regarded legal in this function and the zero element is returned.

If index is out of range, a message is also output to stderr if you defined Global_ERWIN_VERBOSE.

Dev.Note: this is pure: cmp to Vector_nth_char_ptr and see Vector_as_array().

C Declaration  | C++ Declaration & Source  ]


Vector_element_ptr_t nth_ptr_check (Vector_index_t i)

C++: Vector_element_ptr_t Vector_t::nth_ptr_check (int i)
C: Vector_element_ptr_t Vector_nth_ptr_check (Vector_t * self, int index)

Returns a pointer to the element at index or an signals an error if the index is out of range. (This is the same behaviour towards errors as Vector_nth has)

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure with ALLOW_OUTOFRANGE option.

C Declaration  | C++ Declaration & Source  ]


oType const * nth_ptr_check (Vector_index_t i) const

C++: oType const * Vector_t::nth_ptr_check (int i) const
C: oType const * Vector_nth_ptr_check_const (Vector_t const * self, int idx)
C Declaration & Source  | C++ Declaration & Source  ]


Vector_element_ptr_t nth_ptr_char (Vector_index_t i)

C++: Vector_element_ptr_t Vector_t::nth_ptr_char (int i)
C: Vector_element_ptr_t Vector_nth_ptr_char (Vector_t * self, int index)

Returns a pointer to the element at index if it is in range. If is is one too large, returns a pointer to the element after the end, mimicking string behaviour. That element is guaranteed to be allocated, of couse. If you write to that element, it only is guarateed to have any effect up to the next change to the vector size. Don't change that element, though.

Because this function is so similar to adding an integer to a 'char const *', i.e., to get a suffix string, this function always zero-terminates the vector like Vector_as_array() does. So Vector_nth_ptr_char(self,0) is equivalent to Vector_as_array().

Note

This behaves a bit strange together with ALLOW_OUTOFRANGE: Accesses to any element starting from a[nentries()] make the vector larger for the non-const version! This includes the nentries()th element, which, even if only read with this function, enlarges the vector due to the potential threat of the user writing to it.

In case ALLOW_OUTOFRANGE is off, this never makes the vector larger, but does allow access to nentries()th element. That element is always ensured to be ZERO, however, so you cannot write to it.

This signals an error if the index is out of range. (This is the some behaviour towards errors as Vector_nth_char has.)

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure, see Vector_as_array().

C Declaration  | C++ Declaration & Source  ]


oType const * nth_ptr_char (Vector_index_t i) const

C++: oType const * Vector_t::nth_ptr_char (int i) const
C: oType const * Vector_nth_ptr_char_const (Vector_t const * self, int idx)
C Declaration & Source  | C++ Declaration & Source  ]


Vector_element_ptr_t nth_ptr (Vector_index_t i)

C++: Vector_element_ptr_t Vector_t::nth_ptr (int i)
C: Vector_element_ptr_t Vector_nth_ptr (Vector_t * self, int index)

Returns a pointer to the element at index or NULL if index is out of range.

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure with ALLOW_OUTOFRANGE option.

C Declaration  | C++ Declaration & Source  ]


oType const * nth_ptr (Vector_index_t i) const

C++: oType const * Vector_t::nth_ptr (int i) const
C: oType const * Vector_nth_ptr_const (Vector_t const * self, int idx)
C Declaration & Source  | C++ Declaration & Source  ]


Vector_element_ref_t nth_ref (Vector_index_t i)

C++: Vector_element_ref_t Vector_t::nth_ref (int i)
C: Vector_element_ptr_t Vector_nth_ptr (Vector_t * self, int index)

Returns a pointer to the element at index or NULL if index is out of range.

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure with ALLOW_OUTOFRANGE option.

C Declaration  | C++ Declaration & Source  ]


oType const & nth_ref (Vector_index_t i) const

C++: oType const & Vector_t::nth_ref (int i) const
C: oType const * Vector_nth_ptr_const (Vector_t const * self, int idx)
C Declaration & Source  | C++ Declaration & Source  ]


Vector_element_ref_t nth_ref_check (Vector_index_t i)

C++: Vector_element_ref_t Vector_t::nth_ref_check (int i)
C: Vector_element_ptr_t Vector_nth_ptr_check (Vector_t * self, int index)

Returns a pointer to the element at index or an signals an error if the index is out of range. (This is the same behaviour towards errors as Vector_nth has)

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure with ALLOW_OUTOFRANGE option.

C Declaration  | C++ Declaration & Source  ]


oType const & nth_ref_check (Vector_index_t i) const

C++: oType const & Vector_t::nth_ref_check (int i) const
C: oType const * Vector_nth_ptr_check_const (Vector_t const * self, int idx)
C Declaration & Source  | C++ Declaration & Source  ]


Vector_element_ref_t nth_ref_char (Vector_index_t i)

C++: Vector_element_ref_t Vector_t::nth_ref_char (int i)
C: Vector_element_ptr_t Vector_nth_ptr_char (Vector_t * self, int index)

Returns a pointer to the element at index if it is in range. If is is one too large, returns a pointer to the element after the end, mimicking string behaviour. That element is guaranteed to be allocated, of couse. If you write to that element, it only is guarateed to have any effect up to the next change to the vector size. Don't change that element, though.

Because this function is so similar to adding an integer to a 'char const *', i.e., to get a suffix string, this function always zero-terminates the vector like Vector_as_array() does. So Vector_nth_ptr_char(self,0) is equivalent to Vector_as_array().

Note

This behaves a bit strange together with ALLOW_OUTOFRANGE: Accesses to any element starting from a[nentries()] make the vector larger for the non-const version! This includes the nentries()th element, which, even if only read with this function, enlarges the vector due to the potential threat of the user writing to it.

In case ALLOW_OUTOFRANGE is off, this never makes the vector larger, but does allow access to nentries()th element. That element is always ensured to be ZERO, however, so you cannot write to it.

This signals an error if the index is out of range. (This is the some behaviour towards errors as Vector_nth_char has.)

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure, see Vector_as_array().

C Declaration  | C++ Declaration & Source  ]


oType const & nth_ref_char (Vector_index_t i) const

C++: oType const & Vector_t::nth_ref_char (int i) const
C: oType const * Vector_nth_ptr_char_const (Vector_t const * self, int idx)
C Declaration & Source  | C++ Declaration & Source  ]


oTypeResult operator[] (Vector_index_t i) const

C++: oTypeResult Vector_t::operator[] (int i) const
Declaration & Source  ]


Vector_element_ref_t operator[] (Vector_index_t i)

C++: Vector_element_ref_t Vector_t::operator[] (int i)
Declaration & Source  ]


Vector_element_ref_t operator[] (Vector_index_t i)

C++: Vector_element_ref_t Vector_t::operator[] (int i)
Declaration & Source  ]


oTypeResult operator[] (Vector_index_t i) const

C++: oTypeResult Vector_t::operator[] (int i) const
Declaration & Source  ]


oTypeResult first () const

C++: oTypeResult Vector_t::first () const
Declaration & Source  ]


Vector_element_ptr_t first_ptr ()

C++: Vector_element_ptr_t Vector_t::first_ptr ()
C: Vector_element_ptr_t Vector_first_ptr (Vector_t * self)

Returns a pointer to the element at index 0 or NULL if the vector is empty.

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure with ALLOW_OUTOFRANGE option.

C Declaration  | C++ Declaration & Source  ]


Vector_element_ref_t first_ref ()

C++: Vector_element_ref_t Vector_t::first_ref ()
C: Vector_element_ptr_t Vector_first_ptr (Vector_t * self)

Returns a pointer to the element at index 0 or NULL if the vector is empty.

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure with ALLOW_OUTOFRANGE option.

C Declaration  | C++ Declaration & Source  ]


oTypeResult last () const

C++: oTypeResult Vector_t::last () const
Declaration & Source  ]


Vector_element_ptr_t last_ptr ()

C++: Vector_element_ptr_t Vector_t::last_ptr ()
C: Vector_element_ptr_t Vector_last_ptr (Vector_t * self)

Returns a pointer to the last element or NULL if the vector is empty.

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure with ALLOW_OUTOFRANGE option.

C Declaration  | C++ Declaration & Source  ]


Vector_element_ref_t last_ref ()

C++: Vector_element_ref_t Vector_t::last_ref ()
C: Vector_element_ptr_t Vector_last_ptr (Vector_t * self)

Returns a pointer to the last element or NULL if the vector is empty.

Does not output anything to stderr even if you define Global_ERWIN_VERBOSE.

Dev.Note: not pure with ALLOW_OUTOFRANGE option.

C Declaration  | C++ Declaration & Source  ]


oTypeVar modify (Vector_index_t i, oTypeTouched v)

C++: oTypeVar Vector_t::modify (int i, oTypeTouched v)
C: oTypeVar Vector_modify (Vector_t * self, int index, oTypeTouched newvalue)

Returns the old value and inserts the new one at index.

Nothing is freed, newvalue is copied if oType_OCOPY is #defined.

C Declaration  | C++ Declaration & Source  ]


Vector_t & reverse ()

C++: Vector_t & Vector_t::reverse ()
C: void Vector_reverse (Vector_t * self)

Reverses the order of all elements in the vector.

See Vector_swap, too, which is vaguely related.

C Declaration  | C++ Declaration & Source  ]


oTypeVar last_chop1 ()

C++: oTypeVar Vector_t::last_chop1 ()
C: oTypeVar Vector_last_chop1 (Vector_t * self)

Cuts off the last element of the vector and returns it. Like a pop on a stack.

C Declaration  | C++ Declaration & Source  ]


oTypeVar first_swap_chop1 ()

C++: oTypeVar Vector_t::first_swap_chop1 ()
C: oTypeVar Vector_first_swap_chop1 (Vector_t * self)

Cuts off the first element of the vector like Vector_swap_erase() and returns it. This is like Vector_heap_extract() without heap_sink().

C Declaration  | C++ Declaration & Source  ]


Vector_t & set (Vector_index_t i, oTypeTouched v)

C++: Vector_t & Vector_t::set (int i, oTypeTouched v)
C: int Vector_set (Vector_t * self, int index, oTypeTouched newvalue)

Like Vector_modify, but the old value is freed using oType_OFREE instead of being returned.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & swap_erase (Vector_index_t i, Vector_cnt_t n = -1)

C++: Vector_t & Vector_t::swap_erase (int i, int n = -1)
C: int Vector_swap_erase (Vector_t * self, int index, int number_of_elements)

This is similar to Vector_erase, but instead of shifting all elements after the ones erased, this functions copies elements from the end of the vector into the gap. This is faster if number_of_elements is small. The order of the copied elements is reversed.

Example

Vector= [0 1 2 3 4 5 6 7 8 9]

Vector.swap_erase(2,3)  // erases elements 2,3,4 by overwriting with 9,8,7

Vector= [0 1 9 8 7 5 6]

There are more interesting cases, too:

Vector= [0 1 2 3 4 5 6 7 8 9]

Vector.swap_erase(4,4)  // erases elements 4,5,6,7 by overwriting with 9,8

Vector= [0 1 2 3 9 8]

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & swap_erase (Vector_index_t i, Vector_cnt_t n, bool a, bool b = true)

C++: Vector_t & Vector_t::swap_erase (int i, int n, bool a, bool b = true)
C: int Vector_swap_erase_flags (Vector_t * self, int index, int number_of_elements_to_delete, Global_ERWIN_BOOL resize)

Like Vector_swap_erase but you can specify whether the vector should be re-allocated by resize.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & erase (Vector_index_t i, Vector_cnt_t n = -1)

C++: Vector_t & Vector_t::erase (int i, int n = -1)
C: int Vector_erase (Vector_t * self, int index, int number_of_elements)

The values erased from the the vector are freed. If number_of_elements is negative, the end of the vector is cut off. If index or number_of_elements are out of range, they are adjusted appropriately.

E.g.:

if index == -2 and count == 5

then elements 0,1,2 are erased,

if index >= nentries

nothing is erased,

if index + count >= nentries

only the tail of the vector is erased. However, all this is only done if Vector_ALLOW_OUTOFRANGE is true. Otherwise, you'll get an assertion failure in all these cases, because index or count are out of range.

if count < 0

then count is adjusted to nelements - index, e.g. index == 2, count = -1 will cut off the last two elements of the vector. (The absolute value of count is not considered here, only the fact that it is < 0). This adjustment always happens, i.e., even if Vector_ALLOW_OUTOFRANGE is false.

Returns its success.

Reference

Vector_erase_flags, Vector_swap_erase

C Declaration  | C++ Declaration & Source  ]


Vector_cnt_t erase_zero ()

C++: int Vector_t::erase_zero ()
C: int Vector_erase_zero (Vector_t * self)

Specialised version of Vector_erase_if: deletes zero elements.

C Declaration  | C++ Declaration & Source  ]


Vector_t & erase (Vector_index_t i, Vector_cnt_t n, bool a, bool b = true)

C++: Vector_t & Vector_t::erase (int i, int n, bool a, bool b = true)
C: int Vector_erase_flags (Vector_t * self, int index, int number_of_elements_to_delete, Global_ERWIN_BOOL resize)

Like Vector_erase but you can specify whether the vector should be re-allocated by resize.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_cnt_t erase_if (Vector_feature_t f, bool inv = true, bool a = true, bool b = true)

C++: int Vector_t::erase_if (Vector_feature_t f, bool inv = true, bool a = true, bool b = true)
C: int Vector_erase_if_flags (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value, Global_ERWIN_BOOL resize)

Additional to Vector_erase_if, you can specify whether to resize the vector.

Returns the number of elements cut out of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_cnt_t erase_if_not (Vector_feature_t f, bool inv = true, bool a = true, bool b = true)

C++: int Vector_t::erase_if_not (Vector_feature_t f, bool inv = true, bool a = true, bool b = true)
C: int Vector_erase_if_flags (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value, Global_ERWIN_BOOL resize)

Additional to Vector_erase_if, you can specify whether to resize the vector.

Returns the number of elements cut out of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_cnt_t erase_equals (Vector_cmp_t fcmp = Vector_CMP_T_NULL, Vector_combine_t combine = Vector_COMBINE_T_NULL)

C++: int Vector_t::erase_equals (Vector_cmp_t fcmp = Vector_CMP_T_NULL, Vector_combine_t combine = Vector_COMBINE_T_NULL)
C: int Vector_erase_equals (Vector_t * self, Vector_cmp_t cmp, Vector_combine_t combine)

Erases the second of two adjacent elements that is equal (wrt. the given function) to the first. This is repeated recursively so that groups of adjacent equal elements are reduced to one element.

Before erasing, the function calls back combine to let the user adjust things (e.g. copy something from the moribund entry to the surviving one).

The default cmp function, used if cmp is NULL, is Global_oType_CMP.

In a sorted vector, this procedure erases all equal elements.

The values erased from the vector are freed using oType_OFREE.

The number of erased elements is returned.

C Declaration  | C++ Declaration & Source  ]


Vector_t & erase (Vector_index_t i, Vector_cnt_t n, bool a)

C++: Vector_t & Vector_t::erase (int i, int n, bool a)
C: int Vector_erase_flags (Vector_t * self, int index, int number_of_elements_to_delete, Global_ERWIN_BOOL resize)

Like Vector_erase but you can specify whether the vector should be re-allocated by resize.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_cnt_t erase_if (Vector_feature_t f, bool inv = true, bool a = true)

C++: int Vector_t::erase_if (Vector_feature_t f, bool inv = true, bool a = true)
C: int Vector_erase_if_flags (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value, Global_ERWIN_BOOL resize)

Additional to Vector_erase_if, you can specify whether to resize the vector.

Returns the number of elements cut out of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_cnt_t erase_if_not (Vector_feature_t f, bool inv = true, bool a = true)

C++: int Vector_t::erase_if_not (Vector_feature_t f, bool inv = true, bool a = true)
C: int Vector_erase_if_flags (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value, Global_ERWIN_BOOL resize)

Additional to Vector_erase_if, you can specify whether to resize the vector.

Returns the number of elements cut out of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_t & swap_chop (Vector_cnt_t n = 1)

C++: Vector_t & Vector_t::swap_chop (int n = 1)
C: int Vector_swap_erase (Vector_t * self, int index, int number_of_elements)

This is similar to Vector_erase, but instead of shifting all elements after the ones erased, this functions copies elements from the end of the vector into the gap. This is faster if number_of_elements is small. The order of the copied elements is reversed.

Example

Vector= [0 1 2 3 4 5 6 7 8 9]

Vector.swap_erase(2,3)  // erases elements 2,3,4 by overwriting with 9,8,7

Vector= [0 1 9 8 7 5 6]

There are more interesting cases, too:

Vector= [0 1 2 3 4 5 6 7 8 9]

Vector.swap_erase(4,4)  // erases elements 4,5,6,7 by overwriting with 9,8

Vector= [0 1 2 3 9 8]

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & swap_chop (bool a, bool b = true)

C++: Vector_t & Vector_t::swap_chop (bool a, bool b = true)
C: int Vector_swap_erase_flags (Vector_t * self, int index, int number_of_elements_to_delete, Global_ERWIN_BOOL resize)

Like Vector_swap_erase but you can specify whether the vector should be re-allocated by resize.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & swap_chop (Vector_cnt_t n, bool a, bool b = true)

C++: Vector_t & Vector_t::swap_chop (int n, bool a, bool b = true)
C: int Vector_swap_erase_flags (Vector_t * self, int index, int number_of_elements_to_delete, Global_ERWIN_BOOL resize)

Like Vector_swap_erase but you can specify whether the vector should be re-allocated by resize.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & swap_chop (Vector_cnt_t n, bool a)

C++: Vector_t & Vector_t::swap_chop (int n, bool a)
C: int Vector_swap_erase_flags (Vector_t * self, int index, int number_of_elements_to_delete, Global_ERWIN_BOOL resize)

Like Vector_swap_erase but you can specify whether the vector should be re-allocated by resize.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & chop (Vector_cnt_t n = 1)

C++: Vector_t & Vector_t::chop (int n = 1)
C: int Vector_chop (Vector_t * self, int count)

Cuts off the last count elements of a vector.

This is actually nothing more than an abbreviation for:

(Assert that count is >= 0)
Vector_erase(self, Vector_nentries(self)-count, count);

This functions generates an assertion failure if the number of elements to chop is greater than the number of elements in the vector. However, if Vector_ALLOW_OUTOFRANGE is true, then this operation simply clears the vector without assertion failure in this case.

Due to the fact that the equivalent using Vector_swap_erase is very trivial: Vector_swap_erase (self, 0, 1), there is no Vector_swap_chop() in C (but in C++, we still have it).

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & chop (bool a, bool b = true)

C++: Vector_t & Vector_t::chop (bool a, bool b = true)
C: int Vector_chop_flags (Vector_t * self, int number_of_elements_to_erase_off, Global_ERWIN_BOOL resize)

Like Vector_chop you can specify the deallocation behaviour.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & chop (Vector_cnt_t n, bool a, bool b = true)

C++: Vector_t & Vector_t::chop (int n, bool a, bool b = true)
C: int Vector_chop_flags (Vector_t * self, int number_of_elements_to_erase_off, Global_ERWIN_BOOL resize)

Like Vector_chop you can specify the deallocation behaviour.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & chop (Vector_cnt_t n, bool a)

C++: Vector_t & Vector_t::chop (int n, bool a)
C: int Vector_chop_flags (Vector_t * self, int number_of_elements_to_erase_off, Global_ERWIN_BOOL resize)

Like Vector_chop you can specify the deallocation behaviour.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & prepend (oTypeTouched a)

C++: Vector_t & Vector_t::prepend (oTypeTouched a)
C: int Vector_insert (Vector_t * self, int index, oTypeTouched element)

Inserts one element at position index.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & prepend_raw (oType const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::prepend_raw (oType const * a, int n)
C: int Vector_insert_raw (Vector_t * self, int index, oType const * values, int count)

Inserts elements from an open array whose size is given by count. In all other aspects it works just like Vector_insert_vector.

C Declaration  | C++ Declaration & Source  ]


Vector_t & prepend_no_copy (oTypeVar const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::prepend_no_copy (oTypeVar const * a, int n)
C: int Vector_insert_no_copy (Vector_t * self, int index, oTypeVar const * values, int count)

Like Vector_insert_raw but does not copy the given data.

C Declaration  | C++ Declaration & Source  ]


Vector_t & prepend_vector (Vector_t const * a)

C++: Vector_t & Vector_t::prepend_vector (Vector_t const * a)
C: int Vector_insert_vector (Vector_t * self, int start_index, Vector_t const * initial)

Each element is copied using Global_oType_OCOPY.

This is a simple frontend to Vector_make_gap and Vector_overwrite. To insert only portions of the initial vector, use these functions directly.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & prepend_vector (Vector_t const & a)

C++: Vector_t & Vector_t::prepend_vector (Vector_t const & a)
C: int Vector_insert_vector (Vector_t * self, int start_index, Vector_t const * initial)

Each element is copied using Global_oType_OCOPY.

This is a simple frontend to Vector_make_gap and Vector_overwrite. To insert only portions of the initial vector, use these functions directly.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & prepend_string (oType const * a)

C++: Vector_t & Vector_t::prepend_string (oType const * a)
C: int Vector_insert_string (Vector_t * self, int start_index, oType const * values)

Inserts a zero-terminated string into the vector.

In all other aspects it works just like Vector_insert_vector.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append (oTypeTouched a)

C++: Vector_t & Vector_t::append (oTypeTouched a)
C: int Vector_append (Vector_t * self, oTypeTouched value)

Appends one elements, namely value, to the end of the vector.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_raw (oType const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::append_raw (oType const * a, int n)
C: int Vector_append_raw (Vector_t * self, oType const * elements, int count)

Append count elements to the end of the vector.

This is a frontend to Vector_insert_raw which lets you specify an insertion position.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_no_copy (oTypeVar const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::append_no_copy (oTypeVar const * a, int n)
C: int Vector_append_no_copy (Vector_t * self, oTypeVar const * theelements, int number_of_elements_to_insert)

Like Vector_append_raw, but the data is not copyied.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_vector (Vector_t const * a)

C++: Vector_t & Vector_t::append_vector (Vector_t const * a)
C: int Vector_append_vector (Vector_t * self, Vector_t const * other)

Append a whole other vector at the end of the vector self.

This is a frontend to Vector_insert.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_vector (Vector_t const & a)

C++: Vector_t & Vector_t::append_vector (Vector_t const & a)
C: int Vector_append_vector (Vector_t * self, Vector_t const * other)

Append a whole other vector at the end of the vector self.

This is a frontend to Vector_insert.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_string (oType const * a)

C++: Vector_t & Vector_t::append_string (oType const * a)
C: int Vector_append_string (Vector_t * self, oType const * theelements)

Like Vector_append_raw, but with a zero-terminated string instead of a number of elements. The null-termination will not be copied.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_subvector (Vector_t const & a, Vector_index_t b, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)

C++: Vector_t & Vector_t::append_subvector (Vector_t const & a, int b, int c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
Declaration & Source  ]


Vector_t & append_subvector (Vector_t const * a, Vector_index_t b, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)

C++: Vector_t & Vector_t::append_subvector (Vector_t const * a, int b, int c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & prepend (Vector_t const * a)

C++: Vector_t & Vector_t::prepend (Vector_t const * a)
C: int Vector_insert_vector (Vector_t * self, int start_index, Vector_t const * initial)

Each element is copied using Global_oType_OCOPY.

This is a simple frontend to Vector_make_gap and Vector_overwrite. To insert only portions of the initial vector, use these functions directly.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & prepend (Vector_t const & a)

C++: Vector_t & Vector_t::prepend (Vector_t const & a)
C: int Vector_insert_vector (Vector_t * self, int start_index, Vector_t const * initial)

Each element is copied using Global_oType_OCOPY.

This is a simple frontend to Vector_make_gap and Vector_overwrite. To insert only portions of the initial vector, use these functions directly.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & prepend (oType const * a)

C++: Vector_t & Vector_t::prepend (oType const * a)
C: int Vector_insert_string (Vector_t * self, int start_index, oType const * values)

Inserts a zero-terminated string into the vector.

In all other aspects it works just like Vector_insert_vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & append (Vector_t const * a)

C++: Vector_t & Vector_t::append (Vector_t const * a)
C: int Vector_append_vector (Vector_t * self, Vector_t const * other)

Append a whole other vector at the end of the vector self.

This is a frontend to Vector_insert.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & append (Vector_t const & a)

C++: Vector_t & Vector_t::append (Vector_t const & a)
C: int Vector_append_vector (Vector_t * self, Vector_t const * other)

Append a whole other vector at the end of the vector self.

This is a frontend to Vector_insert.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & append (oType const * a)

C++: Vector_t & Vector_t::append (oType const * a)
C: int Vector_append_string (Vector_t * self, oType const * theelements)

Like Vector_append_raw, but with a zero-terminated string instead of a number of elements. The null-termination will not be copied.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & operator<< (oType const * a)

C++: Vector_t & Vector_t::operator<< (oType const * a)
C: int Vector_append_string (Vector_t * self, oType const * theelements)

Like Vector_append_raw, but with a zero-terminated string instead of a number of elements. The null-termination will not be copied.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


Vector_t & operator<< (oTypeTouched a)

C++: Vector_t & Vector_t::operator<< (oTypeTouched a)
C: int Vector_append (Vector_t * self, oTypeTouched value)

Appends one elements, namely value, to the end of the vector.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & operator<< (Vector_t const * a)

C++: Vector_t & Vector_t::operator<< (Vector_t const * a)
C: int Vector_append_vector (Vector_t * self, Vector_t const * other)

Append a whole other vector at the end of the vector self.

This is a frontend to Vector_insert.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & operator<< (Vector_t const & a)

C++: Vector_t & Vector_t::operator<< (Vector_t const & a)
C: int Vector_append_vector (Vector_t * self, Vector_t const * other)

Append a whole other vector at the end of the vector self.

This is a frontend to Vector_insert.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find (oTypeParam needle) const

C++: int Vector_t::find (oTypeParam needle) const
C: int Vector_find (Vector_t const * self, int start, oTypeParam needle)

Tries to finds an entry equal to needle. Returns the index of the first element >= start or -1 of nothing was found. The search is performed from the beginning to the end.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be 0.

Note

This function is not called `Vector_search', because it does not only perform the search, but also returns the result of that search.

References

Vector_rfind, Vector_bfind.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_raw (oType const * needle, Vector_cnt_t n) const

C++: int Vector_t::find_raw (oType const * needle, int n) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_string (oType const * needle) const

C++: int Vector_t::find_string (oType const * needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_vector (Vector_t const & needle) const

C++: int Vector_t::find_vector (Vector_t const & needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_vector (Vector_t const * needle) const

C++: int Vector_t::find_vector (Vector_t const * needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t find (oType const * needle, Vector_cnt_t n) const

C++: int Vector_t::find (oType const * needle, int n) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t find (oType const * needle) const

C++: int Vector_t::find (oType const * needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t find (Vector_t const & needle) const

C++: int Vector_t::find (Vector_t const & needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t find (Vector_t const * needle) const

C++: int Vector_t::find (Vector_t const * needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

#endif
C Declaration  | C++ Declaration & Source  ]


Vector_index_t find (Vector_index_t a, oTypeParam needle) const

C++: int Vector_t::find (int a, oTypeParam needle) const
C: int Vector_find (Vector_t const * self, int start, oTypeParam needle)

Tries to finds an entry equal to needle. Returns the index of the first element >= start or -1 of nothing was found. The search is performed from the beginning to the end.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be 0.

Note

This function is not called `Vector_search', because it does not only perform the search, but also returns the result of that search.

References

Vector_rfind, Vector_bfind.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_raw (Vector_index_t a, oType const * needle, Vector_cnt_t n) const

C++: int Vector_t::find_raw (int a, oType const * needle, int n) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_string (Vector_index_t a, oType const * needle) const

C++: int Vector_t::find_string (int a, oType const * needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_vector (Vector_index_t a, Vector_t const & needle) const

C++: int Vector_t::find_vector (int a, Vector_t const & needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_vector (Vector_index_t a, Vector_t const * needle) const

C++: int Vector_t::find_vector (int a, Vector_t const * needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t find (Vector_index_t a, oType const * needle, Vector_cnt_t n) const

C++: int Vector_t::find (int a, oType const * needle, int n) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t find (Vector_index_t a, oType const * needle) const

C++: int Vector_t::find (int a, oType const * needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t find (Vector_index_t a, Vector_t const & needle) const

C++: int Vector_t::find (int a, Vector_t const & needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t find (Vector_index_t a, Vector_t const * needle) const

C++: int Vector_t::find (int a, Vector_t const * needle) const
C: int Vector_find_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_find but tries to find equal parts. See Vector_rfind_raw.

#endif
C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind (oTypeParam needle) const

C++: int Vector_t::rfind (oTypeParam needle) const
C: int Vector_rfind (Vector_t const * self, int start, oTypeParam needle)

Tries to finds an entry equal to needle. Returns the index of the first element <= start or -1 of nothing was found. The search is performed from the end to the beginning.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be -1.

References

Vector_find

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_raw (oType const * needle, Vector_cnt_t n) const

C++: int Vector_t::rfind_raw (oType const * needle, int n) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_string (oType const * needle) const

C++: int Vector_t::rfind_string (oType const * needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_vector (Vector_t const & needle) const

C++: int Vector_t::rfind_vector (Vector_t const & needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_vector (Vector_t const * needle) const

C++: int Vector_t::rfind_vector (Vector_t const * needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t rfind (oType const * needle, Vector_cnt_t n) const

C++: int Vector_t::rfind (oType const * needle, int n) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t rfind (oType const * needle) const

C++: int Vector_t::rfind (oType const * needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t rfind (Vector_t const & needle) const

C++: int Vector_t::rfind (Vector_t const & needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t rfind (Vector_t const * needle) const

C++: int Vector_t::rfind (Vector_t const * needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind (Vector_index_t a, oTypeParam needle) const

C++: int Vector_t::rfind (int a, oTypeParam needle) const
C: int Vector_rfind (Vector_t const * self, int start, oTypeParam needle)

Tries to finds an entry equal to needle. Returns the index of the first element <= start or -1 of nothing was found. The search is performed from the end to the beginning.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be -1.

References

Vector_find

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_raw (Vector_index_t a, oType const * needle, Vector_cnt_t n) const

C++: int Vector_t::rfind_raw (int a, oType const * needle, int n) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_string (Vector_index_t a, oType const * needle) const

C++: int Vector_t::rfind_string (int a, oType const * needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_vector (Vector_index_t a, Vector_t const & needle) const

C++: int Vector_t::rfind_vector (int a, Vector_t const & needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_vector (Vector_index_t a, Vector_t const * needle) const

C++: int Vector_t::rfind_vector (int a, Vector_t const * needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t rfind (Vector_index_t a, oType const * needle, Vector_cnt_t n) const

C++: int Vector_t::rfind (int a, oType const * needle, int n) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t rfind (Vector_index_t a, oType const * needle) const

C++: int Vector_t::rfind (int a, oType const * needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t rfind (Vector_index_t a, Vector_t const & needle) const

C++: int Vector_t::rfind (int a, Vector_t const & needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_index_t rfind (Vector_index_t a, Vector_t const * needle) const

C++: int Vector_t::rfind (int a, Vector_t const * needle) const
C: int Vector_rfind_raw (Vector_t const * self, int start, oType const * needle, int len)

Like Vector_rfind but tries to find equal parts.

Return the position of `needle' or -1 if it is not found. Note that it is no problem to search for the zero element Global_oType_ZERO. These all use the Vector_EQUAL macro.

Negative values for start will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


bool is_equal_at_raw (Vector_index_t a, oType const * b, Vector_cnt_t n) const

C++: bool Vector_t::is_equal_at_raw (int a, oType const * b, int n) const
C: Global_ERWIN_BOOL Vector_is_equal_at (Vector_t const * self, int pos, oType const * other, int len)

Checks whether the given string is found at the given position. Negative values for pos will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


bool is_equal_at_string (Vector_index_t a, oType const * b) const

C++: bool Vector_t::is_equal_at_string (int a, oType const * b) const
C: Global_ERWIN_BOOL Vector_is_equal_at (Vector_t const * self, int pos, oType const * other, int len)

Checks whether the given string is found at the given position. Negative values for pos will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


bool is_equal_at_vector (Vector_index_t a, Vector_t const & b) const

C++: bool Vector_t::is_equal_at_vector (int a, Vector_t const & b) const
C: Global_ERWIN_BOOL Vector_is_equal_at (Vector_t const * self, int pos, oType const * other, int len)

Checks whether the given string is found at the given position. Negative values for pos will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


bool is_equal_at_vector (Vector_index_t a, Vector_t const * b) const

C++: bool Vector_t::is_equal_at_vector (int a, Vector_t const * b) const
C: Global_ERWIN_BOOL Vector_is_equal_at (Vector_t const * self, int pos, oType const * other, int len)

Checks whether the given string is found at the given position. Negative values for pos will count from the end of the vector.

C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

bool is_equal_at (Vector_index_t a, oType const * b, Vector_cnt_t n) const

C++: bool Vector_t::is_equal_at (int a, oType const * b, int n) const
C: Global_ERWIN_BOOL Vector_is_equal_at (Vector_t const * self, int pos, oType const * other, int len)

Checks whether the given string is found at the given position. Negative values for pos will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

bool is_equal_at (Vector_index_t a, oType const * b) const

C++: bool Vector_t::is_equal_at (int a, oType const * b) const
C: Global_ERWIN_BOOL Vector_is_equal_at (Vector_t const * self, int pos, oType const * other, int len)

Checks whether the given string is found at the given position. Negative values for pos will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

bool is_equal_at (Vector_index_t a, Vector_t const & b) const

C++: bool Vector_t::is_equal_at (int a, Vector_t const & b) const
C: Global_ERWIN_BOOL Vector_is_equal_at (Vector_t const * self, int pos, oType const * other, int len)

Checks whether the given string is found at the given position. Negative values for pos will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

bool is_equal_at (Vector_index_t a, Vector_t const * b) const

C++: bool Vector_t::is_equal_at (int a, Vector_t const * b) const
C: Global_ERWIN_BOOL Vector_is_equal_at (Vector_t const * self, int pos, oType const * other, int len)

Checks whether the given string is found at the given position. Negative values for pos will count from the end of the vector.

#endif
C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_if (Vector_feature_t feature, bool inverted = true)

C++: int Vector_t::find_if (Vector_feature_t feature, bool inverted = true)
C: int Vector_find_if (Vector_t const * self, int start, Vector_feature_t feature, Global_ERWIN_BOOL value)

find_if behaves like position-if in CommonLisp.

Tries to find an entry with a certain feature. Returns the index of the first element >= start or -1 of nothing was found. The search is performed from the beginning to the end.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be 0.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_if (Vector_index_t start, Vector_feature_t feature, bool inverted = true)

C++: int Vector_t::find_if (int start, Vector_feature_t feature, bool inverted = true)
C: int Vector_find_if (Vector_t const * self, int start, Vector_feature_t feature, Global_ERWIN_BOOL value)

find_if behaves like position-if in CommonLisp.

Tries to find an entry with a certain feature. Returns the index of the first element >= start or -1 of nothing was found. The search is performed from the beginning to the end.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be 0.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_if (Vector_feature_t feature, bool inverted = true)

C++: int Vector_t::rfind_if (Vector_feature_t feature, bool inverted = true)
C: int Vector_rfind_if (Vector_t const * self, int start, Vector_feature_t feature, Global_ERWIN_BOOL value)

Tries to find an entry with a certain feature. Returns the index of the first element <= start or -1 of nothing was found. The search is performed from the end to the beginning.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be -1.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_if (Vector_index_t start, Vector_feature_t feature, bool inverted = true)

C++: int Vector_t::rfind_if (int start, Vector_feature_t feature, bool inverted = true)
C: int Vector_rfind_if (Vector_t const * self, int start, Vector_feature_t feature, Global_ERWIN_BOOL value)

Tries to find an entry with a certain feature. Returns the index of the first element <= start or -1 of nothing was found. The search is performed from the end to the beginning.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be -1.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_if_not (Vector_feature_t feature, bool inverted = true)

C++: int Vector_t::find_if_not (Vector_feature_t feature, bool inverted = true)
C: int Vector_find_if (Vector_t const * self, int start, Vector_feature_t feature, Global_ERWIN_BOOL value)

find_if behaves like position-if in CommonLisp.

Tries to find an entry with a certain feature. Returns the index of the first element >= start or -1 of nothing was found. The search is performed from the beginning to the end.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be 0.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t find_if_not (Vector_index_t start, Vector_feature_t feature, bool inverted = true)

C++: int Vector_t::find_if_not (int start, Vector_feature_t feature, bool inverted = true)
C: int Vector_find_if (Vector_t const * self, int start, Vector_feature_t feature, Global_ERWIN_BOOL value)

find_if behaves like position-if in CommonLisp.

Tries to find an entry with a certain feature. Returns the index of the first element >= start or -1 of nothing was found. The search is performed from the beginning to the end.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be 0.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_if_not (Vector_feature_t feature, bool inverted = true)

C++: int Vector_t::rfind_if_not (Vector_feature_t feature, bool inverted = true)
C: int Vector_rfind_if (Vector_t const * self, int start, Vector_feature_t feature, Global_ERWIN_BOOL value)

Tries to find an entry with a certain feature. Returns the index of the first element <= start or -1 of nothing was found. The search is performed from the end to the beginning.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be -1.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t rfind_if_not (Vector_index_t start, Vector_feature_t feature, bool inverted = true)

C++: int Vector_t::rfind_if_not (int start, Vector_feature_t feature, bool inverted = true)
C: int Vector_rfind_if (Vector_t const * self, int start, Vector_feature_t feature, Global_ERWIN_BOOL value)

Tries to find an entry with a certain feature. Returns the index of the first element <= start or -1 of nothing was found. The search is performed from the end to the beginning.

If start is negativ, search is started at the last but start-th position. So to search the whole vector, start should be -1.

C Declaration  | C++ Declaration & Source  ]


Vector_t & ltrim_if (Vector_feature_t feature, bool inverted = true)

C++: Vector_t & Vector_t::ltrim_if (Vector_feature_t feature, bool inverted = true)
C: void Vector_ltrim_if (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)

Cuts off all elements that have the `feature' from the left of the vector

References

Vector_rtrim_if, Vector_trim_if

C Declaration  | C++ Declaration & Source  ]


Vector_t & ltrim_if_not (Vector_feature_t feature, bool inverted = true)

C++: Vector_t & Vector_t::ltrim_if_not (Vector_feature_t feature, bool inverted = true)
C: void Vector_ltrim_if (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)

Cuts off all elements that have the `feature' from the left of the vector

References

Vector_rtrim_if, Vector_trim_if

C Declaration  | C++ Declaration & Source  ]


Vector_t & rtrim_if (Vector_feature_t feature, bool inv = true)

C++: Vector_t & Vector_t::rtrim_if (Vector_feature_t feature, bool inv = true)
C: void Vector_rtrim_if (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)

Cuts off all elements that have the `feature' from the right of the vector

References

Vector_ltrim_if, Vector_trim_if

C Declaration  | C++ Declaration & Source  ]


Vector_t & rtrim_if_not (Vector_feature_t feature, bool inv = true)

C++: Vector_t & Vector_t::rtrim_if_not (Vector_feature_t feature, bool inv = true)
C: void Vector_rtrim_if (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)

Cuts off all elements that have the `feature' from the right of the vector

References

Vector_ltrim_if, Vector_trim_if

C Declaration  | C++ Declaration & Source  ]


Vector_t & trim_if (Vector_feature_t feature, bool inv = true)

C++: Vector_t & Vector_t::trim_if (Vector_feature_t feature, bool inv = true)
C: void Vector_trim_if (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)

Cuts off all elements that have the `feature' from the left and right of the vector

References

Vector_ltrim_if, Vector_rtrim_if

C Declaration  | C++ Declaration & Source  ]


Vector_t & trim_if_not (Vector_feature_t feature, bool inv = true)

C++: Vector_t & Vector_t::trim_if_not (Vector_feature_t feature, bool inv = true)
C: void Vector_trim_if (Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)

Cuts off all elements that have the `feature' from the left and right of the vector

References

Vector_ltrim_if, Vector_rtrim_if

C Declaration  | C++ Declaration & Source  ]


Vector_t & map (Vector_map_t fmap)

C++: Vector_t & Vector_t::map (Vector_map_t fmap)
C: void Vector_map (Vector_t * self, Vector_map_t map)

Applies a given function to all elements of the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_t & ltrim ()

C++: Vector_t & Vector_t::ltrim ()
C: void Vector_ltrim (Vector_t * self)

See Vector_trim.

C Declaration  | C++ Declaration & Source  ]


Vector_t & rtrim ()

C++: Vector_t & Vector_t::rtrim ()
C: void Vector_rtrim (Vector_t * self)

See Vector_trim.

C Declaration  | C++ Declaration & Source  ]


Vector_t & trim ()

C++: Vector_t & Vector_t::trim ()
C: void Vector_trim (Vector_t * self)

Like the Vector_trim_if family with an isspace feature. The special isspace used here defines '\0' to be a space. This is useful for pre-allocating space by inserting \0, then using standard clib functions to fill the buffer, and then trimming it.

C Declaration  | C++ Declaration & Source  ]


Vector_t & chomp ()

C++: Vector_t & Vector_t::chomp ()
C: void Vector_chomp (Vector_t * self)

Like Vector_rtrim with ((X) == '\n' (X) == '\r') feature

C Declaration  | C++ Declaration & Source  ]


Vector_t & to_upper ()

C++: Vector_t & Vector_t::to_upper ()
C: void Vector_to_upper (Vector_t * self)

Translates all elements using the Global_erwin_to_upper function.

C Declaration  | C++ Declaration & Source  ]


Vector_t & to_lower ()

C++: Vector_t & Vector_t::to_lower ()
C: void Vector_to_lower (Vector_t * self)

Translates all elements using the Global_erwin_to_lower function.

C Declaration  | C++ Declaration & Source  ]


#if defined(ERWIN_UNSIGNED_LONG_LONG)

Vector_t & operator<< (ERWIN_UNSIGNED_LONG_LONG a)

C++: Vector_t & Vector_t::operator<< (ERWIN_UNSIGNED_LONG_LONG a)
#endif
Declaration & Source  ]


#if defined(ERWIN_UNSIGNED_LONG_LONG)

Vector_t & operator<< (ERWIN_LONG_LONG a)

C++: Vector_t & Vector_t::operator<< (ERWIN_LONG_LONG a)
#endif
Declaration & Source  ]


Vector_t & operator<< (unsigned long a)

C++: Vector_t & Vector_t::operator<< (unsigned long a)
Declaration & Source  ]


Vector_t & operator<< (signed long a)

C++: Vector_t & Vector_t::operator<< (signed long a)
Declaration & Source  ]


Vector_t & operator<< (unsigned int a)

C++: Vector_t & Vector_t::operator<< (unsigned int a)
Declaration & Source  ]


Vector_t & operator<< (signed int a)

C++: Vector_t & Vector_t::operator<< (signed int a)
Declaration & Source  ]


Vector_t & operator<< (double a)

C++: Vector_t & Vector_t::operator<< (double a)
Declaration & Source  ]


Vector_t & operator<< (void * a)

C++: Vector_t & Vector_t::operator<< (void * a)
Declaration & Source  ]


Vector_t & operator<< (unsigned short a)

C++: Vector_t & Vector_t::operator<< (unsigned short a)
Declaration & Source  ]


Vector_t & operator<< (signed short a)

C++: Vector_t & Vector_t::operator<< (signed short a)
Declaration & Source  ]


Vector_t & operator<< (bool a)

C++: Vector_t & Vector_t::operator<< (bool a)
Declaration & Source  ]


#if defined(ERWIN_UNSIGNED_LONG_LONG)

static Vector_t stringify (ERWIN_UNSIGNED_LONG_LONG a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (ERWIN_UNSIGNED_LONG_LONG a, int base, int options, int width, int prec = -1)
#endif
Declaration & Source  ]


#if defined(ERWIN_UNSIGNED_LONG_LONG)

static Vector_t stringify (ERWIN_LONG_LONG a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (ERWIN_LONG_LONG a, int base, int options, int width, int prec = -1)
#endif
Declaration & Source  ]


static Vector_t stringify (unsigned long a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (unsigned long a, int base, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (long a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (long a, int base, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (unsigned a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (unsigned a, int base, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (int a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (int a, int base, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (unsigned short a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (unsigned short a, int base, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (short a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (short a, int base, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (double a, int base, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (double a, int base, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (char a, int options, int width)

C++: Vector_t Vector_t::stringify (char a, int options, int width)
Declaration & Source  ]


static Vector_t stringify (char const * a, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (char const * a, int options, int width, int prec = -1)
Declaration & Source  ]


#if defined(ERWIN_WIDE_CHARACTERS)

static Vector_t stringify (wchar_t const * a, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (wchar_t const * a, int options, int width, int prec = -1)
#endif
Declaration & Source  ]


static Vector_t stringify (Vector_t const * a, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (Vector_t const * a, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (Vector_t const & a, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (Vector_t const & a, int options, int width, int prec = -1)
Declaration & Source  ]


static Vector_t stringify (bool a, int options, int width, int prec = -1)

C++: Vector_t Vector_t::stringify (bool a, int options, int width, int prec = -1)
Declaration & Source  ]


int fread (FILE * fileptr, Vector_cnt_t max_count = -1)

C++: int Vector_t::fread (FILE * fileptr, int max_count = -1)
C: int Vector_fread (Vector_t * self, FILE * f, int max_count)

Read the whole file or a prefix into the vector. If you pass -1 for max_count, there is no maximal count.

This function returns the number of elements read or -1 in case of an error. If vector_errno is VECTOR_ERR_IO, you can use ferror(f) to query the error.

C Declaration  | C++ Declaration & Source  ]


Vector_t & fgets (FILE * fileptr, Vector_cnt_t max_count = -1)

C++: Vector_t & Vector_t::fgets (FILE * fileptr, int max_count = -1)
C: int Vector_fgets (Vector_t * self, FILE * f, int max_count)

Read one line into the vector. You can bound the number of elements stored in the vector. However, a line is always read completely to the end.

This function returns the error code. VECTOR_OK means no error.

If no char could be read, this returns VECTOR_WARN_EMPTY. Otherwise, VECTOR_OK is returned if not file error occured, VECTOR_ERR_IO otherwise. Then you can query the error on the file using ferror (f).

Like the clib function, the trailing \n is appended if it was there.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t basename_index () const

C++: int Vector_t::basename_index () const
C: int Vector_basename_index (Vector_t const * self)

Note

This function is obsolete and left in for compatibility reasons. Use Vector_basename_range instead.

Returns the index of the first character that belongs to the basename of a file name. The algorithm depends on the operating system this runs on.

E.g. under Unix, for "tmp/test" this function returns 5. To get the length of the basename, use Vector_basename_range.

C Declaration  | C++ Declaration & Source  ]


void basename_range (Vector_index_t & no1, Vector_cnt_t & length) const

C++: void Vector_t::basename_range (int & no1, int & length) const
C: void Vector_basename_range (int * first, int * length, Vector_t const * self)

Returns the index of the first and last characters that belongs to the basename of a file name. The algorithm depends on the operating system this runs on.

This is an extended version of Vector_basename_index, which does not return the last index. E.g. under Unix, for "tmp/test" this function returns: *first= 5, *length= 4

first and length may be NULL in which case nothing is returned for the respective value.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_directory (Vector_t const & other)

C++: Vector_t & Vector_t::append_directory (Vector_t const & other)
C: int Vector_append_directory (Vector_t * self, Vector_t const * path)

Append the directory of path to self. This appended string includes the path separator if necessary. Returns Global_vector_errno.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_directory (Vector_t const * other)

C++: Vector_t & Vector_t::append_directory (Vector_t const * other)
C: int Vector_append_directory (Vector_t * self, Vector_t const * path)

Append the directory of path to self. This appended string includes the path separator if necessary. Returns Global_vector_errno.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_basename (Vector_t const & other)

C++: Vector_t & Vector_t::append_basename (Vector_t const & other)
C: int Vector_append_basename (Vector_t * self, Vector_t const * path)

Append the base name of path to self. This appended string does not include any path separator. Returns Global_vector_errno.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_basename (Vector_t const * other)

C++: Vector_t & Vector_t::append_basename (Vector_t const * other)
C: int Vector_append_basename (Vector_t * self, Vector_t const * path)

Append the base name of path to self. This appended string does not include any path separator. Returns Global_vector_errno.

C Declaration  | C++ Declaration & Source  ]


Vector_t & append_config_file_name (oType const * progname, bool local = false)

C++: Vector_t & Vector_t::append_config_file_name (oType const * progname, bool local = false)
C: int Vector_append_config_file_name (Vector_t * self, oType const * program_name, Global_ERWIN_BOOL local)

Append the default configuration file name (either global or local one) to the vector. The default global name under Unix is

/etc/progname.conf

under Windos it is

C:\etc\progname.ini

The default local name under Unix is

$HOME/.prognamerc

under Windos

%HOME%\progname.ini

Returns Global_vector_errno. Note that if $HOME is not defined (which is typical under DOS), VECTOR_ERR_OUTOFRANGE is returned and nothing appended if local != 0.

C Declaration  | C++ Declaration & Source  ]


#if Vector_NO_FORMAT == 0

Vector_t & format (Tchar const *, ...)

C++: Vector_t & Vector_t::format (Tchar const *, ...)
#endif
Declaration  ]


#if Vector_NO_FORMAT == 0

Vector_t & vformat (Tchar const *, va_list)

C++: Vector_t & Vector_t::vformat (Tchar const *, va_list)
#endif
Declaration  ]


#if Vector_NO_FORMAT == 0

Vector_t & format (unsigned long int, Tchar const *, ...)

C++: Vector_t & Vector_t::format (unsigned long int, Tchar const *, ...)

functions with option argument:

#endif
Declaration  ]


#if Vector_NO_FORMAT == 0

Vector_t & vformat (unsigned long int, Tchar const *, va_list)

C++: Vector_t & Vector_t::vformat (unsigned long int, Tchar const *, va_list)
#endif
Declaration  ]


#if Vector_NO_FORMAT == 0

Vector_t & format (Vector_format_info_t *, Tchar const *, ...)

C++: Vector_t & Vector_t::format (Vector_format_info_t *, Tchar const *, ...)

function with returned info

#endif
Declaration  ]


#if Vector_NO_FORMAT == 0

Vector_t & vformat (Vector_format_info_t *, Tchar const *, va_list)

C++: Vector_t & Vector_t::vformat (Vector_format_info_t *, Tchar const *, va_list)
#endif
Declaration  ]


#if Vector_NO_FORMAT == 0

Vector_t & format (Vector_format_info_t *, unsigned long int, Tchar const *, ...)

C++: Vector_t & Vector_t::format (Vector_format_info_t *, unsigned long int, Tchar const *, ...)

functions with returned info and option argument:

#endif
Declaration  ]


#if Vector_NO_FORMAT == 0

Vector_t & vformat (Vector_format_info_t *, unsigned long int, Tchar const *, va_list)

C++: Vector_t & Vector_t::vformat (Vector_format_info_t *, unsigned long int, Tchar const *, va_list)
#endif
Declaration  ]


#if (Vector_NO_FORMAT == 0) && Global_ERWIN_GLOBAL_ERRNO

static bool format_quoted ()

C++: bool Vector_t::format_quoted ()
#endif
Declaration  ]


#if (Vector_NO_FORMAT == 0) && Global_ERWIN_GLOBAL_ERRNO

static Vector_index_t format_pos ()

C++: int Vector_t::format_pos ()
#endif
Declaration  ]


Vector_t & make_gap (Vector_index_t a, Vector_cnt_t b)

C++: Vector_t & Vector_t::make_gap (int a, int b)
C: int Vector_make_gap (Vector_t * self, int start_index, int count)

Inserts count zero elements into the vector at position start_index.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & make_gap (Vector_index_t a, oTypeTouched x, Vector_cnt_t b)

C++: Vector_t & Vector_t::make_gap (int a, oTypeTouched x, int b)
C: int Vector_make_gap_with (Vector_t * self, int start_index, oTypeTouched elem, int count)

Like Vector_make_gap but with a given value (which is copied for each entry if necessary.

C Declaration  | C++ Declaration & Source  ]


Vector_t & make_gap_with (Vector_index_t a, oTypeTouched x, Vector_cnt_t b)

C++: Vector_t & Vector_t::make_gap_with (int a, oTypeTouched x, int b)

compatibility function

Declaration & Source  ]


oTypeResult zero () const

C++: oTypeResult Vector_t::zero () const
C: oTypeResult Vector_zero (Vector_t const * self)

Returns the zero element of this vector. This need not be the same for all vectors (you can specify it with Vector_new_with_zero) unless you defined Vector_CONSTANT_ZERO.

C Declaration  | C++ Declaration & Source  ]


Vector_t & overwrite (Vector_index_t i, Vector_t const * a, Vector_index_t ia, Vector_cnt_t n)

C++: Vector_t & Vector_t::overwrite (int i, Vector_t const * a, int ia, int n)
C: int Vector_overwrite (Vector_t * self, int start_index_in_self, Vector_t const * newdata, int start_index_in_initial, int max_count)

Each element is copied using Global_oType_OCOPY, the old contents are deleted with Global_oType_OFREE. This overwrites maximally max_count elements from initial to self starting at position start_index_in* in the two vectors.

This is a frontend to Vector_overwrite_raw.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & overwrite (Vector_index_t i, Vector_t const & a, Vector_index_t ia, Vector_cnt_t n)

C++: Vector_t & Vector_t::overwrite (int i, Vector_t const & a, int ia, int n)
C: int Vector_overwrite (Vector_t * self, int start_index_in_self, Vector_t const * newdata, int start_index_in_initial, int max_count)

Each element is copied using Global_oType_OCOPY, the old contents are deleted with Global_oType_OFREE. This overwrites maximally max_count elements from initial to self starting at position start_index_in* in the two vectors.

This is a frontend to Vector_overwrite_raw.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & overwrite_raw (Vector_index_t i, oType const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::overwrite_raw (int i, oType const * a, int n)
C: int Vector_overwrite_raw (Vector_t * self, int start_index_in_self, oType const * newdata, int count)

Overwrites portions of the vector from a normal array. The overwritten data is freed using oType_OFREE in the old vector and the new data copied from the new data array using oType_OCOPY.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & overwrite_string (Vector_index_t i, oType const * a)

C++: Vector_t & Vector_t::overwrite_string (int i, oType const * a)
C: int Vector_overwrite_string (Vector_t * self, int start_index_in_self, oType const * newdata)

Overwrites portions of the vector from a normal array. Like Vector_overwrite_raw but with a zero-terminated string.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & overwrite_vector (Vector_index_t i, Vector_t const * a)

C++: Vector_t & Vector_t::overwrite_vector (int i, Vector_t const * a)
C: int Vector_overwrite_vector (Vector_t * self, int start_index_in_self, Vector_t const * newdata)

Overwrites portions of the vector from a vector. Like Vector_overwrite_raw but takes its data from another vector.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & overwrite_vector (Vector_index_t i, Vector_t const & a)

C++: Vector_t & Vector_t::overwrite_vector (int i, Vector_t const & a)
C: int Vector_overwrite_vector (Vector_t * self, int start_index_in_self, Vector_t const * newdata)

Overwrites portions of the vector from a vector. Like Vector_overwrite_raw but takes its data from another vector.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & overwrite_flags (Vector_index_t i, oType const * a, Vector_cnt_t n, bool dealloc, bool docopy)

C++: Vector_t & Vector_t::overwrite_flags (int i, oType const * a, int n, bool dealloc, bool docopy)
C: int Vector_overwrite_flags (Vector_t * self, int start_index, oType const * values, int count, Global_ERWIN_BOOL copy_elements, Global_ERWIN_BOOL delete_overwritten_elements)

Like Vector_overwrite_raw but you can further specify its (de-)allocation behaviour.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & overwrite (Vector_index_t i, oType const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::overwrite (int i, oType const * a, int n)
C: int Vector_overwrite_raw (Vector_t * self, int start_index_in_self, oType const * newdata, int count)

Overwrites portions of the vector from a normal array. The overwritten data is freed using oType_OFREE in the old vector and the new data copied from the new data array using oType_OCOPY.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & overwrite (Vector_index_t i, oType const * a)

C++: Vector_t & Vector_t::overwrite (int i, oType const * a)
C: int Vector_overwrite_string (Vector_t * self, int start_index_in_self, oType const * newdata)

Overwrites portions of the vector from a normal array. Like Vector_overwrite_raw but with a zero-terminated string.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & overwrite (Vector_index_t i, Vector_t const * a)

C++: Vector_t & Vector_t::overwrite (int i, Vector_t const * a)
C: int Vector_overwrite_vector (Vector_t * self, int start_index_in_self, Vector_t const * newdata)

Overwrites portions of the vector from a vector. Like Vector_overwrite_raw but takes its data from another vector.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & overwrite (Vector_index_t i, Vector_t const & a)

C++: Vector_t & Vector_t::overwrite (int i, Vector_t const & a)
C: int Vector_overwrite_vector (Vector_t * self, int start_index_in_self, Vector_t const * newdata)

Overwrites portions of the vector from a vector. Like Vector_overwrite_raw but takes its data from another vector.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


Vector_t & insert (Vector_index_t i, oTypeTouched a)

C++: Vector_t & Vector_t::insert (int i, oTypeTouched a)
C: int Vector_insert (Vector_t * self, int index, oTypeTouched element)

Inserts one element at position index.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & insert_raw (Vector_index_t i, oType const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::insert_raw (int i, oType const * a, int n)
C: int Vector_insert_raw (Vector_t * self, int index, oType const * values, int count)

Inserts elements from an open array whose size is given by count. In all other aspects it works just like Vector_insert_vector.

C Declaration  | C++ Declaration & Source  ]


Vector_t & insert_no_copy (Vector_index_t i, oTypeVar const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::insert_no_copy (int i, oTypeVar const * a, int n)
C: int Vector_insert_no_copy (Vector_t * self, int index, oTypeVar const * values, int count)

Like Vector_insert_raw but does not copy the given data.

C Declaration  | C++ Declaration & Source  ]


Vector_t & insert_string (Vector_index_t i, oType const * a)

C++: Vector_t & Vector_t::insert_string (int i, oType const * a)
C: int Vector_insert_string (Vector_t * self, int start_index, oType const * values)

Inserts a zero-terminated string into the vector.

In all other aspects it works just like Vector_insert_vector.

C Declaration  | C++ Declaration & Source  ]


Vector_t & insert_vector (Vector_index_t i, Vector_t const * a)

C++: Vector_t & Vector_t::insert_vector (int i, Vector_t const * a)
C: int Vector_insert_vector (Vector_t * self, int start_index, Vector_t const * initial)

Each element is copied using Global_oType_OCOPY.

This is a simple frontend to Vector_make_gap and Vector_overwrite. To insert only portions of the initial vector, use these functions directly.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & insert_vector (Vector_index_t i, Vector_t const & a)

C++: Vector_t & Vector_t::insert_vector (int i, Vector_t const & a)
C: int Vector_insert_vector (Vector_t * self, int start_index, Vector_t const * initial)

Each element is copied using Global_oType_OCOPY.

This is a simple frontend to Vector_make_gap and Vector_overwrite. To insert only portions of the initial vector, use these functions directly.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & insert_subvector (Vector_index_t i, Vector_t const * a, Vector_index_t b = 0, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)

C++: Vector_t & Vector_t::insert_subvector (int i, Vector_t const * a, int b = 0, int c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
C: int Vector_insert_subvector (Vector_t * self, int start_index_self, Vector_t const * other, int start_index_other, int size, Global_ERWIN_BOOL docopy)

Inserts a portion of a vector into another one. If size is < 0, it defines the last element to enter. -1 therefore means: the rest of the vector starting at start_index

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & insert_subvector (Vector_index_t i, Vector_t const & a, Vector_index_t b = 0, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)

C++: Vector_t & Vector_t::insert_subvector (int i, Vector_t const & a, int b = 0, int c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
C: int Vector_insert_subvector (Vector_t * self, int start_index_self, Vector_t const * other, int start_index_other, int size, Global_ERWIN_BOOL docopy)

Inserts a portion of a vector into another one. If size is < 0, it defines the last element to enter. -1 therefore means: the rest of the vector starting at start_index

Returns its success.

C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & insert (Vector_index_t i, Vector_t const & a, Vector_index_t b, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)

C++: Vector_t & Vector_t::insert (int i, Vector_t const & a, int b, int c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
#endif
Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & insert (Vector_index_t i, Vector_t const * a, Vector_index_t b, Vector_cnt_t c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)

C++: Vector_t & Vector_t::insert (int i, Vector_t const * a, int b, int c = -1, Global_ERWIN_BOOL d = Global_ERWIN_TRUE)
#endif
Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & insert (Vector_index_t i, oType const * a, Vector_cnt_t n)

C++: Vector_t & Vector_t::insert (int i, oType const * a, int n)
C: int Vector_insert_raw (Vector_t * self, int index, oType const * values, int count)

Inserts elements from an open array whose size is given by count. In all other aspects it works just like Vector_insert_vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & insert (Vector_index_t i, oType const * a)

C++: Vector_t & Vector_t::insert (int i, oType const * a)
C: int Vector_insert_string (Vector_t * self, int start_index, oType const * values)

Inserts a zero-terminated string into the vector.

In all other aspects it works just like Vector_insert_vector.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & insert (Vector_index_t i, Vector_t const * a)

C++: Vector_t & Vector_t::insert (int i, Vector_t const * a)
C: int Vector_insert_vector (Vector_t * self, int start_index, Vector_t const * initial)

Each element is copied using Global_oType_OCOPY.

This is a simple frontend to Vector_make_gap and Vector_overwrite. To insert only portions of the initial vector, use these functions directly.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Vector_DIRECT_RECURSION == 0

Vector_t & insert (Vector_index_t i, Vector_t const & a)

C++: Vector_t & Vector_t::insert (int i, Vector_t const & a)
C: int Vector_insert_vector (Vector_t * self, int start_index, Vector_t const * initial)

Each element is copied using Global_oType_OCOPY.

This is a simple frontend to Vector_make_gap and Vector_overwrite. To insert only portions of the initial vector, use these functions directly.

Possible values for index are 0...Vector_nentries(self) both inclusive.

Returns its success.

#endif
C Declaration  | C++ Declaration & Source  ]


Vector_cnt_t string_length (oType const * a) const

C++: int Vector_t::string_length (oType const * a) const
C: int Vector_string_length (Vector_t const * self, oType const * string)

Find out the string length of the given zero-terminated string.

The zero element is taken from the vector. This does not modify the vector at all, nor does it look at the vector's elements. It only gets the zero element from the vector.

C Declaration  | C++ Declaration & Source  ]


Vector_t & ensure_size (Vector_cnt_t a)

C++: Vector_t & Vector_t::ensure_size (int a)
C: int Vector_ensure_size (Vector_t * self, int size)

Possibly enlarges the vector by appending null elements.

This is more than Vector_ensure_table_size, since the vector gets the given size with zero-initialised elements at the tail if necessary.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & ensure_size (Vector_cnt_t a, oTypeTouched b)

C++: Vector_t & Vector_t::ensure_size (int a, oTypeTouched b)
C: int Vector_ensure_size_with (Vector_t * self, int size, oTypeTouched elem)

Possibly enlarges the vector by appending the given elements.

This is similar to Vector_ensure_size, but you can define with which element the vector will be filled when grown.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & set_size (Vector_cnt_t a)

C++: Vector_t & Vector_t::set_size (int a)
C: int Vector_set_size (Vector_t * self, int size)

Set the vector size (by shrinking or enlarging and filling with null elements).

Note that the function will never resize the vector smaller than Vector_MINIMAL_SIZE (actually, no function will do that).

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_t & set_size (Vector_cnt_t a, oTypeTouched b)

C++: Vector_t & Vector_t::set_size (int a, oTypeTouched b)
C: int Vector_set_size_with (Vector_t * self, int size, oTypeTouched elem)

Set the vector size (by shrinking or enlarging and filling with the given elements).

This is similar to Vector_set_size, but you can define with which element the vector will be filled when grown.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


int ensure_table_size (Vector_cnt_t a)

C++: int Vector_t::ensure_table_size (int a)
C: int Vector_ensure_table_size (Vector_t * self, int size)

Pre-allocates vector elements. To be used when you know some good upper approximation to the expected number of elements which will be inserted in the future. Does not change the contents of the vector.

To set a minimal size for the vector by appending zero elements, use Vector_ensure_size.

When Vector_LOW_MEM is active, this functions has no operation, since the table size cannot be changed independently from the size.

Returns its success.

C Declaration  | C++ Declaration & Source  ]


Vector_element_ptr_t as_array () const

C++: Vector_element_ptr_t Vector_t::as_array () const
C: Vector_element_ptr_t Vector_as_array (Vector_t const *)

returns a pointer to the string the vector is stored in. The string is terminated with a zero element (usually Global_oType_ZERO, but this can be changed by using Vector_new_with_zero).

Note

For convenience, this takes a const pointer although the representation (but not the contained data) might be changed. It only changes things outside the user view (behind the end of the vector).

Further note that NULL is ok, NULL is returned, regardless of Vector_ALLOW_NULL.

When Vector_INLINE_STORE is active, the returned pointer may become invalid when you invoke Vector_detach or Vector_detach_as_is. Use Vector_as_array_detach() in that case (you cannot split that operation in this case).

Developer's Note: this functions is not _pure_: it may change the internal structure, and thus the result of table_size() and has_heap_storage() etc.

C Declaration  | C++ Declaration & Source  ]


Vector_element_ptr_t as_open_array () const

C++: Vector_element_ptr_t Vector_t::as_open_array () const
C: Vector_element_ptr_t Vector_as_open_array (Vector_t const *)

Same as Vector_as_array, but without the guaranteed zero element. This is sometimes faster and never resizes the vector.

Note

If Vector_MINIMAL_SIZE is 0 and the vector has size 0, this function might return NULL instead of an allocated array! This is because the function will never try to reallocate.

When Vector_INLINE_STORE is active, the returned pointer may become invalid when you invoke Vector_detach or Vector_detach_as_is. Use Vector_as_array_detach() in that case (you cannot split that operation in this case).

C Declaration  | C++ Declaration & Source  ]


Vector_element_ptr_t as_array_detach ()

C++: Vector_element_ptr_t Vector_t::as_array_detach ()
C: Vector_element_ptr_t Vector_as_array_detach (Vector_t *)

Like Vector_as_array() followed by Vector_detach() with the difference that this also works when Vector_INLINE_STORE is active.

C Declaration  | C++ Declaration & Source  ]


Vector_t & ensure_heap_storage ()

C++: Vector_t & Vector_t::ensure_heap_storage ()
C: void Vector_ensure_heap_storage (Vector_t *)

Ensure that the contents are stored on the heap so that _detach does not destroy the vector. Used by Vector_as_array_detach(), but may also be used manually before as_array() or Vector_nth_ptr() to ensure that the pointer is on the heap.

This function actually does something only when Vector_INLINE_STORE is used or Vector_MINIMAL_SIZE is 0. Otherwise, this function does nothing. This includes not doing any harm.

Note

With both LOW_MEM and INLINE_STORE active, this functions may append ZERO elements to the vector, because resizing the table may mean to resize the vector.

Note

With Vector_MINIMAL_SIZE == 0, vectors of size 0 are still not resized to size 1. Functions returning pointers to the table (e.g. Vector_as_open_array) will return NULL in this special case, which is ususally no problem in handling. This function is for handling the more complex cases that occur with the Vector_INLINE_STORE option.

C Declaration  | C++ Declaration & Source  ]


bool has_heap_storage () const

C++: bool Vector_t::has_heap_storage () const
C: Global_ERWIN_BOOL Vector_has_heap_storage (Vector_t const *)

Returns whether the storage on the heap is allocated or not. This is interesting only when Vector_MINIMIAL_SIZE == 0 or Vector_INLINE_STORE is activated.

C Declaration  | C++ Declaration & Source  ]


static Vector_cnt_t inline_store_cnt ()

C++: int Vector_t::inline_store_cnt ()
C: int Vector_inline_store_cnt (void)

Returns the number of elements the inline store has. This is 0 unless Vector_INLINE_STORE is activated, in which case other values are possible. The result is a constant, therefore there is no argument to this function.

C Declaration  | C++ Declaration & Source  ]


Vector_element_ptr_t as_open_array_detach ()

C++: Vector_element_ptr_t Vector_t::as_open_array_detach ()
C: Vector_element_ptr_t Vector_as_open_array_detach (Vector_t *)

Like Vector_as_open_array() followed by Vector_detach() with the difference that this also works when Vector_INLINE_STORE is active.

C Declaration  | C++ Declaration & Source  ]


Vector_element_ptr_t operator+ (Vector_index_t i)

C++: Vector_element_ptr_t Vector_t::operator+ (int i)
Declaration & Source  ]


#if ERWIN_IGNORE_BROKEN_MS_COMPILER

oType const * operator+ (Vector_index_t i) const

C++: oType const * Vector_t::operator+ (int i) const
#endif
Declaration & Source  ]


Vector_element_ref_t operator* ()

C++: Vector_element_ref_t Vector_t::operator* ()
Declaration & Source  ]


#if ERWIN_IGNORE_BROKEN_MS_COMPILER

oTypeResult operator* () const

C++: oTypeResult Vector_t::operator* () const
#endif
Declaration & Source  ]


Vector_element_ptr_t operator+ () const

C++: Vector_element_ptr_t Vector_t::operator+ () const
Declaration & Source  ]


Vector_element_ptr_t operator+ (Vector_index_t i)

C++: Vector_element_ptr_t Vector_t::operator+ (int i)
Declaration & Source  ]


#if ERWIN_IGNORE_BROKEN_MS_COMPILER

oType const * operator+ (Vector_index_t i) const

C++: oType const * Vector_t::operator+ (int i) const
#endif
Declaration & Source  ]


Vector_element_ref_t operator* ()

C++: Vector_element_ref_t Vector_t::operator* ()
Declaration & Source  ]


#if ERWIN_IGNORE_BROKEN_MS_COMPILER

oTypeResult operator* () const

C++: oTypeResult Vector_t::operator* () const
#endif
Declaration & Source  ]


Vector_element_ptr_t operator+ () const

C++: Vector_element_ptr_t Vector_t::operator+ () const

No 0-termination with non-charactor types. That's consistent with using nth_ptr_check here instead of nth_ptr_char for the isChar case.

Declaration & Source  ]


Vector_t & make_heap (Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::make_heap (Vector_cmp_t f = Vector_CMP_T_NULL)
C: void Vector_make_heap (Vector_t * self, Vector_cmp_t cmp)

This makes a heap. The first element of the vector will then be the maximum (according to the given compare function). The others will have the Heap Property:

: \forall i \in { 0,..,nentries-1 }: : nth (floor ((i-1) / 2)) >= nth(i)

The operation takes O(n log n) time.

This is the heap property graphically:

    0      n[father(i)] >= n[i], whether father(i) = floor ((i-1) / 2)
  1   2
 3 4 5 6   // Note that the indeces in our vectors are just the
           // other way around to

As a special case, a vector that is sorted in reverse order is a heap.

The default cmp function, used if cmp is NULL, is Global_oType_PRIORITY_CMP.

Note

The implementation used here has no dedicated heap_size entry. The heap is always as large as the whole vector.

This function checks itself when in debug mode, causing assertion failures if the heap property is violated after operation.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t heap_left (Vector_index_t i) const

C++: int Vector_t::heap_left (int i) const
C: int Vector_heap_left (Vector_t const * self, int i)

Returns the index of the left child of i in a heap structure. The index i must be a valid index of the vector. Returns something < 0 if there is no such child of i. The left index is guaranteed to be < than the right index.

The operation takes O(1) time.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t heap_right (Vector_index_t i) const

C++: int Vector_t::heap_right (int i) const
C: int Vector_heap_right (Vector_t const * self, int i)

Returns the index of the left child of i in a heap structure. The index i must be a valid index of the vector. Returns something < 0 if there is no such child of i. The right index is guaranteed to be > than the left index.

The operation takes O(1) time.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t heap_father (Vector_index_t i) const

C++: int Vector_t::heap_father (int i) const
C: int Vector_heap_father (Vector_t const * self, int i)

Returns the index of the left child of i in a heap structure. The index i must be a valid index of the vector. Returns something < 0 if i does not have a father, i.e., if i == 0.

The operation takes O(1) time.

C Declaration  | C++ Declaration & Source  ]


oTypeVar heap_extract (Vector_cmp_t f = Vector_CMP_T_NULL)

C++: oTypeVar Vector_t::heap_extract (Vector_cmp_t f = Vector_CMP_T_NULL)
C: oTypeVar Vector_heap_extract (Vector_t * self, Vector_cmp_t cmp)

This extracts the maximum from the heap, returns it, shrinks the vector, and re-heapifies it. See Vector_make_heap() and Vector_heap_sink(). You may only invoke this for vectors that have the heap property and have at least one element.

The operation takes O(log n) time, since it reinvokes Vector_heap_sink.

The default cmp function, used if cmp is NULL, is Global_oType_PRIORITY_CMP.

This function checks the input and itself when in debug mode, causing assertion failures if the heap property is violated. Note that this check takes O(n) time, so the function is significantly slower during debugging. If you don't want this, you may

#define Vector_DEBUG_EXPENSIVE_CHECKS        0

or (for all vectors)

#define Global_VECTOR_DEBUG_EXPENSIVE_CHECKS 0

Note

this returns oTypeVar instead of oTypeResult (if these are different), because the element is removed, so no reference can be returned.

C Declaration  | C++ Declaration & Source  ]


Vector_t & heap_raise (Vector_index_t i, Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::heap_raise (int i, Vector_cmp_t f = Vector_CMP_T_NULL)
C: void Vector_heap_raise (Vector_t * self, int i, Vector_cmp_t cmp)

The operation checks for element i whether its priority has increased. it so, the heap property is re-established.

The operation takes O(log n) time.

The default cmp function, used if cmp is NULL, is Global_oType_PRIORITY_CMP.

This function checks itself when in debug mode, causing assertion failures if the heap property is violated after operation. Such an assertion failure may also mean that the vector was no heap (apart from the element i) before this operation. Note that this check takes O(n) time, so the function is significantly slower during debugging. If you don't want this, you may

#define Vector_DEBUG_EXPENSIVE_CHECKS        0

or (for all vectors)

#define Global_VECTOR_DEBUG_EXPENSIVE_CHECKS 0

C Declaration  | C++ Declaration & Source  ]


Vector_t & heap_sink (Vector_index_t i, Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::heap_sink (int i, Vector_cmp_t f = Vector_CMP_T_NULL)
C: void Vector_heap_sink (Vector_t * self, int i, Vector_cmp_t cmp)

The opposite of Vector_heap_raise: it checks whether the value of i has decresed and if so, re-establishes the heap property.

This operation is often called 'heapify'. Because it is related to heap_raise by being its opposite, we'll call it heap_sink here.

The operation takes O(log n) time.

The default cmp function, used if cmp is NULL, is Global_oType_PRIORITY_CMP.

See Vector_heap_raise() for more info.

Note that this function does not do debug checks of the heap property, because it may be used to construct a heap, so one of its purposes is to be invoked on heaps. We might add a check for a partial heap property later, though.

C Declaration  | C++ Declaration & Source  ]


Vector_t & heap_fix (Vector_index_t i, Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::heap_fix (int i, Vector_cmp_t f = Vector_CMP_T_NULL)
C: void Vector_heap_fix (Vector_t * self, int i, Vector_cmp_t cmp)

Fix the position of element at index i according to its new priority.

The operation takes O(log n) time.

The default cmp function, used if cmp is NULL, is Global_oType_PRIORITY_CMP.

This is an abbreviation for:

Vector_heap_raise (self, i, cmp);
Vector_heap_sink  (self, i, cmp);

C Declaration  | C++ Declaration & Source  ]


Vector_t & heap_insert (oTypeParam elem, Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::heap_insert (oTypeParam elem, Vector_cmp_t f = Vector_CMP_T_NULL)
C: int Vector_heap_insert (Vector_t * self, oTypeParam elem, Vector_cmp_t cmp)

This function inserts an element into a heap and re-establishes the heap property.

This operation is an abbreviation for:

Vector_append (self, elem);
Vector_heap_increase (self, Vector_nentries(s) - 1, cmp);

Thus the operation takes O(log n) time.

The default cmp function, used if cmp is NULL, is Global_oType_PRIORITY_CMP.

The success is returned.

This function checks the input (and itself indirectly via Vector_heap_raise) when in debug mode, causing assertion failures if the heap property is violated. Note that this check takes O(n) time, so the function is significantly slower during debugging. If you don't want this, you may

#define Vector_DEBUG_EXPENSIVE_CHECKS        0

or (for all vectors):

#define Global_VECTOR_DEBUG_EXPENSIVE_CHECKS 0

C Declaration  | C++ Declaration & Source  ]


Vector_t & heap_erase (Vector_index_t i, Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::heap_erase (int i, Vector_cmp_t f = Vector_CMP_T_NULL)
C: void Vector_heap_erase (Vector_t * self, int i, Vector_cmp_t cmp)

This function deletes an element from the heap and re-establishes the heap property.

This operation is an abbreviation for:

Vector_swap (self, i, Vector_nentries(s) - 1);
Vector_chop (self, 1);
Vector_heap_sink (self, i, cmp);

Thus the operation takes O(log n) time.

The default cmp function, used if cmp is NULL, is Global_oType_PRIORITY_CMP.

The success is returned.

This function checks the input (and itself indirectly via Vector_heap_raise) when in debug mode, causing assertion failures if the heap property is violated. Note that this check takes O(n) time, so the function is significantly slower during debugging. If you don't want this, you may

#define Vector_DEBUG_EXPENSIVE_CHECKS        0

or (for all vectors)

#define Global_VECTOR_DEBUG_EXPENSIVE_CHECKS 0

C Declaration  | C++ Declaration & Source  ]


Vector_t & heap_sort (Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::heap_sort (Vector_cmp_t f = Vector_CMP_T_NULL)
C: void Vector_heap_sort (Vector_t * self, Vector_cmp_t cmp)

Re-builds the heap structure for the given element. This is one of three sort functions available for vectors:

FunctionAlgorithmTypicalWorstSpaceStability
Vector_qsortQuicksortO(n log n)O(n)O(1)not stable
Vector_heap_sortHeapsortO(n log n)O(n log n)O(1)not stable
Vector_sortMergesortO(n log n)O(n log n)O(n)stable

The default cmp function, used if cmp is NULL, is Global_oType_PRIORITY_CMP.

Note

This uses a different comparison function by default. Just in case you defined it (or differently)...

FIXME: We should implement bubblesort as well, since it is very fast if only few elements have changed.

The operation takes O(n log n) time.

C Declaration  | C++ Declaration & Source  ]


Vector_t & qsort (Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::qsort (Vector_cmp_t f = Vector_CMP_T_NULL)
C: void Vector_qsort (Vector_t *, Vector_cmp_t order)

Uses the order function to sort the vector. The compare function may be NULL if Global_oType_CMP is defined. In this case that default compare function is used. See Vector_u.h for definition.

For a stable sort function, see Vector_sort.

For a guaranteed O(n log n) runtime and O(1) space, see Vector_heap_sort.

The default cmp function, used if cmp is NULL, is Global_oType_CMP.

This function the CLib function qsort(3). Note that qsort(3) need not use Quicksort internally, e.g. if the glibc under Linux finds that there is enough memory, it uses merge sort instead. So you have good chances that this function is stable in many cases under Linux. However, if you need stability, this function does not guarantee that. Especially, when running your programm under Windows, its qsort(3) implementation is not stable. That's perfectly ok. For stability, simply always use Vector_sort().

In sorted vectors, you can find entries in O(log n) vector using Vector_bfind or Vector_locate.

C Declaration  | C++ Declaration & Source  ]


Vector_t & sort (Vector_cmp_t f = Vector_CMP_T_NULL)

C++: Vector_t & Vector_t::sort (Vector_cmp_t f = Vector_CMP_T_NULL)
C: void Vector_sort (Vector_t *, Vector_cmp_t order)

Uses Global_erwin_merge_sort, which implements a stable sorting algorithm. Uses the order function. order may be NULL (see Vector_qsort and Vector_heap_sort) if Global_oType_CMP is defined, which will then be used.

The default cmp function, used if cmp is NULL, is Global_oType_CMP.

Uses Erwin's erwin_merge_sort function which is stable but needs O(n) space.

You can find entries in a sorted vector using Vector_bfind or Vector_locate.

C Declaration  | C++ Declaration & Source  ]


Vector_index_t bfind (oTypeParam a, Vector_cmp_t f = NULL) const

C++: int Vector_t::bfind (oTypeParam a, Vector_cmp_t f = NULL) const
C: int Vector_bfind (Vector_t const *, oTypeParam, Vector_cmp_t)

Needs a sorted vector. Then searches with binary search. Uses the cmp function. cmp may be NULL (see above) -1 means: not found.

Uses the system function bsearch().

This operation takes O(log n) time.

The default cmp function, used if cmp is NULL, is Global_oType_CMP.

This function checks the input when in debug mode, causing assertion failures if input is not sorted.the heap property is violated after operation. Note that this check takes O(n) time, so the function is significantly slower during debugging. If you don't want this, you may

#define Vector_DEBUG_EXPENSIVE_CHECKS 0 or #define Global_VECTOR_DEBUG_EXPENSIVE_CHECKS 0 (for all vectors)

References

Vector_qsort, Vector_sort, Vector_locate, Vector_find.

C Declaration  | C++ Declaration & Source  ]


Global_hashval_t hash_raw () const

C++: Global_hashval_t Vector_t::hash_raw () const
C: Global_hashval_t Vector_hash_raw (Vector_t const *)

Returns a hash value, which is derived from hash values for oType.

This is traditionally called hash_raw although the hash value is good enough for a normal HASH nowadays.

Note

Usually you want hash values if you work with maps. So you should define the hash value in such a way that both the map header as well as the vector header find them.

Further Note

This will only be implemented if Global_oType_HASH_RAW is defined.

C Declaration  | C++ Declaration & Source  ]


Global_hashval_t hash () const

C++: Global_hashval_t Vector_t::hash () const
C: Global_hashval_t Vector_hash (Vector_t const * x)
C Declaration & Source  | C++ Declaration & Source  ]


Vector_t & shrink (bool tight = true)

C++: Vector_t & Vector_t::shrink (bool tight = true)
C: void Vector_shrink (Vector_t * self, Global_ERWIN_BOOL tight)

Perform a table shrink operation if necessary. Mostly useful if Vector_NO_AUTO_SHRINK is set, otherwise, this function is automatically invoked whenever the vector shrinks.

If tight is not Global_ERWIN_FALSE, the vector is reallocated to the absolute minimum that is necessary to store the data. Otherwise, the standard algorithm of halving chunks is used.

Note that the function will never resize the vector smaller than Vector_MINIMAL_SIZE (actually, no function will do that).

If Vector_MINIMAL_SIZE == 0, and if you invoke this function on an empty vector, the vector will not use any allocated internal structure anymore until you insert anything.

When Vector_LOW_MEM is active, this functions has no operation, since the table size cannot be changed independently from the size.

Note that calling Vector_as_array() on a shrinked vector is not wise since the vector will have to resize for the padded zero element.

Note

This function is always successful. Even if realloc failed, the vector is still consistent. Therefore, no error code is returned. However, the error code is set up correctly.

Further Note

If you defined memory overflow errors to be fatal (by #define Global_ERWIN_NOMEM_IS_FATAL), they are also fatal in this function.

C Declaration  | C++ Declaration & Source  ]


Vector_t & clear ()

C++: Vector_t & Vector_t::clear ()
C: void Vector_clear (Vector_t * self)

Like Vector_erase for all elements.

C Declaration  | C++ Declaration & Source  ]


Vector_t & clear_keep (Vector_cnt_t n)

C++: Vector_t & Vector_t::clear_keep (int n)
C: void Vector_clear_keep (Vector_t * self, int table_min_size)

Like Vector_clear(), but the internal table is not shrunk below the given minimal size (instead of the predefined minimal table size)

C Declaration  | C++ Declaration & Source  ]


Vector_t & clear_no_resize ()

C++: Vector_t & Vector_t::clear_no_resize ()
C: void Vector_clear_no_resize (Vector_t * self)

Compatibility & convenience: Like Vector_clear(self) without resizing the table.

C Declaration  | C++ Declaration & Source  ]


static void delete_array (Vector_element_ptr_t array)

C++: void Vector_t::delete_array (Vector_element_ptr_t array)
C: void Vector_delete_array (Vector_element_ptr_t array)

If you extract the vector contents e.g. with Vector_as_array(), then detach a vector to free its contents later, use this function for freeing. If the memory management is left with its default settings, this is a simple free() (or delete[] if you compiled for C++ only). But to be sure to use the right deallocator in more complex cases, please prefer to use this function.

Note

With Vector_INLINE_STORE, you must only invoke Vector_delete_array on arrays obtained with Vector_as_array_detach() or Vector_as_open_array_detach(). You must not invoke it on arrays obtained with Vector_as_array() or Vector_as_open_array() because these functions may return a pointer to an inlined array, causing a SIGSEGV in Vector_delete_array().

C Declaration  | C++ Declaration & Source  ]


Vector_t & clear (bool a, bool b = true)

C++: Vector_t & Vector_t::clear (bool a, bool b = true)
C: void Vector_clear_flags (Vector_t * self, Global_ERWIN_BOOL resize, Global_ERWIN_BOOL delete_elems)

Like Vector_clear you can specify whether a realloc will be performed and whether the elements will be freed. The former is useful if you want to clear the vector but expect new data of around the same length to be inserted afterwards.

This function is only available of oType == oTypeVar.

C Declaration  | C++ Declaration & Source  ]


#if defined(Vector_INLINE__NENTRIES)

Vector_cnt_t nentries () const

C++: int Vector_t::nentries () const
#endif
Declaration & Source  ]


#if !defined(Vector_INLINE__NENTRIES)

Vector_cnt_t nentries () const

C++: int Vector_t::nentries () const
C: int Vector_nentries (Vector_t const * self)

Returns the number of entries in the vector.

Note

This is not called `Vector_size' in order to prevent confusion about the unit of the result. `size' might refer to bytes. `nentries', however, is clearer.

#endif
C Declaration  | C++ Declaration & Source  ]


bool empty () const

C++: bool Vector_t::empty () const
Declaration & Source  ]


bool non_empty () const

C++: bool Vector_t::non_empty () const
Declaration & Source  ]


Vector_cnt_t table_size () const

C++: int Vector_t::table_size () const
C: int Vector_table_size (Vector_t const * self)

For debugging and optimisation purposes (use rarely): the current size of of the internal pre-allocated array of elements.

C Declaration  | C++ Declaration & Source  ]


int cmp (Vector_t const * other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const

C++: int Vector_t::cmp (Vector_t const * other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const
C: int Vector_cmp (Vector_t const *, Vector_t const *, Vector_cmp_t cmp)

Returns a comparison value for lexical sort order, or by length order, depending on Vector_COMPARE_LEXICOGRAPHICALLY, which defaults to 1 for non-character types, and to 0 for all others. The difference is that the length order checks the length of the vector first, which is expected to yield a quicker distinction for most vectors.

This function is NULL safe. NULL is smaller than any other vector. By this you can easily sort a vector in reverse order and then rtrim_if(is_NULL) to get rid of NULL elements.

If cmp is NULL, Global_oType_CMP will be used. If that is not defined, an error will occur.

C Declaration  | C++ Declaration & Source  ]


int cmp (Vector_t const & other, Vector_cmp_t cmp_func = Vector_CMP_T_NULL) const

C++: int Vector_t::cmp (Vector_t const & other, Vector_cmp_t cmp_func = Vector_CMP_T_NULL) const
Declaration & Source  ]


int priority_cmp (Vector_t const * other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const

C++: int Vector_t::priority_cmp (Vector_t const * other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const
C: int Vector_priority_cmp (Vector_t const *, Vector_t const *, Vector_cmp_t cmp)

Similar to Vector_cmp, with two differences:

This function is NULL safe. NULL is smaller than any other vector.

If cmp is NULL, Global_oType_PRIORITY_CMP will be used. If that is not defined, an error will occur.

C Declaration  | C++ Declaration & Source  ]


int priority_cmp (Vector_t const & other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const

C++: int Vector_t::priority_cmp (Vector_t const & other, Vector_cmp_t fcmp = Vector_CMP_T_NULL) const
Declaration & Source  ]


bool operator== (Vector_t const & b) const

C++: bool Vector_t::operator== (Vector_t const & b) const

see cmp()

Declaration & Source  ]


bool operator== (Vector_t const * b) const

C++: bool Vector_t::operator== (Vector_t const * b) const

see cmp()

Declaration & Source  ]


bool operator!= (Vector_t const & b) const

C++: bool Vector_t::operator!= (Vector_t const & b) const

see cmp()

Declaration & Source  ]


bool operator!= (Vector_t const * b) const

C++: bool Vector_t::operator!= (Vector_t const * b) const

see cmp()

Declaration & Source  ]


bool operator<= (Vector_t const & b) const

C++: bool Vector_t::operator<= (Vector_t const & b) const

see cmp()

Declaration & Source  ]


bool operator<= (Vector_t const * b) const

C++: bool Vector_t::operator<= (Vector_t const * b) const

see cmp()

Declaration & Source  ]


bool operator>= (Vector_t const & b) const

C++: bool Vector_t::operator>= (Vector_t const & b) const

see cmp()

Declaration & Source  ]


bool operator>= (Vector_t const * b) const

C++: bool Vector_t::operator>= (Vector_t const * b) const

see cmp()

Declaration & Source  ]


bool operator< (Vector_t const & b) const

C++: bool Vector_t::operator< (Vector_t const & b) const

see cmp()

Declaration & Source  ]


bool operator< (Vector_t const * b) const

C++: bool Vector_t::operator< (Vector_t const * b) const

see cmp()

Declaration & Source  ]


bool operator> (Vector_t const & b) const

C++: bool Vector_t::operator> (Vector_t const & b) const

see cmp()

Declaration & Source  ]


bool operator> (Vector_t const * b) const

C++: bool Vector_t::operator> (Vector_t const * b) const

see cmp()

Declaration & Source  ]


Vector_t & swap (Vector_index_t a, Vector_index_t b)

C++: Vector_t & Vector_t::swap (int a, int b)
C: void Vector_swap (Vector_t * self, int index1, int index2)

Because using set or modify to implement swapping of two elements involves freeing and copying elements, this functions provides a way to swap elements without that overhead.

C Declaration  | C++ Declaration & Source  ]


bool locate (Vector_index_t & index, oTypeParam element, int how) const

C++: bool Vector_t::locate (int & index, oTypeParam element, int how) const
C: Global_ERWIN_BOOL Vector_locate (int * index, Vector_t const * self, oTypeParam needle, Vector_cmp_t order, int how)

Needs a sorted vector. Then searches with binary search. Uses the cmp function. cmp may be NULL (see above)

In contrast to Vector_bfind you are provided with a possible insertion position that will keep the vector's order.

The function returns Global_ERWIN_TRUE if the element was found and Global_ERWIN_FALSE if not.

This operation takes O(log n) time.

The default cmp function, used if cmp is NULL, is Global_oType_CMP.

This function checks the input when in debug mode, causing assertion failures if input is not sorted.the heap property is violated after operation. Chis check takes O(n) time, so the function is significantly slower during debugging. If you don't want this, you may

#define Vector_DEBUG_EXPENSIVE_CHECKS 0 or #define Global_VECTOR_DEBUG_EXPENSIVE_CHECKS 0 (for all vectors)

The how argument defines what value to return for the *index. The following table give an explanation of the value written into *index:

howif found (result == Global_ERWIN_TRUE)if not found (result == Global_ERWIN_FALSEusage
1the smallest index of equal elementsinsertion positionto find an element or to insert an element at the smallest possible position
0some index of an equal elementinsertion positionto find and insert without caring about order of equal elements
1the largest index of equal elementsinsertion position - 1to find an element or to insert an element at the largest possible position.

At first sight, for how==1 the value of index seems strange. But from the point of view of inserting even in case of equality, you can simply insert at (*index+1) to insert at the right most possible position keeping the vector's order without looking at the function's return value. However, in case of finding the element, *index always points to an equal element. Note that because of this, index may be -1 (for how=1 if you want to insert at the beginning).

Note

for how==0 and how==-1, the functions will set *index to Vector_nentries(self) if the searched element is larger than any in the vector, because that is the correct value for Vector_insert.

Summarized constraints that always hold:

for how==0 and how==-1*index always is the correct insertion position.
for how==1(*index + 1) always is the correct insert position.
if the return value is Global_ERWIN_TRUE*index points to an equal element.
References

Vector_qsort, Vector_sort, Vector_bfind.

C Declaration  | C++ Declaration & Source  ]


bool locate (Vector_index_t & index, oTypeParam element, Vector_cmp_t fcmp = Vector_CMP_T_NULL, int how = 0) const

C++: bool Vector_t::locate (int & index, oTypeParam element, Vector_cmp_t fcmp = Vector_CMP_T_NULL, int how = 0) const
C: Global_ERWIN_BOOL Vector_locate (int * index, Vector_t const * self, oTypeParam needle, Vector_cmp_t order, int how)

Needs a sorted vector. Then searches with binary search. Uses the cmp function. cmp may be NULL (see above)

In contrast to Vector_bfind you are provided with a possible insertion position that will keep the vector's order.

The function returns Global_ERWIN_TRUE if the element was found and Global_ERWIN_FALSE if not.

This operation takes O(log n) time.

The default cmp function, used if cmp is NULL, is Global_oType_CMP.

This function checks the input when in debug mode, causing assertion failures if input is not sorted.the heap property is violated after operation. Chis check takes O(n) time, so the function is significantly slower during debugging. If you don't want this, you may

#define Vector_DEBUG_EXPENSIVE_CHECKS 0 or #define Global_VECTOR_DEBUG_EXPENSIVE_CHECKS 0 (for all vectors)

The how argument defines what value to return for the *index. The following table give an explanation of the value written into *index:

howif found (result == Global_ERWIN_TRUE)if not found (result == Global_ERWIN_FALSEusage
1the smallest index of equal elementsinsertion positionto find an element or to insert an element at the smallest possible position
0some index of an equal elementinsertion positionto find and insert without caring about order of equal elements
1the largest index of equal elementsinsertion position - 1to find an element or to insert an element at the largest possible position.

At first sight, for how==1 the value of index seems strange. But from the point of view of inserting even in case of equality, you can simply insert at (*index+1) to insert at the right most possible position keeping the vector's order without looking at the function's return value. However, in case of finding the element, *index always points to an equal element. Note that because of this, index may be -1 (for how=1 if you want to insert at the beginning).

Note

for how==0 and how==-1, the functions will set *index to Vector_nentries(self) if the searched element is larger than any in the vector, because that is the correct value for Vector_insert.

Summarized constraints that always hold:

for how==0 and how==-1*index always is the correct insertion position.
for how==1(*index + 1) always is the correct insert position.
if the return value is Global_ERWIN_TRUE*index points to an equal element.
References

Vector_qsort, Vector_sort, Vector_bfind.

C Declaration  | C++ Declaration & Source  ]


Occurrences of Vector_t

Vector_t const *Global_erwin_ptr_const_of(Vector_t const * x)
Vector_t const *Global_erwin_ptr_const_of(Vector_t const & x)
Vector_t *Global_erwin_ptr_of(Vector_t * x)
Vector_t *Global_erwin_ptr_of(Vector_t & x)
intVector_append(Vector_t * self, oTypeTouched value)
intVector_append_basename(Vector_t * self, Vector_t const * path)
intVector_append_config_file_name(Vector_t * self, oType const * program_name, Global_ERWIN_BOOL local)
intVector_append_directory(Vector_t * self, Vector_t const * path)
intVector_append_no_copy(Vector_t * self, oTypeVar const * theelements, Vector_cnt_t number_of_elements_to_insert)
intVector_append_raw(Vector_t * self, oType const * elements, Vector_cnt_t count)
intVector_append_string(Vector_t * self, oType const * theelements)
intVector_append_vector(Vector_t * self, Vector_t const * other)
Vector_element_ptr_tVector_as_array(Vector_t const *)
Vector_element_ptr_tVector_as_array_detach(Vector_t *)
Vector_element_ptr_tVector_as_open_array(Vector_t const *)
Vector_element_ptr_tVector_as_open_array_detach(Vector_t *)
Vector_index_tVector_basename_index(Vector_t const * self)
voidVector_basename_range(Vector_index_t * first, Vector_cnt_t * length, Vector_t const * self)
Vector_index_tVector_bfind(Vector_t const *, oTypeParam, Vector_cmp_t)
voidVector_chomp(Vector_t * self)
intVector_chop(Vector_t * self, Vector_cnt_t count)
intVector_chop_flags(Vector_t * self, Vector_cnt_t count, Global_ERWIN_BOOL resize, Global_ERWIN_BOOL delete_elems)
intVector_chop_flags(Vector_t * self, Vector_cnt_t number_of_elements_to_erase_off, Global_ERWIN_BOOL resize)
voidVector_clear(Vector_t * self)
voidVector_clear_errno(Vector_t const * self)
voidVector_clear_flags(Vector_t * self, Global_ERWIN_BOOL resize, Global_ERWIN_BOOL delete_elems)
voidVector_clear_keep(Vector_t * self, Vector_cnt_t table_min_size)
voidVector_clear_no_resize(Vector_t * self)
intVector_cmp(Vector_t const *, Vector_t const *, Vector_cmp_t cmp)
Vector_t *Vector_copy(Vector_t const * self)
Vector_t *Vector_copy_err(Vector_t const * self, int * err)
voidVector_delete(Vector_t * self)
voidVector_destroy(Vector_t * self)
voidVector_detach(Vector_t * self)
voidVector_detach_as_is(Vector_t * self)
Global_ERWIN_BOOLVector_empty(Vector_t const * self)
Global_ERWIN_BOOLVector_empty(Vector_t const * self)
voidVector_ensure_heap_storage(Vector_t *)
intVector_ensure_size(Vector_t * self, Vector_cnt_t size)
intVector_ensure_size_with(Vector_t * self, Vector_cnt_t size, oTypeTouched elem)
intVector_ensure_table_size(Vector_t * self, Vector_cnt_t size)
intVector_erase(Vector_t * self, Vector_index_t index, Vector_cnt_t number_of_elements)
Vector_cnt_tVector_erase_equals(Vector_t * self, Vector_cmp_t cmp, Vector_combine_t combine)
intVector_erase_flags(Vector_t * self, Vector_index_t index, Vector_cnt_t number_of_elements_to_delete, Global_ERWIN_BOOL resize, Global_ERWIN_BOOL delete_elems)
intVector_erase_flags(Vector_t * self, Vector_index_t index, Vector_cnt_t number_of_elements_to_delete, Global_ERWIN_BOOL resize)
Vector_cnt_tVector_erase_if(Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)
Vector_cnt_tVector_erase_if_flags(Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value, Global_ERWIN_BOOL resize, Global_ERWIN_BOOL dealloc)
Vector_cnt_tVector_erase_if_flags(Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value, Global_ERWIN_BOOL resize)
Vector_cnt_tVector_erase_zero(Vector_t * self)
intVector_errno(Vector_t const *)
intVector_fgets(Vector_t * self, FILE * f, Vector_cnt_t max_count)
Vector_index_tVector_find(Vector_t const * self, Vector_index_t start, oTypeParam needle)
Vector_index_tVector_find_if(Vector_t const * self, Vector_index_t start, Vector_feature_t feature, Global_ERWIN_BOOL value)
Vector_element_ptr_tVector_find_ptr(Vector_t const * self, Vector_index_t start, oTypeParam needle)
Vector_index_tVector_find_raw(Vector_t const * self, Vector_index_t start, oType const * needle, Vector_cnt_t len)
oTypeResultVector_first(Vector_t const * self)
Vector_element_ptr_tVector_first_ptr(Vector_t * self)
oTypeVarVector_first_swap_chop1(Vector_t * self)
voidVector_format(Vector_t * self, Tchar const * format, ...)
intVector_fread(Vector_t * self, FILE * f, Vector_cnt_t max_count)
Vector_quotation_method_t const *Vector_get_quotation_method(Vector_t const * self, int which)
Global_ERWIN_BOOLVector_has_heap_storage(Vector_t const *)
Global_hashval_tVector_hash(Vector_t const *)
Global_hashval_tVector_hash(Vector_t const * x)
Global_hashval_tVector_hash_raw(Vector_t const *)
voidVector_heap_erase(Vector_t * self, Vector_index_t i, Vector_cmp_t cmp)
oTypeVarVector_heap_extract(Vector_t * self, Vector_cmp_t cmp)
Vector_index_tVector_heap_father(Vector_t const * self, Vector_index_t i)
voidVector_heap_fix(Vector_t * self, Vector_index_t i, Vector_cmp_t cmp)
intVector_heap_insert(Vector_t * self, oTypeParam elem, Vector_cmp_t cmp)
Vector_index_tVector_heap_left(Vector_t const * self, Vector_index_t i)
voidVector_heap_raise(Vector_t * self, Vector_index_t i, Vector_cmp_t cmp)
Vector_index_tVector_heap_right(Vector_t const * self, Vector_index_t i)
voidVector_heap_sink(Vector_t * self, Vector_index_t i, Vector_cmp_t cmp)
voidVector_heap_sort(Vector_t * self, Vector_cmp_t cmp)
intVector_init(Vector_t * self)
intVector_init_with_initial_size(Vector_t * self, Vector_cnt_t initial_size)
intVector_init_with_zero_and_initial_size(Vector_t * self, oTypeTouched zero, Vector_cnt_t initial_size)
intVector_insert(Vector_t * self, Vector_index_t index, oTypeTouched element)
intVector_insert_no_copy(Vector_t * self, Vector_index_t index, oTypeVar const * values, Vector_cnt_t count)
intVector_insert_raw(Vector_t * self, Vector_index_t index, oType const * values, Vector_cnt_t count)
intVector_insert_string(Vector_t * self, Vector_index_t start_index, oType const * values)
intVector_insert_subvector(Vector_t * self, Vector_index_t start_index_self, Vector_t const * other, Vector_index_t start_index_other, Vector_cnt_t size, Global_ERWIN_BOOL docopy)
intVector_insert_vector(Vector_t * self, Vector_index_t start_index, Vector_t const * initial)
Global_ERWIN_BOOLVector_is_equal_at(Vector_t const * self, Vector_index_t pos, oType const * other, Vector_cnt_t len)
oTypeResultVector_last(Vector_t const * self)
oTypeVarVector_last_chop1(Vector_t * self)
Vector_element_ptr_tVector_last_ptr(Vector_t * self)
Global_ERWIN_BOOLVector_locate(Vector_index_t * index, Vector_t const * self, oTypeParam needle, Vector_cmp_t order, int how)
voidVector_ltrim(Vector_t * self)
voidVector_ltrim_if(Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)
intVector_make_gap(Vector_t * self, Vector_index_t start_index, Vector_cnt_t count)
intVector_make_gap_with(Vector_t * self, Vector_index_t start_index, oTypeTouched elem, Vector_cnt_t count)
voidVector_make_heap(Vector_t * self, Vector_cmp_t cmp)
voidVector_map(Vector_t * self, Vector_map_t map)
oTypeVarVector_modify(Vector_t * self, Vector_index_t index, oTypeTouched newvalue)
Vector_cnt_tVector_nentries(Vector_t const * self)
Vector_cnt_tVector_nentries(Vector_t const * self)
Vector_t *Vector_new()
Vector_t *Vector_new_from_raw(oTypeVar * contents, Vector_cnt_t nentries, Vector_cnt_t allocsize)
Vector_t *Vector_new_from_raw_with_zero(oTypeVar * contents, Vector_cnt_t nentries, Vector_cnt_t allocsize, oTypeTouched zero)
Vector_t *Vector_new_from_vector(Vector_t * other)
Vector_t *Vector_new_with_initial_size(Vector_cnt_t initial_size)
Vector_t *Vector_new_with_zero(oTypeTouched zero)
Vector_t *Vector_new_with_zero_and_initial_size(oTypeTouched zero, Vector_cnt_t initial_size)
oTypeResultVector_nth(Vector_t const * self, Vector_index_t index)
oTypeResultVector_nth(Vector_t const * self, Vector_index_t idx)
oTypeResultVector_nth_char(Vector_t const * self, Vector_index_t index)
Vector_element_ptr_tVector_nth_ptr(Vector_t * self, Vector_index_t index)
Vector_element_ptr_tVector_nth_ptr_char(Vector_t * self, Vector_index_t index)
oType const *Vector_nth_ptr_char_const(Vector_t const * self, Vector_index_t idx)
oType const *Vector_nth_ptr_char_const(Vector_t const * self, Vector_index_t idx)
Vector_element_ptr_tVector_nth_ptr_check(Vector_t * self, Vector_index_t index)
oType const *Vector_nth_ptr_check_const(Vector_t const * self, Vector_index_t idx)
oType const *Vector_nth_ptr_check_const(Vector_t const * self, Vector_index_t idx)
oType const *Vector_nth_ptr_const(Vector_t const * self, Vector_index_t idx)
oType const *Vector_nth_ptr_const(Vector_t const * self, Vector_index_t idx)
voidVector_oformat(Vector_t * self, unsigned long int options, Tchar const * format, ...)
intVector_overwrite(Vector_t * self, Vector_index_t start_index_in_self, Vector_t const * newdata, Vector_index_t start_index_in_initial, Vector_cnt_t max_count)
intVector_overwrite_flags(Vector_t * self, Vector_index_t start_index, oType const * values, Vector_cnt_t count, Global_ERWIN_BOOL copy_elements, Global_ERWIN_BOOL delete_overwritten_elements)
intVector_overwrite_raw(Vector_t * self, Vector_index_t start_index_in_self, oType const * newdata, Vector_cnt_t count)
intVector_overwrite_string(Vector_t * self, Vector_index_t start_index_in_self, oType const * newdata)
intVector_overwrite_vector(Vector_t * self, Vector_index_t start_index_in_self, Vector_t const * newdata)
voidVector_ovformat(Vector_t * self, unsigned long int options, Tchar const * format, va_list arguments)
Vector_index_tVector_pos(Vector_t *)
Vector_index_tVector_pos(Vector_t * x)
Vector_index_t *Vector_pos_ptr(Vector_t *)
Vector_index_t *Vector_pos_ptr(Vector_t * x)
intVector_priority_cmp(Vector_t const *, Vector_t const *, Vector_cmp_t cmp)
voidVector_qsort(Vector_t *, Vector_cmp_t order)
voidVector_reverse(Vector_t * self)
Vector_index_tVector_rfind(Vector_t const * self, Vector_index_t start, oTypeParam needle)
Vector_index_tVector_rfind_if(Vector_t const * self, Vector_index_t start, Vector_feature_t feature, Global_ERWIN_BOOL value)
Vector_element_ptr_tVector_rfind_ptr(Vector_t const * self, Vector_index_t start, oTypeParam needle)
Vector_index_tVector_rfind_raw(Vector_t const * self, Vector_index_t start, oType const * needle, Vector_cnt_t len)
voidVector_roformat(Vector_format_info_t * info, Vector_t * self, unsigned long int options, Tchar const * format, ... arguments)
voidVector_rovformat(Vector_format_info_t * info, Vector_t * self, unsigned long int options, Tchar const * format, va_list arguments)
voidVector_rtrim(Vector_t * self)
voidVector_rtrim_if(Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)
intVector_set(Vector_t * self, Vector_index_t index, oTypeTouched newvalue)
voidVector_set_pos(Vector_t *, Vector_index_t)
voidVector_set_pos(Vector_t * x, Vector_index_t y)
voidVector_set_quotation_method(Vector_t const * self, int which, Vector_quotation_method_t const *)
intVector_set_size(Vector_t * self, Vector_cnt_t size)
intVector_set_size_no_resize(Vector_t * self, Vector_cnt_t size)
intVector_set_size_raw(Vector_t * self, Vector_cnt_t size)
intVector_set_size_with(Vector_t * self, Vector_cnt_t size, oTypeTouched elem)
voidVector_shrink(Vector_t * self, Global_ERWIN_BOOL tight)
voidVector_sort(Vector_t *, Vector_cmp_t order)
Vector_cnt_tVector_string_length(Vector_t const * self, oType const * string)
Vector_t *Vector_subvector(Vector_t const * self, Vector_index_t start_index, Vector_cnt_t size, Global_ERWIN_BOOL docopy)
voidVector_swap(Vector_t * self, Vector_index_t index1, Vector_index_t index2)
intVector_swap_erase(Vector_t * self, Vector_index_t index, Vector_cnt_t number_of_elements)
intVector_swap_erase_flags(Vector_t * self, Vector_index_t index, Vector_cnt_t number_of_elements_to_delete, Global_ERWIN_BOOL resize, Global_ERWIN_BOOL delete_elems)
intVector_swap_erase_flags(Vector_t * self, Vector_index_t index, Vector_cnt_t number_of_elements_to_delete, Global_ERWIN_BOOL resize)
Vector_cnt_tVector_table_size(Vector_t const * self)
voidVector_to_lower(Vector_t * self)
voidVector_to_upper(Vector_t * self)
voidVector_trim(Vector_t * self)
voidVector_trim_if(Vector_t * self, Vector_feature_t feature, Global_ERWIN_BOOL value)
voidVector_vformat(Vector_t * self, Tchar const * format, va_list)
voidVector_xchg(Vector_t * self, Vector_t * other)
oTypeResultVector_zero(Vector_t const * self)
Vector_t const &Vector_t::static_zero()
Vector_tVector_t::stringify(ERWIN_UNSIGNED_LONG_LONG a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(ERWIN_LONG_LONG a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(unsigned long a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(long a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(unsigned a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(int a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(unsigned short a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(short a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(unsigned char a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(signed char a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(double a, int base, int options, int width, int prec = -1)
Vector_tVector_t::stringify(char a, int options, int width)
Vector_tVector_t::stringify(char const * a, int options, int width, int prec = -1)
Vector_tVector_t::stringify(wchar_t const * a, int options, int width, int prec = -1)
Vector_tVector_t::stringify(Vector_t const * a, int options, int width, int prec = -1)
Vector_tVector_t::stringify(Vector_t const & a, int options, int width, int prec = -1)
Vector_tVector_t::stringify(bool a, int options, int width, int prec = -1)
Vector_t::Vector()
Vector_t::Vector(Vector_cnt_t initial_size)
Vector_t::Vector(oTypeTouched)
Vector_t::Vector(oTypeTouched, Vector_cnt_t)
Vector_t::Vector(Vector_t const *, bool do_copy = true)
Vector_t::Vector(Vector_t const *, Vector_index_t, Vector_cnt_t, bool do_copy = true)
Vector_t::Vector(oTypeVar const *, bool do_copy = true)
Vector_t::Vector