Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
PathArray< chunk_size > Class Template Reference

#include "lib/path-array.hpp"

Description

template<size_t chunk_size>
class lib::PathArray< chunk_size >

Abstraction for path-like topological coordinates.

A sequence of Literal strings, with array-like access and standard iteration. Implemented as fixed size inline tuple with heap allocated unlimited extension space.

Note
contents are normalised on initialisation
  • leading empty elements are filled with Symbol::EMPTY
  • empty elements in the middle are replaced by "*"
  • trailing empty elements and "*" are trimmed

Definition at line 225 of file path-array.hpp.

Classes

struct  Split
 

Public Types

using const_iterator = lib::IterAdapter< Literal const *, PathArray const * >
 
using iterator = const_iterator
 
using value_type = Literal
 
using reference = Literal &
 
using const_reference = Literal const &
 

Public Member Functions

template<typename... ARGS>
 PathArray (ARGS &&...args)
 
 PathArray (PathArray &&)=default
 
 PathArray (PathArray const &)=default
 
 PathArray (PathArray &o)
 
PathArrayoperator= (PathArray const &)=default
 
PathArrayoperator= (PathArray &&)=default
 
size_t size () const
 
size_t leafLevel () const
 
bool empty () const
 
 operator string () const
 joins nonempty content, separated by slash
 
Literal const & operator[] (size_t idx) const
 Array style indexed access.
 
size_t indexOf (Literal const &content) const
 reverse lookup of actual path content
 
iterator begin () const
 
iterator end () const
 

Friends

void iterNext (const PathArray *, const Literal *&pos)
 Implementation of Iteration-logic: pull next element.
 
bool checkPoint (const PathArray *src, const Literal *&pos)
 Implementation of Iteration-logic: detect iteration end.
 
iterator begin (PathArray const &pa)
 
iterator end (PathArray const &pa)
 

Protected Member Functions

LiteralgetPosition (size_t idx)
 
LiteralexpandPosition (size_t idx)
 
void setContent (Literal *pos, const char *val)
 
void truncateTo (size_t newSize)
 
void normalise ()
 establish the contract of PathArray
 

Private Types

using LiteralArray = std::array< Literal, chunk_size >
 

Private Member Functions

template<size_t... prefix, size_t... rest, typename... ARGS>
 PathArray (IndexSeq< prefix... >, IndexSeq< rest... >, ARGS &&...args)
 
bool isValid (Literal const *pos) const
 
iterator firstNonempty () const
 
Literal const * findInlineEnd () const
 find effective end of data in the inline array, i.e.
 

Private Attributes

LiteralArray elms_
 
con::Extension tail_
 

Constructor & Destructor Documentation

◆ PathArray() [1/5]

template<size_t chunk_size>
template<size_t... prefix, size_t... rest, typename... ARGS>
PathArray ( IndexSeq< prefix... >  ,
IndexSeq< rest... >  ,
ARGS &&...  args 
)
inlineprivate

delegate ctor to place the initialiser arguments appropriately

Remarks
the two index sequences passed by pattern match determine which arguments go to the inline array, and which go to heap allocated extension. The inline array has fixed size an is thus filled with trailing NULL ptrs, which is achieved with the help of meta::pickInit(). The con::Extension is an embedded smart-ptr, which, when receiving additional tail arguments, will place and manage them within a heap allocated array.

Definition at line 244 of file path-array.hpp.

References PathArray< chunk_size >::normalise().

+ Here is the call graph for this function:

◆ PathArray() [2/5]

template<size_t chunk_size>
template<typename... ARGS>
PathArray ( ARGS &&...  args)
inlineexplicit

Definition at line 269 of file path-array.hpp.

◆ PathArray() [3/5]

template<size_t chunk_size>
PathArray ( PathArray< chunk_size > &&  )
default

◆ PathArray() [4/5]

template<size_t chunk_size>
PathArray ( PathArray< chunk_size > const &  )
default

◆ PathArray() [5/5]

template<size_t chunk_size>
PathArray ( PathArray< chunk_size > &  o)
inline

Definition at line 277 of file path-array.hpp.


Class Documentation

◆ lib::PathArray::Split

struct lib::PathArray::Split
Class Members
typedef Ascending Prefix
typedef template After< chunk_size > Rest
+ Collaboration diagram for PathArray< chunk_size >::Split< ARGS >:

Member Typedef Documentation

◆ LiteralArray

template<size_t chunk_size>
using LiteralArray = std::array<Literal, chunk_size>
private

Definition at line 229 of file path-array.hpp.

◆ const_iterator

template<size_t chunk_size>
using const_iterator = lib::IterAdapter<Literal const*, PathArray const*>

Definition at line 371 of file path-array.hpp.

◆ iterator

template<size_t chunk_size>
using iterator = const_iterator

Definition at line 372 of file path-array.hpp.

◆ value_type

template<size_t chunk_size>
using value_type = Literal

Definition at line 374 of file path-array.hpp.

◆ reference

template<size_t chunk_size>
using reference = Literal&

Definition at line 375 of file path-array.hpp.

◆ const_reference

template<size_t chunk_size>
using const_reference = Literal const&

Definition at line 376 of file path-array.hpp.

Member Function Documentation

◆ operator=() [1/2]

template<size_t chunk_size>
PathArray & operator= ( PathArray< chunk_size > const &  )
default

◆ operator=() [2/2]

template<size_t chunk_size>
PathArray & operator= ( PathArray< chunk_size > &&  )
default

◆ size()

◆ leafLevel()

template<size_t chunk_size>
size_t leafLevel ( ) const
inline

Definition at line 291 of file path-array.hpp.

References PathArray< chunk_size >::empty(), and PathArray< chunk_size >::size().

Referenced by TestElementAccess::performAccessTo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty()

template<size_t chunk_size>
bool empty ( ) const
inline

Definition at line 297 of file path-array.hpp.

References PathArray< chunk_size >::elms_.

Referenced by UICoord::Builder::empty(), and PathArray< chunk_size >::leafLevel().

+ Here is the caller graph for this function:

◆ operator string()

template<size_t chunk_size>
operator string ( ) const
inline

joins nonempty content, separated by slash

Definition at line 535 of file path-array.hpp.

◆ operator[]()

template<size_t chunk_size>
Literal const & operator[] ( size_t  idx) const
inline

Array style indexed access.

Exceptions
error::Invalidon bound violation
Returns
reference to the normalised content
Note
returns Symbol::EMPTY for leading empty elements, even while iteration will skip such entries.

Definition at line 313 of file path-array.hpp.

References PathArray< chunk_size >::size(), and util::toString().

+ Here is the call graph for this function:

◆ indexOf()

template<size_t chunk_size>
size_t indexOf ( Literal const &  content) const
inline

reverse lookup of actual path content

Parameters
contentreference to actual content residing within the path
Returns
index position of the content within the path
Exceptions
error::Invalidwhen the given storage location is outside the data content storage of this path

Definition at line 330 of file path-array.hpp.

References PathArray< chunk_size >::elms_, Extension::indexOf(), Extension::isValid(), PathArray< chunk_size >::tail_, and util::toString().

Referenced by UICoordResolver::extend(), and PathArray_test::verify_iteration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ begin()

template<size_t chunk_size>
iterator begin ( ) const
inline
Remarks
iteration is defined to begin with real content

Definition at line 379 of file path-array.hpp.

References PathArray< chunk_size >::firstNonempty().

Referenced by UICoordResolver::extend(), lib::operator==(), and PathArray_test::verify_iteration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end()

template<size_t chunk_size>
iterator end ( ) const
inline

Definition at line 380 of file path-array.hpp.

Referenced by PathArray< chunk_size >::normalise(), and PathArray< chunk_size >::truncateTo().

+ Here is the caller graph for this function:

◆ isValid()

template<size_t chunk_size>
bool isValid ( Literal const *  pos) const
inlineprivate

Definition at line 390 of file path-array.hpp.

References PathArray< chunk_size >::elms_, Extension::isValid(), and PathArray< chunk_size >::tail_.

+ Here is the call graph for this function:

◆ firstNonempty()

template<size_t chunk_size>
iterator firstNonempty ( ) const
inlineprivate

Definition at line 399 of file path-array.hpp.

References PathArray< chunk_size >::elms_.

Referenced by PathArray< chunk_size >::begin().

+ Here is the caller graph for this function:

◆ findInlineEnd()

template<size_t chunk_size>
Literal const * findInlineEnd ( ) const
inlineprivate

find effective end of data in the inline array, i.e.

the position behind the last usable content

Definition at line 412 of file path-array.hpp.

References PathArray< chunk_size >::elms_.

Referenced by PathArray< chunk_size >::size().

+ Here is the caller graph for this function:

◆ getPosition()

template<size_t chunk_size>
Literal * getPosition ( size_t  idx)
inlineprotected

access content element by index

Returns
pointer to storage, null if out of bounds

Definition at line 429 of file path-array.hpp.

References PathArray< chunk_size >::elms_, Extension::size(), and PathArray< chunk_size >::tail_.

Referenced by PathArray< chunk_size >::normalise(), and PathArray< chunk_size >::truncateTo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expandPosition()

template<size_t chunk_size>
Literal * expandPosition ( size_t  idx)
inlineprotected

ensure storage for the indicated position exists

Returns
pointer to the storage, either existing or reallocated

Definition at line 446 of file path-array.hpp.

References PathArray< chunk_size >::elms_, Extension::resizeTo(), PathArray< chunk_size >::size(), Extension::size(), and PathArray< chunk_size >::tail_.

Referenced by UICoord::Builder::overwrite().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContent()

template<size_t chunk_size>
void setContent ( Literal pos,
const char *  val 
)
inlineprotected

force new content into the given entry

Definition at line 459 of file path-array.hpp.

Referenced by PathArray< chunk_size >::normalise(), UICoord::Builder::overwrite(), and PathArray< chunk_size >::truncateTo().

+ Here is the caller graph for this function:

◆ truncateTo()

template<size_t chunk_size>
void truncateTo ( size_t  newSize)
inlineprotected

Definition at line 466 of file path-array.hpp.

References PathArray< chunk_size >::elms_, PathArray< chunk_size >::end(), PathArray< chunk_size >::getPosition(), Extension::resizeTo(), PathArray< chunk_size >::setContent(), Extension::size(), and PathArray< chunk_size >::tail_.

Referenced by UICoord::Builder::truncateTo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalise()

template<size_t chunk_size>
void normalise ( )
inlineprotected

establish the contract of PathArray

  • no null pointer within the valid storage range
  • storage is precisely trimmed at the end
  • missing leading elements are filled with Symbol::EMPTY
  • missing inner elements are interpolated as "*"

Definition at line 491 of file path-array.hpp.

References Symbol::ANY, PathArray< chunk_size >::elms_, Symbol::EMPTY, PathArray< chunk_size >::end(), PathArray< chunk_size >::getPosition(), Extension::resizeTo(), PathArray< chunk_size >::setContent(), PathArray< chunk_size >::size(), Extension::size(), and PathArray< chunk_size >::tail_.

Referenced by PathArray< chunk_size >::PathArray(), and UICoord::Builder::normalise().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ elms_

◆ tail_

Friends And Related Symbol Documentation

◆ iterNext

template<size_t chunk_size>
void iterNext ( const PathArray< chunk_size > *  ,
const Literal *&  pos 
)
friend

Implementation of Iteration-logic: pull next element.

Definition at line 347 of file path-array.hpp.

◆ checkPoint

template<size_t chunk_size>
bool checkPoint ( const PathArray< chunk_size > *  src,
const Literal *&  pos 
)
friend

Implementation of Iteration-logic: detect iteration end.

Definition at line 354 of file path-array.hpp.

◆ begin

template<size_t chunk_size>
iterator begin ( PathArray< chunk_size > const &  pa)
friend

Definition at line 382 of file path-array.hpp.

◆ end

template<size_t chunk_size>
iterator end ( PathArray< chunk_size > const &  pa)
friend

Definition at line 383 of file path-array.hpp.

+ Inheritance diagram for PathArray< chunk_size >:
+ Collaboration diagram for PathArray< chunk_size >:

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