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 void addValue(int32_t value)
GLuint GLuint GLsizei count
void freeItemsOnDestroy(void)
uint32_t m_count
The number of items currently in the list.
void clear(void)
Clears the list without explicitly deleting anything.
void append(const T &item)
Adds an item to the end of the list.
int32_t(* cmpFunc)(const T &, const T &)
A comparison function type, should return -1, 0 or 1 for <, == and >
void setIncremental(const uint32_t start, const uint32_t end, const int32_t step)
void appendDeepCopy(const List< T > &source)
Adds the contents of the source list to the end of the 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 twinSortAscending(List< T2 > &twin)
Sorts the first list in an ascending order, using the T::< operator, the second list will be updated ...
int32_t readFromString(const char *str)
uint32_t find(const TB &item) const
Finds an item in an unsorted list (walk over all items) using the T::== operator. ...
IntList()
Standard constructor, creates an empty list with some room for items.
void deleteAndRemoveTail(const uint32_t count) XSENS_LIST_THROW
void appendShallowCopy(const List< T > &source)
Adds the contents of the source list to the end of the list.
void appendRelated(const TR &item)
Adds a related item to the end of the list, using the T = TR operator.
bool operator==(const IntList &lst)
void freeAndRemoveTail(const uint32_t count) XSENS_LIST_THROW
void deleteAndClear(void)
Calls delete for all items in the list and then clears 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...
void reverse(void)
Reverse the order of the list, useful for sorted lists that are read/created in the reverse order...
void appendCopy(const TB &item)
Adds a copy of a referenced item to the end of the list.
int32_t serialize(char *buffer) const
uint32_t findSorted(const TB &item) const
Finds an item in a sorted list (binary search) using the T::== and T::< operators.
T * m_data
The array containing the items.
void resize(uint32_t newSize)
Resizes the list to at least the given size.
IntList(const IntList &src)
Construct a list as a direct copy of another list.
uint32_t insertSortedCopy(const TB &item)
Assumes the list is sorted and inserts a copy of the referenced item at the appropriate spot...
void operator=(const IntList &list)
intentionally NOT implemented due to ambiguous nature
void appendList(uint32_t count, const T *lst)
Adds a number of items to the end of the list.
void deleteAndRemove(const uint32_t index) XSENS_LIST_THROW
Removes an item at the given index in the list.
List()
Standard constructor, creates an empty list with some room for items.
void freeAndRemove(const uint32_t index) XSENS_LIST_THROW
Removes an item at the given index in the list.
T & last(void) const XSENS_LIST_THROW
Retrieves the last item.
void swap(const uint32_t i, const uint32_t j) XSENS_LIST_THROW
Swaps two items in the list.
IntList(const uint32_t size)
Construct a list with a capacity of at least the given size.
void removeTail(const uint32_t count) XSENS_LIST_THROW
Removes items from the end of the list.
Class function calling janitor class.
void insert(const T &item, const uint32_t index)
Inserts an item at the given index, shifting any items below it down one spot.
uint32_t insertSortedDeref(const T &item)
Assumes the list is sorted by dereferenced values and inserts the item at the appropriate spot...
JanitorClassFunc< List< T > > * m_jcf
Used to clean up the list on exit.
uint32_t insertSorted(const T &item)
Assumes the list is sorted and inserts the item at the appropriate spot.
void isShallowCopyOf(const List< T > &source)
Overwrites the current list with a shallow (memcopy) copy of another list.
void isDeepCopyOf(const List< T > &source)
Make a copy of the list, duplicating list items i with: copy[i] = new TB(*source[i]) ...
void operator=(const List &list)
intentionally NOT implemented due to ambiguous nature
void sortAscending(void)
Sorts the list in an ascending order, using the T::< operator.
int32_t writeToString(char *buffer) const
void qSort(uint32_t left, uint32_t right)
Sorts the list in an ascending order, using the T::< operator.
uint32_t removeDuplicateEntriesDeref(void)
Removes any duplicate entries and returns the number of items removed.
void qSortDeref(uint32_t left, uint32_t right)
Sorts the list in an ascending order, using the T::< operator on dereferenced list items...
const T * getBuffer(void) const
Returns the start of the linear data buffer.
int32_t deserialize(const char *str)
uint32_t length(void) const
Returns the number of items currently in the list.
uint32_t m_max
The current size of the data array.
uint32_t removeDuplicateEntries(void)
Removes any duplicate entries and returns the number of items removed.
GLsizei GLsizei GLchar * source
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...
The namespace of all Xsens software since 2006.
void freeAndClear(void)
Calls free for all items in the list and then clears the list.
GLsizei const GLfloat * value
IntList(const uint32_t size, uint32_t *src)
Construct a list as a reference to a raw list.
int32_t writeToStringHex(char *buffer) const
int32_t(__cdecl * InequalityFunction)(const T &, const T &)
Type for an equality compare function, should return true when NOT equal.
unsigned __int32 uint32_t
T & operator[](const uint32_t index) const XSENS_LIST_THROW
Retrieves the item at the given index.
void sortAscendingDeref(void)
Sorts the list in an ascending order, using the T::< operator on dereferenced list items...
void deleteItemsOnDestroy(void)
~List()
Destroy the list. This does NOT automatically delete items IN the list.