Lumiera  0.pre.03
»edit your freedom«
path-array.hpp File Reference

Go to the source code of this file.

Description

Foundation abstraction to implement path-like component sequences.

This library class can be used to build a path abstraction for data structure access or some similar topological coordinate system, like e.g. UI coordinates A PathArray is an iterable sequence of literal component IDs, implemented as tuple of lib::Literal held in fixed inline storage with possible heap allocated (and thus unlimited) extension storage. It offers range checks, standard iteration and array-like indexed component access; as a whole it is copyable, while actual components are immutable after construction. PathArray can be bulk initialised from an explicit sequence of literals; it is normalised on construction to trim and fill interspersed missing elements. Iteration and equality comparison are built on top of the normalisation; iteration starts with the first nonempty element.

Remarks
the choice of implementation layout is arbitrary and not based on evidence. A delegate structure with fixed inline storage looked like an interesting programming challenge. Using just a heap based array storage would have been viable likewise.
Todo:
when UICoord is in widespread use, collect performance statistics and revisit this design.
See also
PathArray_test
UICoord_test
stage::interact::UICoord
view-spec-dsl.hpp

Definition in file path-array.hpp.

#include "lib/error.hpp"
#include "lib/symbol.hpp"
#include "lib/iter-adapter.hpp"
#include "lib/meta/variadic-helper.hpp"
#include "lib/format-obj.hpp"
#include "lib/util.hpp"
#include <algorithm>
#include <utility>
#include <string>
#include <memory>
#include <array>

Classes

class  Extension
 Heap-allocated extension storage for an immutable sequence of literal strings. More...
 
class  PathArray< chunk_size >
 Abstraction for path-like topological coordinates. More...
 
struct  PathArray< chunk_size >::Split< ARGS >
 

Functions

template<size_t cl, size_t cr>
bool operator!= (PathArray< cl > const &l, PathArray< cr > const &r)
 
template<size_t cl, size_t cr>
bool operator== (PathArray< cl > const &l, PathArray< cr > const &r)
 Equality comparison of arbitrary PathArray objects.
 

Namespaces

 lib
 Implementation namespace for support and library code.
 

Class Documentation

◆ lib::PathArray::Split

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