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... | |
Protected Member Functions inherited from ogdf::internal::RegisteredArrayBase< Registry > | |
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 437 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::const_iterator = RegisteredArrayIterator<registered_array, key_iterator, true> |
Definition at line 452 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::iterator = RegisteredArrayIterator<registered_array, key_iterator, false> |
Definition at line 451 of file RegisteredArray.h.
|
protected |
Definition at line 439 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::key_type = typename Registry::key_type |
Definition at line 445 of file RegisteredArray.h.
|
protected |
Definition at line 440 of file RegisteredArray.h.
|
protected |
Definition at line 441 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::registry_type = Registry |
Definition at line 444 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_const_ref_type = typename vector_type::const_reference |
Definition at line 449 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_ref_type = typename vector_type::reference |
Definition at line 448 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_type = typename vector_type::value_type |
Definition at line 447 of file RegisteredArray.h.
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::vector_type = std::vector<Value, OGDFAllocator<Value> > |
Definition at line 446 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 462 of file RegisteredArray.h.
|
inline |
Returns an iterator to the first key-value pair in the array.
Definition at line 524 of file RegisteredArray.h.
|
inline |
Returns a const iterator to the first key-value pair in the array.
Definition at line 530 of file RegisteredArray.h.
|
inline |
Returns a const iterator to the first key-value pair in the array.
Definition at line 536 of file RegisteredArray.h.
|
inline |
Returns the const past-the-end iterator of the array.
Definition at line 554 of file RegisteredArray.h.
|
inlineoverrideprotectedvirtual |
This operation is not supported for registered arrays without default.
Implements ogdf::internal::RegisteredArrayBase< Registry >.
Definition at line 588 of file RegisteredArray.h.
|
inline |
Returns the past-the-end iterator of the array.
Definition at line 542 of file RegisteredArray.h.
|
inline |
Returns the const past-the-end iterator of the array.
Definition at line 548 of file RegisteredArray.h.
|
inline |
Fills all entries with value x
.
Definition at line 481 of file RegisteredArray.h.
|
inlineprotected |
Returns a reference to the associated registry.
Definition at line 570 of file RegisteredArray.h.
|
inline |
Associates the array with registry
. All entries are initialized using the default constructor of Value.
Definition at line 469 of file RegisteredArray.h.
|
inline |
Returns a reference to the element associated with key
.
Definition at line 514 of file RegisteredArray.h.
|
inline |
Returns a const reference to the element associated with key
.
Definition at line 504 of file RegisteredArray.h.
|
inline |
Returns a reference to the element associated with key
.
Definition at line 494 of file RegisteredArray.h.
|
inline |
Returns a const reference to the element associated with key
.
Definition at line 484 of file RegisteredArray.h.
|
inline |
Returns a pointer to the associated registry.
Definition at line 340 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 576 of file RegisteredArray.h.
|
inlineoverrideprotectedvirtual |
Swaps the entries stored at index1
and index2
.
Implements ogdf::internal::RegisteredArrayBase< Registry >.
Definition at line 583 of file RegisteredArray.h.
|
inline |
Returns true iff the array is associated with a registry.
Definition at line 562 of file RegisteredArray.h.
|
protected |
Definition at line 455 of file RegisteredArray.h.