You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: design/virtual table policy diagram.md
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,18 @@
2
2
3
3
## Note: Some of the identifiers in the framework come from very old times, when the concepts where more primitive.
4
4
5
+
## Terms
6
+
7
+
`template<typename Policy> AnyContainer<Policy>`: The type erasure wrapper/manager
8
+
Policy: A type that has members that configure `AnyContainer`.
9
+
For the sub-framework of virtual-table type switching, `zoo::Policy`, the user can specify the parameters of the local buffer and all the capabilities of the wrapper/manager:
10
+
`Policy<StorageModel, A1, A2, A2>` indicates that the local buffer has the size and alignment of `StorageModel`, typically some `void *[N]`. The `A`s are *affordances*, the capabilities of the
11
+
`AnyContainer` wrapper/manager.
12
+
The **implementation** uses the following members of a policy:
13
+
1.`MemoryLayout`: this is the **base value manager**. It's size and alignment are that of the `zoo::Policy` storage model.
14
+
2.`template<typename ValueToManage> Builder`: indicates the concrete value manager for the given type
15
+
3.`template<typename ConcreteAnyContainer> Affordances`: this provide bases from the affordances to the `AnyContainer`, this is how they add things to the interface of `AnyContainer`, via their template members `UserAffordance`, that use the CRTP [^user affordance CRTP]
16
+
5
17
## The base value manager
6
18
7
19
The *policy* tells `AnyContainer` what its local storage is going to be, via the member `MemoryLayout`. You may think of the "Memory Layout" as the base ***value manager***.
@@ -26,3 +38,10 @@ The most important feature of this flavor of the framework is to use virtual tab
[^user affordance CRTP]: The curiously recurring template pattern accomplishes the following:
42
+
For `AnyContainer<Policy<StorageModel, A1, A2, A2>>`:
43
+
```c++
44
+
using M = AnyContainer<Policy<StorageModel, A1, A2, A2>>;
45
+
```
46
+
then `A1::UserAffordance<M>` is a base class of `M`; if there is a function member `std::string stringize() const` in `A1::UserAffordance<M>`, then for an object `m` of `M`, you can invoke `m.stringize()`.
0 commit comments