![]() |
Gorgon Game Engine
|
This class acts like a regular collection, however, it performs garbage collection over its elements. More...
Public Member Functions | |
void | Collect () |
![]() | |
Collection ()=default | |
Default constructor. More... | |
Collection (Collection &&col) | |
Move constructor. More... | |
Collection (const Collection &)=delete | |
Disabled. More... | |
template<typename... Args_> | |
Collection (T_ &t, Args_ &... args) | |
Initializing constructor. More... | |
template<typename... Args_> | |
Collection (T_ *t, Args_ *... args) | |
Initializing constructor. More... | |
bool | Add (T_ &data) |
Adds a the given item to the end of the list if it is not already in the list. More... | |
template<typename... Args_> | |
int | Add (T_ &data, Args_ &... args) |
Adds a the given item to the end of the list. More... | |
bool | Add (T_ *Data) |
Adds the given item to the end of the list if it is not already in the list. More... | |
template<typename... Args_> | |
int | Add (T_ *Data, Args_ *... args) |
Adds the given item to the end of the list, returns the number of added elements. More... | |
template<typename... Args_> | |
T_ & | AddNew (Args_ &&... args) |
Creates a new item and adds to the end of the collection. More... | |
void | Clear () |
Removes all items from the list, allocated memory for the list stays. More... | |
void | Collapse () |
Clears the contents of the collection and releases the memory used for the list. More... | |
void | Delete (const T_ *item) |
Deletes an item from the collection using its pointer. More... | |
void | Delete (ConstIterator &it) |
void | Delete (Iterator &it) |
void | Delete (long index) |
Deletes an item from the collection using its index. More... | |
void | Delete (T_ &data) |
Deletes an item from the collection using its reference. More... | |
void | DeleteAll () |
Deletes and removes all elements in the collection. More... | |
void | Destroy () |
Destroys the entire collection, effectively deleting the contents and the list including all the memory used by it. More... | |
Collection | Duplicate () const |
Duplicates this collection. More... | |
Iterator | Find (const T_ &item) |
Searches the position of a given item, if not found end iterator returned. More... | |
ConstIterator | Find (const T_ &item) const |
Searches the position of a given item, if not found end iterator returned. More... | |
Iterator | Find (const T_ *item) |
Searches the position of a given item, if not found end iterator returned. More... | |
ConstIterator | Find (const T_ *item) const |
Searches the position of a given item, if not found end iterator returned. More... | |
long | FindLocation (const T_ &item) const |
Searches the position of a given item, if not found -1 is returned. More... | |
long | FindLocation (const T_ *item) const |
Searches the position of a given item, if not found -1 is returned. More... | |
T_ & | Get (long index) |
Returns the element at the given index. Checks and throws if out of range. More... | |
T_ & | Get (long index) const |
Returns the element at the given index. Checks and throws if out of range. More... | |
long | GetCount () const |
Returns number of elements. More... | |
long | GetSize () const |
Returns number of elements. More... | |
bool | Insert (T_ &data, const T_ &before) |
this method adds the given object in front of the reference. More... | |
bool | Insert (T_ &data, long before) |
this method adds the given object in front of the reference. More... | |
bool | Insert (T_ *data, const T_ &before) |
this method adds the given object in front of the reference. More... | |
bool | Insert (T_ *data, long before) |
this method adds the given object in front of the reference. More... | |
template<typename... Args_> | |
T_ & | InsertNew (const T_ &before, Args_... args) |
Creates a new item and inserts it before the given reference. More... | |
template<typename... Args_> | |
T_ & | InsertNew (long before, Args_... args) |
Creates a new item and inserts it before the given reference. More... | |
void | MoveBefore (const T_ &index, const T_ &before) |
this method moves the given object in the collection in front of the reference More... | |
void | MoveBefore (const T_ &index, long before) |
this method moves the given object in the collection in front of the reference More... | |
void | MoveBefore (long index, const T_ &before) |
this method moves the given object in the collection in front of the reference More... | |
void | MoveBefore (long index, long before) |
this method moves the given object in the collection in front of the reference More... | |
Adder | operator+= (T_ &data) |
Adds items to the end of the list. Use comma to add more than one item. More... | |
Adder | operator+= (T_ *Data) |
Adds items to the end of the list. Use comma to add more than one item. More... | |
Collection & | operator= (Collection &&col) |
Move assignment. More... | |
Collection & | operator= (const Collection &)=delete |
Disabled. More... | |
T_ & | operator[] (long index) |
Returns the item at a given index. More... | |
T_ & | operator[] (long index) const |
Returns the item at a given index. More... | |
T_ & | Pop () |
Removes and returns the last item in the collection. More... | |
bool | Push (T_ &data) |
Adds a the given item to the end of the list if it is not already in the list. More... | |
bool | Push (T_ *Data) |
Adds the given item to the end of the list if it is not already in the list. More... | |
void | Remove (const T_ &data) |
Removes an item from the collection using its reference. More... | |
void | Remove (const T_ *item) |
Removes an item from the collection using its pointer. More... | |
void | Remove (ConstIterator &it) |
void | Remove (Iterator &it) |
void | Remove (long index) |
Removes an item from the collection using its index. More... | |
void | Reserve (long amount) |
Allocates memory for the given amount of items. More... | |
void | Sort () |
Sorts items in the collection. More... | |
template<class P_ > | |
void | Sort (P_ predicate=P_()) |
Sorts items in the collection. More... | |
void | Swap (Collection &col) |
Swaps the given collection with this one. More... | |
Iterator | begin () |
Iterator | end () |
end iterator More... | |
Iterator | First () |
returns the iterator to the first item More... | |
Iterator | Last () |
returns the iterator to the last item More... | |
ConstIterator | begin () const |
begin iterator More... | |
ConstIterator | end () const |
end iterator More... | |
ConstIterator | First () const |
returns the iterator to the first item More... | |
ConstIterator | Last () const |
returns the iterator to the last item More... | |
Additional Inherited Members | |
![]() | |
typedef Iterator_< T_, Collection > | Iterator |
Regular iterator. More... | |
This class acts like a regular collection, however, it performs garbage collection over its elements.
This class requires T_ to have a non member function called ShouldBeCollected which should return whether the item should be collected by garbage collector. This function should be resolved through ADL
void Collect | ( | ) |
References Collection< T_ >::First().