Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Sequence_ChunkedArray.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Containers_Concrete_Sequence_ChunkedArray_h_
5#define _Stroika_Foundation_Containers_Concrete_Sequence_ChunkedArray_h_
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include "Stroika/Foundation/Containers/Sequence.h"
10
11/**
12 * \file
13 *
14 * \version NOT IMPLEMENTED
15 *
16 * TODO:
17 * @todo Idea is basically the same as Led::ChunkedArrayTextStore. Except that uses a vector of chunk
18 * pointers. It may be better to use a doubly linked list of Chunks? Unsure. Or maybe a tree (stl map)
19 * of chunks, so you can insert/remove them more easily.
20 *
21 * The Led (vector Chunk*) doesn't work well as you append lots of data to the end of the sequence (realloc).
22 *
23 * DoublyLinkedList of chunks with cache for some 'central' point can allow you to take advantage of typical
24 * locality of reference (searching/udpating in an area), and still have the performance benefits of no
25 * grand slowdown (except if you index outside that region, you get bad lookup behavior. BUt a tree
26 * structure might eliminate that problem too.. SkipList?
27 *
28 * One other thing HARDER about this comapred with the old LED code - was tha twe have to handle correclty
29 * manual item construction/destruciton (in Led we used chars and so could leave uninitiualized and not be
30 * careful about move etc).
31 */
32
34
35 /**
36 * \brief Sequence_SparseSortedMapping<T> is a sparse-Array-based concrete implementation of the Sequence<T> container pattern.
37 *
38 * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
39 *
40 */
41 template <typename T, size_t CHUNK_SIZE = 4096>
42 class Sequence_ChunckedArray : public Sequence<T> {
43 private:
44 using inherited = Sequence<T>;
45
46 public:
47 /**
48 * The only non-obvious parameter is 'sparseValue'. This is the special value used internally to
49 * make for the 'sparse' array. These particular values don't require storage.
50 *
51 * Note - this has no externally visible semantics: it just affects the storage usage, and perhaps
52 * performance.
53 */
56 template <typename CONTAINER_OF_T>
57 explicit Sequence_ChunckedArray (const CONTAINER_OF_T& s);
58 template <typename COPY_FROM_ITERATOR_OF_T>
59 explicit Sequence_ChunckedArray (COPY_FROM_ITERATOR_OF_T start, COPY_FROM_ITERATOR_OF_T end);
60
61 public:
62 nonvirtual Sequence_ChunckedArray<T>& operator= (const Sequence_ChunckedArray<T>& rhs);
63
64 private:
65 class Rep_;
66
67 private:
68 nonvirtual const Rep_& GetRep_ () const;
69 nonvirtual Rep_& GetRep_ ();
70 };
71}
72
73/*
74 ********************************************************************************
75 ******************************* Implementation Details *************************
76 ********************************************************************************
77 */
78
79//#include "Sequence_ChunckedArray.inl"
80
81#endif /*_Stroika_Foundation_Containers_Concrete_Sequence_ChunkedArray_h_ */
Sequence_SparseSortedMapping<T> is a sparse-Array-based concrete implementation of the Sequence<T> co...
A generalization of a vector: a container whose elements are keyed by the natural numbers.
Definition Sequence.h:187
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.