Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value > Class Template Reference

Registered arrays without default values or by-index access to values. More...

#include <ogdf/basic/RegisteredArray.h>

+ Inheritance diagram for ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >:

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 > &copy)
 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...
 
RegisteredArrayBaseoperator= (const RegisteredArrayBase< Registry > &copy)
 Assignment operator. More...
 
RegisteredArrayBaseoperator= (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
 

Detailed Description

template<class Registry, class Value>
class ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >

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.

Template Parameters
RegistryThe class which manages the registered keys. Must provide the functions defined in class RegistryBase.
ValueThe type of the stored data.
See also
RegistryBase, RegisteredArrayWithoutDefaultWithIndexAccess, RegisteredArrayWithoutDefault, RegisteredArrayWithDefault, RegisteredArray

Definition at line 437 of file RegisteredArray.h.

Member Typedef Documentation

◆ const_iterator

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::const_iterator = RegisteredArrayIterator<registered_array, key_iterator, true>

Definition at line 452 of file RegisteredArray.h.

◆ iterator

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::iterator = RegisteredArrayIterator<registered_array, key_iterator, false>

Definition at line 451 of file RegisteredArray.h.

◆ key_iterator

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::key_iterator = typename Registry::iterator_type
protected

Definition at line 439 of file RegisteredArray.h.

◆ key_type

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::key_type = typename Registry::key_type

Definition at line 445 of file RegisteredArray.h.

◆ registered_array

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::registered_array = RegisteredArrayWithoutDefaultOrIndexAccess<Registry, Value>
protected

Definition at line 440 of file RegisteredArray.h.

◆ registered_array_base

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::registered_array_base = RegisteredArrayBase<Registry>
protected

Definition at line 441 of file RegisteredArray.h.

◆ registry_type

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::registry_type = Registry

Definition at line 444 of file RegisteredArray.h.

◆ value_const_ref_type

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_const_ref_type = typename vector_type::const_reference

Definition at line 449 of file RegisteredArray.h.

◆ value_ref_type

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_ref_type = typename vector_type::reference

Definition at line 448 of file RegisteredArray.h.

◆ value_type

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::value_type = typename vector_type::value_type

Definition at line 447 of file RegisteredArray.h.

◆ vector_type

template<class Registry , class Value >
using ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::vector_type = std::vector<Value, OGDFAllocator<Value> >

Definition at line 446 of file RegisteredArray.h.

Constructor & Destructor Documentation

◆ RegisteredArrayWithoutDefaultOrIndexAccess() [1/2]

template<class Registry , class Value >
ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::RegisteredArrayWithoutDefaultOrIndexAccess ( )
default

Creates a new registered array associated with no registry.

◆ RegisteredArrayWithoutDefaultOrIndexAccess() [2/2]

template<class Registry , class Value >
ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::RegisteredArrayWithoutDefaultOrIndexAccess ( const Registry *  registry)
inlineexplicit

Creates a new registered array associated with registry.

Definition at line 462 of file RegisteredArray.h.

Member Function Documentation

◆ begin() [1/2]

template<class Registry , class Value >
iterator ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::begin ( )
inline

Returns an iterator to the first key-value pair in the array.

Definition at line 524 of file RegisteredArray.h.

◆ begin() [2/2]

template<class Registry , class Value >
const_iterator ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::begin ( ) const
inline

Returns a const iterator to the first key-value pair in the array.

Definition at line 530 of file RegisteredArray.h.

◆ cbegin()

template<class Registry , class Value >
const_iterator ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::cbegin ( ) const
inline

Returns a const iterator to the first key-value pair in the array.

Definition at line 536 of file RegisteredArray.h.

◆ cend()

template<class Registry , class Value >
const_iterator ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::cend ( ) const
inline

Returns the const past-the-end iterator of the array.

Definition at line 554 of file RegisteredArray.h.

◆ copyEntry()

template<class Registry , class Value >
void ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::copyEntry ( int  toIndex,
int  fromIndex 
)
inlineoverrideprotectedvirtual

This operation is not supported for registered arrays without default.

Implements ogdf::internal::RegisteredArrayBase< Registry >.

Definition at line 588 of file RegisteredArray.h.

◆ end() [1/2]

template<class Registry , class Value >
iterator ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::end ( )
inline

Returns the past-the-end iterator of the array.

Definition at line 542 of file RegisteredArray.h.

◆ end() [2/2]

template<class Registry , class Value >
const_iterator ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::end ( ) const
inline

Returns the const past-the-end iterator of the array.

Definition at line 548 of file RegisteredArray.h.

◆ fill()

template<class Registry , class Value >
void ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::fill ( value_const_ref_type  x)
inline

Fills all entries with value x.

Definition at line 481 of file RegisteredArray.h.

◆ getRegistry()

template<class Registry , class Value >
const Registry& ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::getRegistry ( ) const
inlineprotected

Returns a reference to the associated registry.

Definition at line 570 of file RegisteredArray.h.

◆ init()

template<class Registry , class Value >
void ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::init ( const Registry *  registry = nullptr)
inline

Associates the array with registry. All entries are initialized using the default constructor of Value.

Definition at line 469 of file RegisteredArray.h.

◆ operator()() [1/2]

template<class Registry , class Value >
value_ref_type ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::operator() ( key_type  key)
inline

Returns a reference to the element associated with key.

Definition at line 514 of file RegisteredArray.h.

◆ operator()() [2/2]

template<class Registry , class Value >
value_const_ref_type ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::operator() ( key_type  key) const
inline

Returns a const reference to the element associated with key.

Definition at line 504 of file RegisteredArray.h.

◆ operator[]() [1/2]

template<class Registry , class Value >
value_ref_type ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::operator[] ( key_type  key)
inline

Returns a reference to the element associated with key.

Definition at line 494 of file RegisteredArray.h.

◆ operator[]() [2/2]

template<class Registry , class Value >
value_const_ref_type ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::operator[] ( key_type  key) const
inline

Returns a const reference to the element associated with key.

Definition at line 484 of file RegisteredArray.h.

◆ registeredAt()

template<class Registry , class Value >
const Registry* ogdf::internal::RegisteredArrayBase< Registry >::registeredAt
inline

Returns a pointer to the associated registry.

Definition at line 340 of file RegisteredArray.h.

◆ resize()

template<class Registry , class Value >
void ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::resize ( int  size,
bool  shrink 
)
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.

◆ swapEntries()

template<class Registry , class Value >
void ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::swapEntries ( int  index1,
int  index2 
)
inlineoverrideprotectedvirtual

Swaps the entries stored at index1 and index2.

Implements ogdf::internal::RegisteredArrayBase< Registry >.

Definition at line 583 of file RegisteredArray.h.

◆ valid()

template<class Registry , class Value >
bool ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::valid ( ) const
inline

Returns true iff the array is associated with a registry.

Definition at line 562 of file RegisteredArray.h.

Member Data Documentation

◆ m_data

template<class Registry , class Value >
vector_type ogdf::internal::RegisteredArrayWithoutDefaultOrIndexAccess< Registry, Value >::m_data
protected

Definition at line 455 of file RegisteredArray.h.


The documentation for this class was generated from the following file: