SCL
1.0
Standard Control Library : Control, dynamics, physics, and simulation
|
#include <CMappedList.hpp>
Public Types | |
typedef CMappedList< Idx, T * > ::iterator | iterator |
typedef CMappedList< Idx, T * > ::const_iterator | const_iterator |
typedef size_t | size_type |
typedef ptrdiff_t | difference_type |
typedef T ** | pointer |
typedef const T ** | const_pointer |
typedef T *& | reference |
typedef const T *& | const_reference |
typedef T * | value_type |
Public Member Functions | |
bool | operator== (const CMappedList< Idx, T * > &rhs) |
bool | operator!= (const CMappedList< Idx, T * > &rhs) |
void | swap (CMappedList< Idx, T * > &arg_swap_obj) |
virtual T ** | create (const Idx &arg_idx, const bool insert_at_start=true) |
virtual T ** | create (const Idx &arg_idx, const T *&arg_t, const bool insert_at_start=true) |
virtual T ** | insert (const Idx &arg_idx, T **arg_t, const bool insert_at_start=true) |
virtual T ** | at (const std::size_t arg_idx) |
virtual T ** | at (const Idx &arg_idx) |
virtual const Idx * | getIndexAt (const std::size_t arg_idx) const |
virtual int | getIndexNumericAt (const Idx &arg_idx) const |
virtual int | getIndexNumericAt (const T **const arg_node) const |
virtual const T ** | at_const (const std::size_t arg_idx) const |
virtual const T ** | at_const (const Idx &arg_idx) const |
virtual bool | erase (T **arg_t) |
virtual bool | erase (const Idx &arg_idx) |
virtual std::size_t | size () const |
virtual bool | empty () const |
virtual bool | clear () |
virtual T ** | operator[] (const std::size_t arg_idx) |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
virtual bool | sort (const std::vector< Idx > &arg_order) |
virtual bool | sort_get_order (std::vector< Idx > &ret_order) const |
virtual bool | isSorted () const |
Protected Member Functions | |
virtual bool | deepCopy (const CMappedList< Idx, T * > *const arg_pmap) |
Protected Attributes | |
SMLNode< Idx, T * > * | front_ |
SMLNode< Idx, T * > * | back_ |
SMLNode< Idx, T * > | null_ |
std::map< Idx, SMLNode< Idx, T * > * > | map_ |
std::size_t | size_ |
std::vector< Idx > | sorting_order_ |
bool | flag_is_sorted_ |
This is to delete the second pointers in the destructor. Useful if you want to manage pointers to pointers.
Ie. if T is actually something like CSuperClass*, and so the objects the pilemap stores are CSuperClass**.
This implementation will delete the objects all through.
|
inherited |
STL container specific code: (a) A set of typedefs (b) An iterator definition (c) Standard methods
The standard stl typedefs:
|
virtualinherited |
Returns the element at the given numerical index in the linked list (usually useful only for debugging)
NOTE : The index starts at 0
|
virtualinherited |
Returns the element referenced by the index
NOTE : This uses the std::map (and is somewhat slow)
|
virtualinherited |
Returns the element at the given numerical index in the linked list (usually useful only for debugging)
NOTE : The index starts at 0
|
virtualinherited |
Returns a const pointer to the element referenced by the index
NOTE : This uses the std::map (and is rather slow)
|
inlineinherited |
The iterator functions
|
virtualinherited |
Clears all elements from the list
|
virtualinherited |
Example usage: first.assign (7,100); // 7 ints with value 100 second.assign (first.begin(),first.end()); // a copy of first ******************************* The mapped list specific methods
Creates an element, inserts an element into the list and returns the pointer
|
virtualinherited |
Copies the given element, inserts the copied element into the list and returns the pointer to the copied element.
By default inserts element at the start/begin() position. If specified, flag is false, inserts at the end of the list.
|
protectedvirtualinherited |
Does a deep copy of the mappedlist to get a new one. This is VERY SLOW.
|
inlinevirtualinherited |
Is the container empty
|
virtualinherited |
Erases an element from the list. Referenced by the element's memory location
|
virtualinherited |
Erases an element from the list. Referenced by its std::map index
NOTE : This uses the std::map (and is rather slow)
|
virtualinherited |
Returns the typed index at the given numerical index in the linked list
NOTE : The index starts at 0
|
virtualinherited |
Returns the numeric index at the given typed index in the linked list
NOTE : The index starts at 0. Returns -1 if node not found.
Returns the numeric index at the given typed index in the linked list
|
virtualinherited |
Returns the numeric index at the given typed index in the linked list
NOTE : The index starts at 0. Returns -1 if node not found.
Returns the numeric index at the given typed index in the linked list
|
virtualinherited |
Inserts the given object into the list and returns the pointer to the copied element. NOTE : The recommended method is to use create. Else the object memory deallocation might be ambiguous. Remember that the mapped list "always" clears its own data.
By default inserts element at the start/begin() position. If specified, flag is false, inserts at the end of the list.
|
inlinevirtualinherited |
Whether the list has been sorted or not
|
inherited |
Comparison operator : Performs an element-by-element check (std container requirement). Beware; This can be quite slow.
|
inherited |
Comparison operator : Performs an element-by-element check (std container requirement). Beware; This can be quite slow.
|
inlinevirtualinherited |
Typical operator access
|
inlinevirtualinherited |
Returns the size of the mapped list
|
virtualinherited |
Sorting related functions
Sorts the list so that iterator access matches the given vector's index. Ie. Given indices 0 to n in the vector, the begin() iterator will match 0, and the end() will appear after iterating over n.
Any create/erase/swap etc. function call will invalidate the sort ordering.
Sorting type : Insertion Sort.
|
inlinevirtualinherited |
Get the sorting order if there is one
|
inherited |
Swaps the elements with the passed pilemap
|
protectedinherited |
Pointer to the tail/back/dangling-end of the list
|
protectedinherited |
Whether the list is sorted or not
|
protectedinherited |
Mapped List Data
Pointer to the head/front/insertion-end of the list
|
protectedinherited |
The map that will enable Idx based data lookup
|
protectedinherited |
Pointer to the element obtained with the end() call. Does not exist in the map.
|
protectedinherited |
The size of the MappedList
|
protectedinherited |
An index that specifies a sort ordering if required