Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
SkipListSupport.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
5#ifndef _Stroika_Foundation_Containers_Private_SkipListSupport_h_
6#define _Stroika_Foundation_Containers_Private_SkipListSupport_h_
7
8#include "Stroika/Foundation/StroikaPreComp.h"
9
10#include "Stroika/Foundation/Common/Common.h"
11
12#include "Stroika/Foundation/Containers/Common.h"
13#include "Stroika/Foundation/Containers/DataStructures/SkipList.h"
14
15/**
16 * \file
17 * support classes for Concrete classes 'extensions' of behavior specific to the SkipList data structure
18 */
19
21
22 /**
23 * \brief SkipListBasedContainer is a Stroika implementation detail, but its public methods are fair game and fully supported (as used in subclasses)
24 *
25 * This mechanism allows all the array based concrete containers (such as Set_SkipList, Sequence_SkipList) to all
26 * share the same API and implementation of the API access functions (ReBalance etc) but without
27 * any genericity implied in the API (just code sharing).
28 *
29 * \note bool USING_IREP:
30 * Can we just peek from SkipListBasedContainer<> into the fData_ and do the array operations? Yes, if Rep_ is not
31 * type-erased, but no otherwise. If we specify false, we can avoid putting references to the SkipListBasedContainerIRep
32 * into the vtable, and linking a bunch of often not used code. But if we've got extra template parameters to the Rep_,
33 * we cannot peek at it from this container, so must indirect.
34 */
35 template <typename THIS_CONTAINER, typename BASE_CONTAINER, bool USING_IREP>
36 class SkipListBasedContainer : public BASE_CONTAINER {
37 public:
38 /**
39 */
40 using BASE_CONTAINER::BASE_CONTAINER;
41
42 public:
43 /**
44 * \brief
45 */
46 nonvirtual void ReBalance ();
47 };
48
49 /**
50 * \brief impl detail for array based container support (see SkipListBasedContainer docs on bool USING_IREP)
51 */
52 template <typename CONTAINER_REP_BASE_CLASS>
53 class SkipListBasedContainerIRep : public CONTAINER_REP_BASE_CLASS {
54 public:
55 virtual void ReBalance () = 0;
56 };
57
58 /**
59 * \brief CRTP applied when SkipListBasedContainerIRep used
60 */
61 template <typename THIS_CONTAINER_REP, typename BASE_CONTAINER_REP>
62 class SkipListBasedContainerRepImpl : public BASE_CONTAINER_REP {
63 public:
64 /**
65 */
66 using BASE_CONTAINER_REP::BASE_CONTAINER_REP;
67 virtual void ReBalance () override;
68 };
69
70}
71
72/*
73 ********************************************************************************
74 ***************************** Implementation Details ***************************
75 ********************************************************************************
76 */
77#include "SkipListSupport.inl"
78
79#endif /*_Stroika_Foundation_Containers_Private_SkipListSupport_h_ */
SkipListBasedContainer is a Stroika implementation detail, but its public methods are fair game and f...
impl detail for array based container support (see SkipListBasedContainer docs on bool USING_IREP)
CRTP applied when SkipListBasedContainerIRep used.