|
Smolgui
Immediate gui library based on SFML
|
: implement a generic pool of objects that are stored continuously in memory without fragmentation, and is in theory thread safe More...
#include <ObjectPool.h>
Public Member Functions | |
| ObjectPool ()=default | |
| ObjectPool (ObjectPool< Object, ObjectId > &&rhs) | |
| ObjectPool (const ObjectPool< Object, ObjectId > &rhs) | |
| ObjectPool & | operator= (ObjectPool< Object, ObjectId > &&rhs) |
| ObjectPool & | operator= (const ObjectPool< Object, ObjectId > &rhs) |
| Object & | add (Object &&object, const ObjectId &id) |
| Add object in pool. | |
| Object & | add (const Object &object, const ObjectId &id) |
| template<typename... ObjectArgs> | |
| Object & | emplace (const ObjectId &id, ObjectArgs &&... constructorArgs) |
| Build a new object in pool. | |
| void | remove (const ObjectId &object) |
| Remove a specific object from pool. | |
| void | reserve (const size_t amount) |
| Reserve some amount of memory. | |
| void | clear () |
| Clear data in object pool. | |
| bool | has (const ObjectId &object) const |
| Test if an object exists in pool. | |
| bool | empty () const |
| Test if pool is empty. | |
| Object & | get (const ObjectId &object) |
| Get oject in pool. | |
| const Object & | get (const ObjectId &object) const |
| void | changeId (const ObjectId &oldId, const ObjectId &newId) |
| Change id of a stored object. | |
| std::vector< ObjectId > | ids () const |
| Get list of all identifiers used to store object. | |
| size_t | size () const |
| Get count of pooled objects. | |
| auto | begin () |
| auto | end () |
| auto | begin () const |
| auto | end () const |
: implement a generic pool of objects that are stored continuously in memory without fragmentation, and is in theory thread safe
|
default |
Big five
| sgui::ObjectPool< Object, ObjectId >::ObjectPool | ( | ObjectPool< Object, ObjectId > && | rhs | ) |
| sgui::ObjectPool< Object, ObjectId >::ObjectPool | ( | const ObjectPool< Object, ObjectId > & | rhs | ) |
| Object & sgui::ObjectPool< Object, ObjectId >::add | ( | const Object & | object, |
| const ObjectId & | id ) |
| Object & sgui::ObjectPool< Object, ObjectId >::add | ( | Object && | object, |
| const ObjectId & | id ) |
Add object in pool.
| object | Object to be added |
| id | Identifier that will serve to retrieve object |
|
inline |
To iterate through pooled objects
|
inline |
| void sgui::ObjectPool< Object, ObjectId >::changeId | ( | const ObjectId & | oldId, |
| const ObjectId & | newId ) |
Change id of a stored object.
| oldId | Old identifier of the object |
| newId | New identifier of the object |
| void sgui::ObjectPool< Object, ObjectId >::clear | ( | ) |
Clear data in object pool.
| Object & sgui::ObjectPool< Object, ObjectId >::emplace | ( | const ObjectId & | id, |
| ObjectArgs &&... | constructorArgs ) |
Build a new object in pool.
| id | Identifier that will serve to retrieve object |
| constructorArgs | Parameters used to build object |
| bool sgui::ObjectPool< Object, ObjectId >::empty | ( | ) | const |
Test if pool is empty.
|
inline |
|
inline |
| Object & sgui::ObjectPool< Object, ObjectId >::get | ( | const ObjectId & | object | ) |
Get oject in pool.
| object | Identifier of the object searched |
| const Object & sgui::ObjectPool< Object, ObjectId >::get | ( | const ObjectId & | object | ) | const |
| bool sgui::ObjectPool< Object, ObjectId >::has | ( | const ObjectId & | object | ) | const |
Test if an object exists in pool.
| object | Identifier of the object searched |
| std::vector< ObjectId > sgui::ObjectPool< Object, ObjectId >::ids | ( | ) | const |
Get list of all identifiers used to store object.
| ObjectPool & sgui::ObjectPool< Object, ObjectId >::operator= | ( | const ObjectPool< Object, ObjectId > & | rhs | ) |
| ObjectPool & sgui::ObjectPool< Object, ObjectId >::operator= | ( | ObjectPool< Object, ObjectId > && | rhs | ) |
| void sgui::ObjectPool< Object, ObjectId >::remove | ( | const ObjectId & | object | ) |
Remove a specific object from pool.
| object | Identifier of the object to be removed |
| void sgui::ObjectPool< Object, ObjectId >::reserve | ( | const size_t | amount | ) |
Reserve some amount of memory.
| amount | Amount reserved in memory |
| size_t sgui::ObjectPool< Object, ObjectId >::size | ( | ) | const |
Get count of pooled objects.