![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
#include "lib/scoped-collection.hpp"
A fixed collection of non-copyable polymorphic objects.
All child objects reside in a common chunk of storage and are owned and managed by this collection holder. Array style access and iteration is provided.
| I | the nominal Base/Interface class for a family of types |
| siz | maximum storage required for the targets to be held inline |
Definition at line 94 of file scoped-collection.hpp.
Classes | |
| class | ElementHolder |
| Storage Frame to hold one Child object. More... | |
| class | FillAll |
| class | FillWith |
| fills the ScopedCollection with default constructed I-instances More... | |
| class | PullFrom |
| fills the ScopedCollection with default constructed TY-instances More... | |
Public Types | |
| using | iterator = IterAdapter< I *, const ScopedCollection * > |
| using | const_iterator = IterAdapter< const I *, const ScopedCollection * > |
Static Public Member Functions | |
| template<typename IT > | |
| static PullFrom< IT > | pull (IT iter) |
| fills by copy-constructing values pulled from the iterator IT | |
Public Member Functions | |
| ~ScopedCollection () | |
| ScopedCollection (size_t maxElements) | |
| template<class CTOR > | |
| ScopedCollection (size_t maxElements, CTOR builder) | |
| creating a ScopedCollection in RAII-style: The embedded elements will be created immediately. | |
| template<class TY > | |
| ScopedCollection (size_t maxElements, void(TY::*builder)(ElementHolder &), TY *const instance) | |
| variation of RAII-style: using a builder function, which is a member of some object. | |
| void | clear () |
| void | populate () |
| init all elements default constructed | |
| template<class CTOR > | |
| void | populate_by (CTOR builder) |
| init all elements at once, invoking a builder functor for each. | |
| template<class TY > | |
| void | populate_by (void(TY::*builder)(ElementHolder &), TY *const instance) |
| variation of element initialisation, invoking a member function of some manager object for each collection element to be created. | |
| I & | emplaceElement () |
| push a new element of default type to the end of this container | |
| template<class TY = I, typename... ARGS> | |
| TY & | emplace (ARGS &&...args) |
| push new entry at the end of this container and build object of type TY in place there | |
| I & | operator[] (size_t index) const |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
| size_t | size () const |
| size_t | capacity () const |
| bool | empty () const |
Friends | |
| iterator | begin (ScopedCollection &sco) |
| const iterator | begin (ScopedCollection const &sco) |
| iterator | end (ScopedCollection &sco) |
| const iterator | end (ScopedCollection const &sco) |
| void | iterNext (const ScopedCollection *, I *&pos) |
| Iteration-logic: switch to next position. | |
| void | iterNext (const ScopedCollection *, const I *&pos) |
| template<typename POS > | |
| bool | checkPoint (const ScopedCollection *src, POS &pos) |
| Iteration-logic: detect iteration end. | |
Private Types | |
| typedef std::unique_ptr< ElementHolder[]> | ElementStorage |
Private Member Functions | |
| void | __ensureSufficientCapacity () |
| I * | _access_begin () const |
| I * | _access_end () const |
Private Member Functions inherited from NonCopyable | |
| ~NonCopyable ()=default | |
| NonCopyable ()=default | |
| NonCopyable (NonCopyable const &)=delete | |
| NonCopyable & | operator= (NonCopyable const &)=delete |
Private Attributes | |
| size_t | level_ |
| size_t | capacity_ |
| ElementStorage | elements_ |
|
inline |
Definition at line 146 of file scoped-collection.hpp.
|
inlineexplicit |
Definition at line 152 of file scoped-collection.hpp.
|
inline |
creating a ScopedCollection in RAII-style: The embedded elements will be created immediately.
Ctor fails in case of any error during element creation.
| builder | functor to be invoked for each "slot". It gets an ElementHolder& as parameter, and should use this to create an object of some I-subclass |
Definition at line 166 of file scoped-collection.hpp.
|
inline |
variation of RAII-style: using a builder function, which is a member of some object.
This supports the typical usage situation, where a manager object builds a ScopedCollection of some components
| builder | member function used to create the elements |
| instance | the owning class instance, on which the builder member function will be invoked ("this"). |
Definition at line 183 of file scoped-collection.hpp.
| using iterator = IterAdapter< I *, const ScopedCollection *> |
Definition at line 330 of file scoped-collection.hpp.
| using const_iterator = IterAdapter<const I *, const ScopedCollection *> |
Definition at line 331 of file scoped-collection.hpp.
|
private |
Definition at line 355 of file scoped-collection.hpp.
|
inlinestatic |
fills by copy-constructing values pulled from the iterator IT
| iter | convenience shortcut to pull from any given Lumiera Forward Iterator |
Definition at line 203 of file scoped-collection.hpp.
|
inline |
Definition at line 209 of file scoped-collection.hpp.
References ERROR_LOG_AND_IGNORE.
|
inline |
init all elements default constructed
Definition at line 225 of file scoped-collection.hpp.
|
inline |
init all elements at once, invoking a builder functor for each.
| builder | to create the individual elements this functor is responsible to invoke the appropriate ElementHolder::create function, which places a new element into the storage frame passed as parameter. |
Definition at line 250 of file scoped-collection.hpp.
Referenced by OutputSlotImplBase::ConnectionManager< CON >::init().
Here is the caller graph for this function:
|
inline |
variation of element initialisation, invoking a member function of some manager object for each collection element to be created.
Definition at line 272 of file scoped-collection.hpp.
|
inline |
push a new element of default type to the end of this container
Definition at line 294 of file scoped-collection.hpp.
|
inline |
push new entry at the end of this container and build object of type TY in place there
Definition at line 306 of file scoped-collection.hpp.
Referenced by lib::test::threadBenchmark().
Here is the caller graph for this function:
|
inline |
Definition at line 319 of file scoped-collection.hpp.
References LERR_.
|
inline |
Definition at line 334 of file scoped-collection.hpp.
|
inline |
Definition at line 335 of file scoped-collection.hpp.
|
inline |
Definition at line 336 of file scoped-collection.hpp.
|
inline |
Definition at line 337 of file scoped-collection.hpp.
|
inline |
Definition at line 340 of file scoped-collection.hpp.
Referenced by OutputSlotImplBase::ConnectionManager< CON >::isActive().
Here is the caller graph for this function:
|
inline |
Definition at line 341 of file scoped-collection.hpp.
|
inline |
Definition at line 342 of file scoped-collection.hpp.
|
inlineprivate |
Definition at line 364 of file scoped-collection.hpp.
References LERR_.
|
inlineprivate |
Definition at line 407 of file scoped-collection.hpp.
|
inlineprivate |
Definition at line 408 of file scoped-collection.hpp.
|
private |
Definition at line 357 of file scoped-collection.hpp.
|
private |
Definition at line 358 of file scoped-collection.hpp.
|
private |
Definition at line 359 of file scoped-collection.hpp.
|
friend |
Definition at line 346 of file scoped-collection.hpp.
|
friend |
Definition at line 347 of file scoped-collection.hpp.
|
friend |
Definition at line 348 of file scoped-collection.hpp.
|
friend |
Definition at line 349 of file scoped-collection.hpp.
|
friend |
Iteration-logic: switch to next position.
Definition at line 379 of file scoped-collection.hpp.
|
friend |
Definition at line 386 of file scoped-collection.hpp.
|
friend |
Iteration-logic: detect iteration end.
Definition at line 395 of file scoped-collection.hpp.
Inheritance diagram for ScopedCollection< I, siz >:
Collaboration diagram for ScopedCollection< I, siz >: