79 virtual void reinit(
int initTableSize) = 0;
86 if ((m_pGraph = pG) !=
nullptr) m_it = pG->
registerArray(
this);
96 if (m_pGraph !=
nullptr)
194 OGDF_DEPRECATED(
"NodeArrays should be indexed by a node, not an integer index.")
195 const T &operator[](
int index)
const 200 OGDF_DEPRECATED(
"NodeArrays should be indexed by a node, not an integer index.")
201 T &operator[](
int index)
virtual void enlargeTable(int newTableSize)
Virtual function called when table size has to be enlarged.
Abstract base class for node arrays.
virtual void reinit(int initTableSize)
Virtual function called when table has to be reinitialized.
The parameterized class Array implements dynamic arrays of type E.
T & operator[](node v)
Returns a reference to the element with index v.
node pred() const
Returns the predecessor in the list of all nodes.
NodeArray< T > & operator=(const NodeArray< T > &a)
Assignment operator.
Data type for general directed graphs (adjacency list representation).
void init()
Reinitializes the array. Associates the array with no graph.
void init()
Reinitializes the array to an array with empty index set.
INDEX high() const
Returns the maximal array index.
NodeArray(const NodeArray< T > &A)
Constructs a node array that is a copy of A.
node firstNode() const
Returns the first node in the list of all nodes.
static key_type findSuccKey(key_type key)
node succ() const
Returns the successor in the list of all nodes.
void reregister(const Graph *pG)
Associates the array with a new graph.
NodeArrayBase()
Initializes an node array not associated with a graph.
const_iterator cend() const
Returns a const iterator to one-past-last entry in the node array.
ListIterator< NodeArrayBase * > registerArray(NodeArrayBase *pNodeArray) const
Registers a node array.
void moveRegisterArray(ListIterator< ArrayBase *> it, ArrayBase *pArray) const
Move the registration it of an graph element array to pArray (used with move semantics for graph elem...
void moveRegister(NodeArrayBase &base)
Moves array registration from base to this array.
void unregisterArray(ListIterator< NodeArrayBase *> it) const
Unregisters a node array.
NodeArrayBase(const Graph *pG)
Initializes an node array associated with pG.
Dynamic arrays indexed with nodes.
const_iterator end() const
Returns a const iterator to one-past-last entry in the node array.
NodeArray(NodeArray< T > &&A)
Constructs a node array containing the elements of A (move semantics).
NodeArray(const Graph &G, const T &x)
Constructs a node array associated with G.
virtual void enlargeTable(int newTableSize)=0
Virtual function called when table size has to be enlarged.
virtual void disconnect()=0
Virtual function called when array is disconnected from the graph.
NodeArray< T > & operator=(NodeArray< T > &&a)
Assignment operator (move semantics).
virtual void reinit(int initTableSize)=0
Virtual function called when table has to be reinitialized.
T & operator()(node v)
Returns a reference to the element with index v.
NodeElement * node
The type of nodes.
ArrayIterator< ogdf::NodeArray< ogdf::NodeElement > > iterator
Provides a random-access iterator that can read or modify any element in an array.
Class for the representation of nodes.
bool valid() const
Returns true iff the array is associated with a graph.
const Graph * m_pGraph
The associated graph.
Encapsulates a pointer to a list element.
T m_x
The default value for array elements.
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
const T & move(const T &v)
void init(const Graph &G)
Reinitializes the array. Associates the array with G.
virtual void disconnect()
Virtual function called when array is disconnected from the graph.
Pure declaration header, find template implementation in Graph.h.
ListIterator< NodeArrayBase * > m_it
Pointer to list element in the list of all registered node arrays which references this array...
iterator end()
Returns an iterator to one-past-last entry in the node array.
int index() const
Returns the (unique) node index.
void resize(INDEX newSize, const E &x)
Resizes (enlarges or shrinks) the array to hold newSize elements and sets new elements to x...
NodeArray()
Constructs an empty node array associated with no graph.
ArrayConstIterator< ogdf::NodeArray< ogdf::NodeElement > > const_iterator
Provides a random-access iterator that can read a const element in an array.
int nodeArrayTableSize() const
Returns the table size of node arrays associated with this graph.
const_iterator begin() const
Returns a const iterator to the first entry in the node array.
iterator begin()
Returns an iterator to the first entry in the node array.
int maxNodeIndex() const
Returns the largest used node index.
const Graph * graphOf() const
Returns a pointer to the associated graph.
void init(const Graph &G, const T &x)
Reinitializes the array. Associates the array with G.
#define OGDF_DEPRECATED(reason)
Mark a class / member / function as deprecated.
Array< E, INDEX > & operator=(const Array< E, INDEX > &A)
Assignment operator.
const_reference operator[](INDEX i) const
Returns a reference to the element at position i.
void fill(const E &x)
Sets all elements to x.
The namespace for all OGDF objects.
static key_type findPredKey(key_type key)
const T & operator()(node v) const
Returns a reference to the element with index v.
NodeArrayBase(NodeArrayBase &base)
Moves node array base to this node array.
const T & operator[](node v) const
Returns a reference to the element with index v.
INDEX low() const
Returns the minimal array index.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
void fill(const T &x)
Sets all array elements to x.
const_iterator cbegin() const
Returns a const iterator to the first entry in the node array.
NodeArray(const Graph &G)
Constructs a node array associated with G.