 |
DATAKIT SDK
V2026.1
|
|
This is a high level array class.
More...
template<typename T>
class Dtk_tab< T >
This is a high level array class.
This class lets you use optimized arrays.
◆ const_iterator
◆ const_pointer
◆ iterator
◆ pointer
◆ value_type
◆ Dtk_tab() [1/4]
◆ Dtk_tab() [2/4]
◆ ~Dtk_tab()
◆ Dtk_tab() [3/4]
◆ Dtk_tab() [4/4]
Move constructor.
- Parameters
-
298 : v(t.v), nb(t.nb), rsv(t.rsv)
◆ at() [1/2]
◆ at() [2/2]
◆ back() [1/2]
Return the elements at the end of the array.
Sample:
◆ back() [2/2]
template<typename T >
| const T& Dtk_tab< T >::back |
( |
| ) |
const |
Return the elements at the end of the array.
Sample:
◆ begin() [1/2]
◆ begin() [2/2]
◆ capacity()
Returns the size of the storage space currently allocated for the array, expressed in terms of elements.
This capacity is not necessarily equal to the size. It can be equal or greater. The capacity of the Dtk_tab can be explicitly altered by calling member Dtk_tab::reserve.
Sample:
◆ cbegin()
◆ cend()
◆ clear()
template<typename T >
| void Dtk_tab< T >::clear |
( |
int |
no_delete = 0 | ) |
|
Resets the Dtk_tab content.
Sample:
Now tab has 3 elements...
◆ data() [1/2]
◆ data() [2/2]
template<typename T >
| T const* Dtk_tab< T >::data |
( |
| ) |
const |
◆ end() [1/2]
◆ end() [2/2]
◆ find() [1/2]
template<typename T >
| int Dtk_tab< T >::find |
( |
const T & |
e | ) |
const |
◆ find() [2/2]
template<typename T >
template<typename comp >
| int Dtk_tab< T >::find |
( |
const T & |
e, |
|
|
const comp & |
C |
|
) |
| const |
757 if (!C(v[i],e) && !C(e,v[i]))
◆ front() [1/2]
Return the elements at the beginning of the array.
Sample:
◆ front() [2/2]
template<typename T >
| const T& Dtk_tab< T >::front |
( |
| ) |
const |
Return the elements at the beginning of the array.
Sample:
◆ GetArray()
template<typename T >
| const T* Dtk_tab< T >::GetArray |
( |
| ) |
const |
Returns array of T elements.
◆ GetSize()
877 return 2*
sizeof(
Dtk_Size_t) +
sizeof(T*) + rsv *
sizeof(T);
◆ max_element()
template<typename T >
| T Dtk_tab< T >::max_element |
( |
| ) |
const |
◆ max_ithelement()
◆ min_element()
template<typename T >
| T Dtk_tab< T >::min_element |
( |
| ) |
const |
◆ min_ithelement()
◆ operator+=() [1/2]
770 delete [] _dtk_doublerealloc(rsv);
◆ operator+=() [2/2]
785 delete[] _dtk_doublerealloc( rsv );
787 v[ i + nb ] = std::move( t.v[ i ] );
◆ operator<()
331 for(i=0;i<
size();i++)
◆ operator=() [1/2]
279 if (t.v!=NULL && nb > 0)
◆ operator=() [2/2]
Move assignment operator.
- Parameters
-
◆ operator==()
290 if (t<*
this || *
this<t)
◆ operator[]() [1/2]
Accesses the ith element - like a classic array -.
- Parameters
-
| [in] | k | : The element position. |
- Warning
- There isn't any check for the element position validity !!!
Sample:
int elt = tab[2];
tab[1] = 5;
tab[5] = 5;
◆ operator[]() [2/2]
◆ pop_back()
Removes the last element.
Sample:
◆ push_back() [1/2]
template<typename T >
| void Dtk_tab< T >::push_back |
( |
const T & |
x | ) |
|
Inserts an element at the end of the array.
- Parameters
-
| [in] | x | The element to insert. |
Sample:
431 T* ex = _dtk_doublerealloc(rsv);
◆ push_back() [2/2]
template<typename T >
| void Dtk_tab< T >::push_back |
( |
T && |
x | ) |
|
Inserts an element by moving it at the end of the array.
- Parameters
-
| [in] | x | The element to insert. |
Sample:
461 v[nb++]=std::move(x);
466 T* ex = _dtk_doublerealloc(rsv);
467 v[nb++]= std::move(x);
472 v[nb++]=std::move(x);
◆ reduce()
886 delete [] _dtk_doublerealloc(rsv);
◆ remove()
template<typename T >
| void Dtk_tab< T >::remove |
( |
const T & |
a | ) |
|
Removes the first element with the value a.
- Parameters
-
| [in] | a | The value of the element that should be removed |
Sample:
◆ reserve()
813 delete [] _dtk_doublerealloc(rsv);
◆ resize() [1/2]
650 delete [] _dtk_doublerealloc(n);
◆ resize() [2/2]
Resizes the array.
- Parameters
-
| [in] | n | The new size. |
| [in] | t | The filling element. |
Sample:
622 delete [] _dtk_doublerealloc(n);
◆ reverse()
◆ size()
Returns the size of the array.
Sample:
◆ sort() [1/2]
◆ sort() [2/2]
template<typename T >
template<typename comp >
| void Dtk_tab< T >::sort |
( |
const comp & |
C | ) |
|
Sorts the array with custom sorting.
- Parameters
-
Sample:
741 _mergesort(tmp,(
int)0,(
int)(nb-1),C);
◆ subtab()
◆ swap()
Swap two elements.
Sample:
670 if ( inA >= nb || inB >= nb )
673 const T Tmp = v[ inA ];
Functor comparison object.
Definition: util_stl_dtk.hpp:26
Dtk_Size_t capacity() const
Returns the size of the storage space currently allocated for the array, expressed in terms of elemen...
Definition: util_stl_dtk.hpp:523
void pop_back()
Removes the last element.
Definition: util_stl_dtk.hpp:486
size_t Dtk_Size_t
Definition: define.h:715
void sort()
Sorts the array.
Definition: util_stl_dtk.hpp:715
Functor comparison object.
Definition: util_stl_dtk.hpp:40
T & back()
Return the elements at the end of the array.
Definition: util_stl_dtk.hpp:538
void remove(const T &a)
Removes the first element with the value a.
Definition: util_stl_dtk.hpp:692
T & operator[](Dtk_Size_t k)
Accesses the ith element - like a classic array -.
Definition: util_stl_dtk.hpp:381
int find(const T &e) const
Definition: util_stl_dtk.hpp:746
#define Pdtk_Assert(X)
Definition: define.h:746
T & front()
Return the elements at the beginning of the array.
Definition: util_stl_dtk.hpp:568
void resize(Dtk_Size_t n, const T &t)
Resizes the array.
Definition: util_stl_dtk.hpp:604
void reserve(Dtk_Size_t n)
Definition: util_stl_dtk.hpp:801
void Dtk_ThrowOverflowException()
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
void swap(const Dtk_Size_t inA, const Dtk_Size_t inB)
Swap two elements.
Definition: util_stl_dtk.hpp:667
void Dtk_swap(T &a, T &b)
Swap any type of data.
Definition: util_stl_dtk.hpp:70
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
void clear(int no_delete=0)
Resets the Dtk_tab content.
Definition: util_stl_dtk.hpp:352