Registered arrays without default values or by-index access to values. More...
#include <ogdf/basic/RegisteredArray.h>
Public Types | |
using | const_iterator = RegisteredArrayIterator< registered_array, key_iterator, true > |
using | iterator = RegisteredArrayIterator< registered_array, key_iterator, false > |
using | key_type = typename Registry::key_type |
using | registry_type = Registry |
using | value_const_ref_type = typename vector_type::const_reference |
using | value_ref_type = typename vector_type::reference |
using | value_type = typename vector_type::value_type |
using | vector_type = std::vector< Value, OGDFAllocator< Value > > |
Public Member Functions | |
RegisteredArrayWithoutDefaultOrIndexAccess ()=default | |
Creates a new registered array associated with no registry. More... | |
RegisteredArrayWithoutDefaultOrIndexAccess (const Registry *registry) | |
Creates a new registered array associated with registry . More... | |
iterator | begin () |
Returns an iterator to the first key-value pair in the array. More... | |
const_iterator | begin () const |
Returns a const iterator to the first key-value pair in the array. More... | |
const_iterator | cbegin () const |
Returns a const iterator to the first key-value pair in the array. More... | |
const_iterator | cend () const |
Returns the const past-the-end iterator of the array. More... | |
iterator | end () |
Returns the past-the-end iterator of the array. More... | |
const_iterator | end () const |
Returns the const past-the-end iterator of the array. More... | |
void | fill (value_const_ref_type x) |
Fills all entries with value x . More... | |
void | init (const Registry *registry=nullptr) |
Associates the array with registry . All entries are initialized using the default constructor of Value. More... | |
value_ref_type | operator() (key_type key) |
Returns a reference to the element associated with key . More... | |
value_const_ref_type | operator() (key_type key) const |
Returns a const reference to the element associated with key . More... | |
value_ref_type | operator[] (key_type key) |
Returns a reference to the element associated with key . More... | |
value_const_ref_type | operator[] (key_type key) const |
Returns a const reference to the element associated with key . More... | |
const Registry * | registeredAt () const |
Returns a pointer to the associated registry. More... | |
bool | valid () const |
Returns true iff the array is associated with a registry. More... | |
Protected Types | |
using | key_iterator = typename Registry::iterator_type |
using | registered_array = RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value > |
using | registered_array_base = RegisteredArrayBase< Registry > |
Protected Member Functions | |
void | copyEntry (int toIndex, int fromIndex) override |
This operation is not supported for registered arrays without default. More... | |
const Registry & | getRegistry () const |
Returns a reference to the associated registry. More... | |
void | resize (int size, bool shrink) override |
Resizes the registered array to size . The array will only shrink if shrink is true . More... | |
void | swapEntries (int index1, int index2) override |
Swaps the entries stored at index1 and index2 . More... | |
![]() | |
void | moveRegister (RegisteredArrayBase< Registry > &move_from) |
Moves array registration from move_from to this array. More... | |
void | reregister (const Registry *registry) |
Associates the array with a new registry. More... | |
RegisteredArrayBase ()=default | |
Creates a registered array associated with no registry. More... | |
RegisteredArrayBase (const RegisteredArrayBase< Registry > ©) | |
Creates a registered array associated with the same registry as copy . More... | |
RegisteredArrayBase (RegisteredArrayBase< Registry > &&move_from) noexcept | |
Moves the registration of move_from to this registered array. More... | |
virtual | ~RegisteredArrayBase () noexcept |
Destructor. More... | |
RegisteredArrayBase & | operator= (const RegisteredArrayBase< Registry > ©) |
Assignment operator. More... | |
RegisteredArrayBase & | operator= (RegisteredArrayBase< Registry > &&move_from) noexcept |
Assignment operator (move semantics). More... | |
const Registry * | registeredAt () const |
Returns a pointer to the associated registry. More... | |
void | unregister () noexcept |
Clears the array and associates it with no registry. More... | |
Protected Attributes | |
vector_type | m_data |
Registered arrays without default values or by-index access to values.
Registered arrays provide an efficient, constant-time mapping from indexed keys of a Registry to elements of type Value. The storage automatically grows and shrinks when keys are added to or removed from the registry. New values are initialized using the default constructor of Value.
Registry | The class which manages the registered keys. Must provide the functions defined in class RegistryBase. |
Value | The type of the stored data. |
Definition at line 488 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::const_iterator = RegisteredArrayIterator<registered_array, key_iterator, true> |
Definition at line 503 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::iterator = RegisteredArrayIterator<registered_array, key_iterator, false> |
Definition at line 502 of file RegisteredArray.h.
|
protected |
Definition at line 490 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::key_type = typename Registry::key_type |
Definition at line 496 of file RegisteredArray.h.
|
protected |
Definition at line 491 of file RegisteredArray.h.
|
protected |
Definition at line 492 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::registry_type = Registry |
Definition at line 495 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_const_ref_type = typename vector_type::const_reference |
Definition at line 500 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_ref_type = typename vector_type::reference |
Definition at line 499 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_type = typename vector_type::value_type |
Definition at line 498 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::vector_type = std::vector<Value, OGDFAllocator<Value> > |
Definition at line 497 of file RegisteredArray.h.
|
default |
Creates a new registered array associated with no registry.
|
inlineexplicit |
Creates a new registered array associated with registry
.
Definition at line 513 of file RegisteredArray.h.
|
inline |
Returns an iterator to the first key-value pair in the array.
Definition at line 575 of file RegisteredArray.h.
|
inline |
Returns a const iterator to the first key-value pair in the array.
Definition at line 581 of file RegisteredArray.h.
|
inline |
Returns a const iterator to the first key-value pair in the array.
Definition at line 587 of file RegisteredArray.h.
|
inline |
Returns the const past-the-end iterator of the array.
Definition at line 605 of file RegisteredArray.h.
|
inlineoverrideprotectedvirtual |
This operation is not supported for registered arrays without default.
Implements ogdf::internal::RegisteredArrayBase< Registry >.
Definition at line 640 of file RegisteredArray.h.
|
inline |
Returns the past-the-end iterator of the array.
Definition at line 593 of file RegisteredArray.h.
|
inline |
Returns the const past-the-end iterator of the array.
Definition at line 599 of file RegisteredArray.h.
|
inline |
Fills all entries with value x
.
Definition at line 532 of file RegisteredArray.h.
|
inlineprotected |
Returns a reference to the associated registry.
Definition at line 621 of file RegisteredArray.h.
|
inline |
Associates the array with registry
. All entries are initialized using the default constructor of Value.
Definition at line 520 of file RegisteredArray.h.
|
inline |
Returns a reference to the element associated with key
.
Definition at line 565 of file RegisteredArray.h.
|
inline |
Returns a const reference to the element associated with key
.
Definition at line 555 of file RegisteredArray.h.
|
inline |
Returns a reference to the element associated with key
.
Definition at line 545 of file RegisteredArray.h.
|
inline |
Returns a const reference to the element associated with key
.
Definition at line 535 of file RegisteredArray.h.
|
inline |
Returns a pointer to the associated registry.
Definition at line 391 of file RegisteredArray.h.
|
inlineoverrideprotectedvirtual |
Resizes the registered array to size
. The array will only shrink if shrink
is true
.
Implements ogdf::internal::RegisteredArrayBase< Registry >.
Definition at line 627 of file RegisteredArray.h.
|
inlineoverrideprotectedvirtual |
Swaps the entries stored at index1
and index2
.
Implements ogdf::internal::RegisteredArrayBase< Registry >.
Definition at line 634 of file RegisteredArray.h.
|
inline |
Returns true iff the array is associated with a registry.
Definition at line 613 of file RegisteredArray.h.
|
protected |
Definition at line 506 of file RegisteredArray.h.