Go to the documentation of this file.
10 #ifndef _XSENS_LIST_H_2006_06_08
11 #define _XSENS_LIST_H_2006_06_08
15 #ifndef _JANITORS_H_2006_05_01
20 #ifndef _XSENS_LIST_WITH_MATH
21 #define _XSENS_LIST_WITH_MATH
23 #ifndef _XSENS_LIST_IO
24 #define _XSENS_LIST_IO
29 #define _XSENS_LIST_RANGE_CHECKS
32 #ifdef _XSENS_LIST_WITH_MATH
34 #ifndef _XSENS_MATH_H_2006_05_31
35 #include "xsens_math.h"
39 #define XSENS_LIST_NOTFOUND 0xFFFFFFFF
41 #ifdef _XSENS_LIST_RANGE_CHECKS
44 #define XSENS_LIST_THROW
46 #define XSENS_LIST_THROW
113 void append(
const T& item);
121 template <
typename TB>
124 template <
typename TR>
147 template <
typename TB>
156 template <
typename TB>
167 template <
typename T2>
171 template <
typename TB>
175 template <
typename TB>
179 template <
typename TB>
183 template <
typename TB>
211 template <
typename TB>
219 #ifdef _XSENS_LIST_IO
220 #ifdef _XSENS_LIST_WITH_MATH
223 void saveAsMatlab(
const char* filename,
const char* varname)
const;
260 #endif // _XSENS_LIST_H_2006_06_08
int32_t(__cdecl * InequalityFunction)(const T &, const T &)
Type for an equality compare function, should return true when NOT equal.
void freeAndClear(void)
Calls free for all items in the list and then clears the list.
uint32_t insertSorted(const T &item)
Assumes the list is sorted and inserts the item at the appropriate spot.
void sortAscending(void)
Sorts the list in an ascending order, using the T::< operator.
uint32_t insertSortedDeref(const T &item)
Assumes the list is sorted by dereferenced values and inserts the item at the appropriate spot.
void deleteItemsOnDestroy(void)
~List()
Destroy the list. This does NOT automatically delete items IN the list.
void swap(const uint32_t i, const uint32_t j) XSENS_LIST_THROW
Swaps two items in the list.
T * m_data
The array containing the items.
IntList(const uint32_t size, uint32_t *src)
Construct a list as a reference to a raw list.
IntList(const uint32_t size)
Construct a list with a capacity of at least the given size.
T & get(const uint32_t index) const XSENS_LIST_THROW
Retrieves the item at the given index.
void append(const T &item)
Adds an item to the end of the list.
uint32_t findSortedDeref(const TB &item) const
Finds an item in a sorted list (binary search) using the T::== and T::< operators on dereferenced lis...
int32_t writeToStringHex(char *buffer) const
void deleteAndRemove(const uint32_t index) XSENS_LIST_THROW
Removes an item at the given index in the list.
uint32_t findSorted(const TB &item) const
Finds an item in a sorted list (binary search) using the T::== and T::< operators.
int32_t readFromString(const char *str)
void freeAndRemove(const uint32_t index) XSENS_LIST_THROW
Removes an item at the given index in the list.
void addValue(int32_t value)
void deleteAndRemoveTail(const uint32_t count) XSENS_LIST_THROW
JanitorClassFunc< List< T > > * m_jcf
Used to clean up the list on exit.
void insert(const T &item, const uint32_t index)
Inserts an item at the given index, shifting any items below it down one spot.
int32_t writeToString(char *buffer) const
void appendCopy(const TB &item)
Adds a copy of a referenced item to the end of the list.
void appendList(uint32_t count, const T *lst)
Adds a number of items to the end of the list.
void qSort(uint32_t left, uint32_t right)
Sorts the list in an ascending order, using the T::< operator.
Class function calling janitor class.
int32_t(* cmpFunc)(const T &, const T &)
A comparison function type, should return -1, 0 or 1 for <, == and >
GLsizei GLsizei GLchar * source
int32_t serialize(char *buffer) const
void qSortDeref(uint32_t left, uint32_t right)
Sorts the list in an ascending order, using the T::< operator on dereferenced list items.
void appendShallowCopy(const List< T > &source)
Adds the contents of the source list to the end of the list.
void freeAndRemoveTail(const uint32_t count) XSENS_LIST_THROW
GLuint GLuint GLsizei count
void appendDeepCopy(const List< T > &source)
Adds the contents of the source list to the end of the list.
void operator=(const IntList &list)
intentionally NOT implemented due to ambiguous nature
List()
Standard constructor, creates an empty list with some room for items.
void freeItemsOnDestroy(void)
void resize(uint32_t newSize)
Resizes the list to at least the given size.
void isDeepCopyOf(const List< T > &source)
Make a copy of the list, duplicating list items i with: copy[i] = new TB(*source[i])
bool operator==(const IntList &lst)
void twinSortAscending(List< T2 > &twin)
Sorts the first list in an ascending order, using the T::< operator, the second list will be updated ...
IntList()
Standard constructor, creates an empty list with some room for items.
uint32_t removeDuplicateEntries(void)
Removes any duplicate entries and returns the number of items removed.
int32_t deserialize(const char *str)
uint32_t insertSortedCopy(const TB &item)
Assumes the list is sorted and inserts a copy of the referenced item at the appropriate spot.
void remove(const uint32_t index) XSENS_LIST_THROW
Removes an item at the given index in the list.
uint32_t m_max
The current size of the data array.
void operator=(const List &list)
intentionally NOT implemented due to ambiguous nature
void appendRelated(const TR &item)
Adds a related item to the end of the list, using the T = TR operator.
uint32_t removeDuplicateEntriesDeref(void)
Removes any duplicate entries and returns the number of items removed.
void reverse(void)
Reverse the order of the list, useful for sorted lists that are read/created in the reverse order.
void sortAscendingDeref(void)
Sorts the list in an ascending order, using the T::< operator on dereferenced list items.
void removeTail(const uint32_t count) XSENS_LIST_THROW
Removes items from the end of the list.
uint32_t findDeref(const TB &item) const
Finds an item in an unsorted list (walk over all items) using the T::== operator on dereferenced list...
T & operator[](const uint32_t index) const XSENS_LIST_THROW
Retrieves the item at the given index.
void setIncremental(const uint32_t start, const uint32_t end, const int32_t step)
GLsizei const GLfloat * value
void deleteAndClear(void)
Calls delete for all items in the list and then clears the list.
IntList(const IntList &src)
Construct a list as a direct copy of another list.
const T * getBuffer(void) const
Returns the start of the linear data buffer.
T & last(void) const XSENS_LIST_THROW
Retrieves the last item.
void isShallowCopyOf(const List< T > &source)
Overwrites the current list with a shallow (memcopy) copy of another list.
void insertCopy(const TB &item, const uint32_t index)
Inserts a copy of the referenced item at the given index, shifting any items below it down one spot.
void clear(void)
Clears the list without explicitly deleting anything.
uint32_t length(void) const
Returns the number of items currently in the list.
The namespace of all Xsens software since 2006.
unsigned __int32 uint32_t
uint32_t m_count
The number of items currently in the list.
uint32_t find(const TB &item) const
Finds an item in an unsorted list (walk over all items) using the T::== operator.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |