Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Public Types | Public Member Functions | Protected Attributes | Private Member Functions
xsens::IntList Class Reference

Detailed Description

Definition at line 228 of file xsens_list.h.

#include <xSens_MT3/xsens_list.h>

Inheritance diagram for xsens::IntList:
Inheritance graph

Public Types

typedef int32_t(* cmpFunc) (const uint32_t &, const uint32_t &)
 A comparison function type, should return -1, 0 or 1 for <, == and > More...
 
typedef int32_t(__cdecl * InequalityFunction) (const uint32_t &, const uint32_t &)
 Type for an equality compare function, should return true when NOT equal. More...
 

Public Member Functions

 IntList ()
 Standard constructor, creates an empty list with some room for items. More...
 
 IntList (const uint32_t size)
 Construct a list with a capacity of at least the given size. More...
 
 IntList (const IntList &src)
 Construct a list as a direct copy of another list. More...
 
 IntList (const uint32_t size, uint32_t *src)
 Construct a list as a reference to a raw list. More...
 
bool operator== (const IntList &lst)
 
void addValue (int32_t value)
 
int32_t deserialize (const char *str)
 
int32_t readFromString (const char *str)
 
int32_t serialize (char *buffer) const
 
void setIncremental (const uint32_t start, const uint32_t end, const int32_t step)
 
int32_t writeToString (char *buffer) const
 
int32_t writeToStringHex (char *buffer) const
 
void deleteAndClear (void)
 Calls delete for all items in the list and then clears the list. More...
 
void freeAndClear (void)
 Calls free for all items in the list and then clears the list. More...
 
void clear (void)
 Clears the list without explicitly deleting anything. More...
 
void resize (uint32_t newSize)
 Resizes the list to at least the given size. More...
 
void append (const uint32_t &item)
 Adds an item to the end of the list. More...
 
void appendList (uint32_t count, const uint32_t *lst)
 Adds a number of items to the end of the list. More...
 
void appendDeepCopy (const List< uint32_t > &source)
 Adds the contents of the source list to the end of the list. More...
 
void appendShallowCopy (const List< uint32_t > &source)
 Adds the contents of the source list to the end of the list. More...
 
void appendCopy (const TB &item)
 Adds a copy of a referenced item to the end of the list. More...
 
void appendRelated (const TR &item)
 Adds a related item to the end of the list, using the T = TR operator. More...
 
void remove (const uint32_t index) XSENS_LIST_THROW
 Removes an item at the given index in the list. More...
 
void swap (const uint32_t i, const uint32_t j) XSENS_LIST_THROW
 Swaps two items in the list. More...
 
void deleteAndRemove (const uint32_t index) XSENS_LIST_THROW
 Removes an item at the given index in the list. More...
 
void freeAndRemove (const uint32_t index) XSENS_LIST_THROW
 Removes an item at the given index in the list. More...
 
uint32_tlast (void) const XSENS_LIST_THROW
 Retrieves the last item. More...
 
uint32_tget (const uint32_t index) const XSENS_LIST_THROW
 Retrieves the item at the given index. More...
 
uint32_toperator[] (const uint32_t index) const XSENS_LIST_THROW
 Retrieves the item at the given index. More...
 
void insert (const uint32_t &item, const uint32_t index)
 Inserts an item at the given index, shifting any items below it down one spot. More...
 
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. More...
 
uint32_t insertSorted (const uint32_t &item)
 Assumes the list is sorted and inserts the item at the appropriate spot. More...
 
uint32_t insertSortedDeref (const uint32_t &item)
 Assumes the list is sorted by dereferenced values and inserts the item at the appropriate spot. More...
 
uint32_t insertSortedCopy (const TB &item)
 Assumes the list is sorted and inserts a copy of the referenced item at the appropriate spot. More...
 
uint32_t length (void) const
 Returns the number of items currently in the list. More...
 
void sortAscending (void)
 Sorts the list in an ascending order, using the T::< operator. More...
 
void sortAscendingDeref (void)
 Sorts the list in an ascending order, using the T::< operator on dereferenced list items. More...
 
void twinSortAscending (List< T2 > &twin)
 Sorts the first list in an ascending order, using the T::< operator, the second list will be updated the same way. More...
 
uint32_t find (const TB &item) const
 Finds an item in an unsorted list (walk over all items) using the T::== operator. More...
 
uint32_t find (const uint32_t item, InequalityFunction fnc) const
 Finds an item in an unsorted list (walk over all items) using the given inequality function. More...
 
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 items. More...
 
uint32_t findSorted (const TB &item) const
 Finds an item in a sorted list (binary search) using the T::== and T::< operators. More...
 
uint32_t findSortedDeref (const TB &item) const
 Finds an item in a sorted list (binary search) using the T::== and T::< operators on dereferenced list items. More...
 
void reverse (void)
 Reverse the order of the list, useful for sorted lists that are read/created in the reverse order. More...
 
void removeTail (const uint32_t count) XSENS_LIST_THROW
 Removes items from the end of the list. More...
 
void deleteAndRemoveTail (const uint32_t count) XSENS_LIST_THROW
 
void freeAndRemoveTail (const uint32_t count) XSENS_LIST_THROW
 
void deleteItemsOnDestroy (void)
 
void freeItemsOnDestroy (void)
 
uint32_t removeDuplicateEntries (void)
 Removes any duplicate entries and returns the number of items removed. More...
 
uint32_t removeDuplicateEntriesDeref (void)
 Removes any duplicate entries and returns the number of items removed. More...
 
void isDeepCopyOf (const List< uint32_t > &source)
 Make a copy of the list, duplicating list items i with: copy[i] = new TB(*source[i]) More...
 
void isShallowCopyOf (const List< uint32_t > &source)
 Overwrites the current list with a shallow (memcopy) copy of another list. More...
 
const uint32_tgetBuffer (void) const
 Returns the start of the linear data buffer. More...
 

Protected Attributes

uint32_tm_data
 The array containing the items. More...
 
uint32_t m_max
 The current size of the data array. More...
 
uint32_t m_count
 The number of items currently in the list. More...
 
JanitorClassFunc< List< uint32_t > > * m_jcf
 Used to clean up the list on exit. More...
 
bool m_manage
 

Private Member Functions

void operator= (const IntList &list)
 intentionally NOT implemented due to ambiguous nature More...
 
void qSort (uint32_t left, uint32_t right)
 Sorts the list in an ascending order, using the T::< operator. More...
 
void qSortDeref (uint32_t left, uint32_t right)
 Sorts the list in an ascending order, using the T::< operator on dereferenced list items. More...
 

Member Typedef Documentation

◆ cmpFunc

typedef int32_t(* xsens::List< uint32_t >::cmpFunc) (const uint32_t &, const uint32_t &)
inherited

A comparison function type, should return -1, 0 or 1 for <, == and >

Definition at line 91 of file xsens_list.h.

◆ InequalityFunction

typedef int32_t(__cdecl* xsens::List< uint32_t >::InequalityFunction) (const uint32_t &, const uint32_t &)
inherited

Type for an equality compare function, should return true when NOT equal.

Definition at line 194 of file xsens_list.h.

Constructor & Destructor Documentation

◆ IntList() [1/4]

xsens::IntList::IntList ( )
inline

Standard constructor, creates an empty list with some room for items.

Definition at line 236 of file xsens_list.h.

◆ IntList() [2/4]

xsens::IntList::IntList ( const uint32_t  size)
inline

Construct a list with a capacity of at least the given size.

Definition at line 238 of file xsens_list.h.

◆ IntList() [3/4]

xsens::IntList::IntList ( const IntList src)
inline

Construct a list as a direct copy of another list.

Definition at line 240 of file xsens_list.h.

◆ IntList() [4/4]

xsens::IntList::IntList ( const uint32_t  size,
uint32_t src 
)
inline

Construct a list as a reference to a raw list.

Definition at line 242 of file xsens_list.h.

Member Function Documentation

◆ addValue()

void xsens::IntList::addValue ( int32_t  value)

◆ append()

void xsens::List< uint32_t >::append ( const uint32_t item)
inherited

Adds an item to the end of the list.

Definition at line 150 of file xsens_list.hpp.

◆ appendCopy()

void xsens::List< uint32_t >::appendCopy ( const TB &  item)
inherited

Adds a copy of a referenced item to the end of the list.

Definition at line 188 of file xsens_list.hpp.

◆ appendDeepCopy()

void xsens::List< uint32_t >::appendDeepCopy ( const List< uint32_t > &  source)
inherited

Adds the contents of the source list to the end of the list.

Definition at line 167 of file xsens_list.hpp.

◆ appendList()

void xsens::List< uint32_t >::appendList ( uint32_t  count,
const uint32_t lst 
)
inherited

Adds a number of items to the end of the list.

Definition at line 158 of file xsens_list.hpp.

◆ appendRelated()

void xsens::List< uint32_t >::appendRelated ( const TR &  item)
inherited

Adds a related item to the end of the list, using the T = TR operator.

Definition at line 197 of file xsens_list.hpp.

◆ appendShallowCopy()

void xsens::List< uint32_t >::appendShallowCopy ( const List< uint32_t > &  source)
inherited

Adds the contents of the source list to the end of the list.

Definition at line 177 of file xsens_list.hpp.

◆ clear()

void xsens::List< uint32_t >::clear ( void  )
inherited

Clears the list without explicitly deleting anything.

Definition at line 126 of file xsens_list.hpp.

◆ deleteAndClear()

void xsens::List< uint32_t >::deleteAndClear ( void  )
inherited

Calls delete for all items in the list and then clears the list.

Definition at line 110 of file xsens_list.hpp.

◆ deleteAndRemove()

void xsens::List< uint32_t >::deleteAndRemove ( const uint32_t  index)
inherited

Removes an item at the given index in the list.

Definition at line 877 of file xsens_list.hpp.

◆ deleteAndRemoveTail()

void xsens::List< uint32_t >::deleteAndRemoveTail ( const uint32_t  count)
inherited

Definition at line 807 of file xsens_list.hpp.

◆ deleteItemsOnDestroy()

void xsens::List< uint32_t >::deleteItemsOnDestroy ( void  )
inherited

Definition at line 1110 of file xsens_list.hpp.

◆ deserialize()

int32_t xsens::IntList::deserialize ( const char *  str)

◆ find() [1/2]

uint32_t xsens::List< uint32_t >::find ( const TB &  item) const
inherited

Finds an item in an unsorted list (walk over all items) using the T::== operator.

Definition at line 914 of file xsens_list.hpp.

◆ find() [2/2]

uint32_t xsens::List< uint32_t >::find ( const uint32_t  item,
InequalityFunction  fnc 
) const
inherited

Finds an item in an unsorted list (walk over all items) using the given inequality function.

Definition at line 923 of file xsens_list.hpp.

◆ findDeref()

uint32_t xsens::List< uint32_t >::findDeref ( const TB &  item) const
inherited

Finds an item in an unsorted list (walk over all items) using the T::== operator on dereferenced list items.

Definition at line 933 of file xsens_list.hpp.

◆ findSorted()

uint32_t xsens::List< uint32_t >::findSorted ( const TB &  item) const
inherited

Finds an item in a sorted list (binary search) using the T::== and T::< operators.

Definition at line 943 of file xsens_list.hpp.

◆ findSortedDeref()

uint32_t xsens::List< uint32_t >::findSortedDeref ( const TB &  item) const
inherited

Finds an item in a sorted list (binary search) using the T::== and T::< operators on dereferenced list items.

Definition at line 968 of file xsens_list.hpp.

◆ freeAndClear()

void xsens::List< uint32_t >::freeAndClear ( void  )
inherited

Calls free for all items in the list and then clears the list.

Definition at line 118 of file xsens_list.hpp.

◆ freeAndRemove()

void xsens::List< uint32_t >::freeAndRemove ( const uint32_t  index)
inherited

Removes an item at the given index in the list.

Definition at line 895 of file xsens_list.hpp.

◆ freeAndRemoveTail()

void xsens::List< uint32_t >::freeAndRemoveTail ( const uint32_t  count)
inherited

Definition at line 823 of file xsens_list.hpp.

◆ freeItemsOnDestroy()

void xsens::List< uint32_t >::freeItemsOnDestroy ( void  )
inherited

Definition at line 1121 of file xsens_list.hpp.

◆ get()

uint32_t & xsens::List< uint32_t >::get ( const uint32_t  index) const
inherited

Retrieves the item at the given index.

An index beyond the end returns the first item.

Definition at line 215 of file xsens_list.hpp.

◆ getBuffer()

const uint32_t * xsens::List< uint32_t >::getBuffer ( void  ) const
inlineinherited

Returns the start of the linear data buffer.

Definition at line 218 of file xsens_list.h.

◆ insert()

void xsens::List< uint32_t >::insert ( const uint32_t item,
const uint32_t  index 
)
inherited

Inserts an item at the given index, shifting any items below it down one spot.

Definition at line 227 of file xsens_list.hpp.

◆ insertCopy()

void xsens::List< uint32_t >::insertCopy ( const TB &  item,
const uint32_t  index 
)
inherited

Inserts a copy of the referenced item at the given index, shifting any items below it down one spot.

Definition at line 242 of file xsens_list.hpp.

◆ insertSorted()

uint32_t xsens::List< uint32_t >::insertSorted ( const uint32_t item)
inherited

Assumes the list is sorted and inserts the item at the appropriate spot.

Definition at line 992 of file xsens_list.hpp.

◆ insertSortedCopy()

uint32_t xsens::List< uint32_t >::insertSortedCopy ( const TB &  item)
inherited

Assumes the list is sorted and inserts a copy of the referenced item at the appropriate spot.

Definition at line 1071 of file xsens_list.hpp.

◆ insertSortedDeref()

uint32_t xsens::List< uint32_t >::insertSortedDeref ( const uint32_t item)
inherited

Assumes the list is sorted by dereferenced values and inserts the item at the appropriate spot.

Definition at line 1031 of file xsens_list.hpp.

◆ isDeepCopyOf()

void xsens::List< uint32_t >::isDeepCopyOf ( const List< uint32_t > &  source)
inherited

Make a copy of the list, duplicating list items i with: copy[i] = new TB(*source[i])

Definition at line 1133 of file xsens_list.hpp.

◆ isShallowCopyOf()

void xsens::List< uint32_t >::isShallowCopyOf ( const List< uint32_t > &  source)
inherited

Overwrites the current list with a shallow (memcopy) copy of another list.

Definition at line 1144 of file xsens_list.hpp.

◆ last()

uint32_t & xsens::List< uint32_t >::last ( void  ) const
inherited

Retrieves the last item.

Definition at line 205 of file xsens_list.hpp.

◆ length()

uint32_t xsens::List< uint32_t >::length ( void  ) const
inlineinherited

Returns the number of items currently in the list.

Definition at line 159 of file xsens_list.h.

◆ operator=()

void xsens::IntList::operator= ( const IntList list)
private

intentionally NOT implemented due to ambiguous nature

◆ operator==()

bool xsens::IntList::operator== ( const IntList lst)

◆ operator[]()

uint32_t & xsens::List< uint32_t >::operator[] ( const uint32_t  index) const
inherited

Retrieves the item at the given index.

An index beyond the end probably causes an exception.

Definition at line 256 of file xsens_list.hpp.

◆ qSort()

void xsens::List< uint32_t >::qSort ( uint32_t  left,
uint32_t  right 
)
privateinherited

Sorts the list in an ascending order, using the T::< operator.

Definition at line 382 of file xsens_list.hpp.

◆ qSortDeref()

void xsens::List< uint32_t >::qSortDeref ( uint32_t  left,
uint32_t  right 
)
privateinherited

Sorts the list in an ascending order, using the T::< operator on dereferenced list items.

Definition at line 415 of file xsens_list.hpp.

◆ readFromString()

int32_t xsens::IntList::readFromString ( const char *  str)

◆ remove()

void xsens::List< uint32_t >::remove ( const uint32_t  index)
inherited

Removes an item at the given index in the list.

Definition at line 775 of file xsens_list.hpp.

◆ removeDuplicateEntries()

uint32_t xsens::List< uint32_t >::removeDuplicateEntries ( void  )
inherited

Removes any duplicate entries and returns the number of items removed.

Items are compared directly.

Definition at line 839 of file xsens_list.hpp.

◆ removeDuplicateEntriesDeref()

uint32_t xsens::List< uint32_t >::removeDuplicateEntriesDeref ( void  )
inherited

Removes any duplicate entries and returns the number of items removed.

Items are compared after dereferencing.

Definition at line 858 of file xsens_list.hpp.

◆ removeTail()

void xsens::List< uint32_t >::removeTail ( const uint32_t  count)
inherited

Removes items from the end of the list.

Definition at line 792 of file xsens_list.hpp.

◆ resize()

void xsens::List< uint32_t >::resize ( uint32_t  newSize)
inherited

Resizes the list to at least the given size.

Definition at line 132 of file xsens_list.hpp.

◆ reverse()

void xsens::List< uint32_t >::reverse ( void  )
inherited

Reverse the order of the list, useful for sorted lists that are read/created in the reverse order.

Definition at line 1167 of file xsens_list.hpp.

◆ serialize()

int32_t xsens::IntList::serialize ( char *  buffer) const

◆ setIncremental()

void xsens::IntList::setIncremental ( const uint32_t  start,
const uint32_t  end,
const int32_t  step 
)

◆ sortAscending()

void xsens::List< uint32_t >::sortAscending ( void  )
inherited

Sorts the list in an ascending order, using the T::< operator.

Definition at line 453 of file xsens_list.hpp.

◆ sortAscendingDeref()

void xsens::List< uint32_t >::sortAscendingDeref ( void  )
inherited

Sorts the list in an ascending order, using the T::< operator on dereferenced list items.

Definition at line 595 of file xsens_list.hpp.

◆ swap()

void xsens::List< uint32_t >::swap ( const uint32_t  i,
const uint32_t  j 
)
inherited

Swaps two items in the list.

Definition at line 1155 of file xsens_list.hpp.

◆ twinSortAscending()

void xsens::List< uint32_t >::twinSortAscending ( List< T2 > &  twin)
inherited

Sorts the first list in an ascending order, using the T::< operator, the second list will be updated the same way.

Definition at line 738 of file xsens_list.hpp.

◆ writeToString()

int32_t xsens::IntList::writeToString ( char *  buffer) const

◆ writeToStringHex()

int32_t xsens::IntList::writeToStringHex ( char *  buffer) const

Member Data Documentation

◆ m_count

uint32_t xsens::List< uint32_t >::m_count
protectedinherited

The number of items currently in the list.

Definition at line 81 of file xsens_list.h.

◆ m_data

uint32_t * xsens::List< uint32_t >::m_data
protectedinherited

The array containing the items.

Definition at line 77 of file xsens_list.h.

◆ m_jcf

JanitorClassFunc<List<uint32_t > >* xsens::List< uint32_t >::m_jcf
protectedinherited

Used to clean up the list on exit.

Definition at line 83 of file xsens_list.h.

◆ m_manage

bool xsens::List< uint32_t >::m_manage
protectedinherited

Definition at line 84 of file xsens_list.h.

◆ m_max

uint32_t xsens::List< uint32_t >::m_max
protectedinherited

The current size of the data array.

Definition at line 79 of file xsens_list.h.




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