Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Type system #54

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
b0d77f6
Begin type system refactoring
Aug 29, 2017
0f06c14
Add function to retrieve the element type of a type (for arrays and c…
Aug 29, 2017
ee42a58
Small changes
Aug 29, 2017
bc0aa0d
Implement type conversions
Aug 29, 2017
3f6ead5
Add map interface to type system
Aug 30, 2017
7982fcf
Implement map type
Aug 30, 2017
f2ae655
Rewrite generic type
Aug 30, 2017
2bf89f6
Implement enum type
Aug 31, 2017
d67a657
Implement new Variant
Aug 31, 2017
e4bddae
Implement ManagedValue, add signal to Value
Sep 2, 2017
9d31fa2
Clean up, add missing documentation
Sep 2, 2017
bec9f67
Move symbolic names into abstract type interface
Sep 5, 2017
e7808c7
Introduce MetaType
scheibel Sep 5, 2017
57b6e65
Merge branch 'type_system' of github.com:cginternals/cppexpose into t…
scheibel Sep 5, 2017
d6a9ae8
Reconstruct previous commit
scheibel Sep 5, 2017
f1d686d
Add isNull to AbstractType, fix virtual interface in Variant2
Sep 5, 2017
56222a6
Remove old type system
Sep 6, 2017
d2ffdc2
Rename Variant2 -> Variant
Sep 6, 2017
29b1e4f
Rename Value and ManagedValue to InternalValue and ExternalValue
Sep 6, 2017
c4c1675
Rename Type -> TypedType
Sep 6, 2017
99d9178
Add new class Type (also uploaded unfinished property classes)
Sep 6, 2017
6e524ca
Implement Type (WIP)
Sep 7, 2017
74a8e1c
Rename Typed -> AbstractTyped
Sep 8, 2017
a43277d
Small documentation change
Sep 8, 2017
b671a6d
Add type system plan as text file
Sep 8, 2017
c0bf2c8
Rename type classes
Sep 8, 2017
02a4b10
Split directories for types and values
Sep 8, 2017
0310f62
Implement copy-on-change paradigm for Type
Sep 8, 2017
56f8515
Return element type for containers, add implementation helper for con…
Sep 8, 2017
4229263
Improve documentation, fix order of functions, fix pointer types
Sep 8, 2017
a2b8479
Create class ConcreteType
Sep 8, 2017
5c792e3
Add min and max values for numbers, give access to typed functions in…
Sep 8, 2017
2675820
Restructure value types
Sep 9, 2017
89f91e3
Small changes in Variant
Sep 9, 2017
56fa332
Add untyped interface for minimum and maximum values
Sep 9, 2017
4339575
Fix order of functions
Sep 9, 2017
5e7d6a5
Write TODO list
Sep 9, 2017
29f4b30
Implement hasType() in AbstractTyped
Sep 9, 2017
6cfa2f2
Implement use of named values in toString/fromString
Sep 10, 2017
58b15d7
Derive BaseType<const T> from BaseType<T> to avoid code duplication
Sep 10, 2017
3abd05b
Add element setters and getters for external array values
Sep 10, 2017
66daae7
Implement untyped access functions for arrays and maps
Sep 10, 2017
0ef9bda
Add map access functions to ExternalValue, use default values in cons…
Sep 10, 2017
5742ef8
Make sure that type options are copied when a type is cloned
Sep 10, 2017
0aadba0
Add accessor to abstract base type to typed objects
Sep 10, 2017
c758e7a
Implement type comparison
Sep 10, 2017
1ca5ce2
Update TODOs
Sep 10, 2017
ac48dcc
Implement variant comparison
Sep 10, 2017
382a8e7
Implement Property
Sep 11, 2017
a88103c
Review Object
Sep 11, 2017
d33a1e2
Add constructor to create a Property with getter and setter methods
Sep 11, 2017
245d875
Merge functions to create dynamic properties into one (createProperty)
Sep 11, 2017
9f52beb
Review
scheibel Sep 12, 2017
3d5dd55
Use using instead of typedef
scheibel Sep 12, 2017
1c5e5df
Add array access methods to Variant
Sep 12, 2017
ea32cab
Merge branch 'type_system' of github.com:cginternals/cppexpose into t…
Sep 12, 2017
2d81649
Review review :)
Sep 12, 2017
9c6919f
Create type-system header
Sep 12, 2017
81e44a2
Port JSON.cpp to new interfaces
Sep 12, 2017
2dc8001
Start hh header splitup
scheibel Sep 12, 2017
6fa2aa7
Continue type refactoring
scheibel Sep 14, 2017
4b4b25a
Add toVariant and fromVariant
scheibel Sep 15, 2017
9bbcfe1
Add toString convenience accessor
scheibel Sep 15, 2017
2988886
Reenable scripting
scheibel Sep 15, 2017
36a7ca0
Introduce pointer type
scheibel Sep 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/cppexpose type system.scite
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cppexpose Typen-System

Im cppexpose Typen-System sollen folgende Grundkonzepte existieren:

- Werte: atomare, vergleichbare Elemente aus einem Wertebereich
- Wert-Container: Wrapper, welche einen Wert und dessen Typ haben
- Fremdwert-Container: Wert-Container, welcher abstrahiert den Zugriff auf einen fremdverwalteten Wert bietet
- Typen: Definition eines Wertebereich
- MetaTyp: Der Typ eines jeden Typs
-

- Variant: Ein Werte-Container mit undefiniertem Typ und einem Wert
- Property: Sicht auf einen extern verwalteten Werte-Container
- Slot: Wert-Container mit Fähigkeiten zur Update-Verwaltung von Werten

Und folgende Eigenschaften gelten:

- Werte *sind* implizit durch POD Datentypen aus C++ dargestellt
- Werte *haben* einen Typ, welcher implizit modelliert wird (wer mit Werten arbeitet, kennt ihren Typ, ansonsten muss er mit Wert-Containern arbeiten)
- Notwendige Operationen auf Werten sind Gleichheit und Unterschiedlichkeit

- Wert-Container *haben* einen Typ
- Wert-Container *haben* einen Wert, der sich *ändern* kann
- Wert-Container *sind* keine Werte oder Typen

- Wert-Container können Zugriff auf Subelemente eines Werts geben (z.B. Array, Vector und Map Werte)

- Fremdwert-Container *sind* Wert-Container

- Typen *sind* Werte
- Typen *haben* Eigenschaften, welche ihren Wertebereich beschreiben (Minimum, Maximum, Werteliste, ...)
- Typen *haben* Annotationen, falls der Wertebereich unstrukturiert beschrieben werden muss (ist ein Variant)
- Der Typ eines jeden Typs ist der Meta-Typ
- Der Typ von einem Meta-Typ ist der Meta-Typ
- Wenn Wert-Container einen Typ als Wert halten sollen, müssen sie den Typ eines Typs *haben* (z.B. Meta-Typ)

- Der Meta-Typ ist der Typ mit dem Wertebereich aller Typen (inklusive sich selbst?)

- Variants *sind* Werte, aber keine Werte-Container oder Typen
- Variants *haben* einen aktuellen Werte-Typ und einen aktuellen Wert (kann evtl. durch Werte-Container abgedeckt sein)
- Variants *haben* den Typ Variant-Typ

Evtl. zu bedenken:
- Man kann Typen erstellen, welche als Wertebereich Typen haben (quasi Submengen von Meta-Typ)
1,220 changes: 1,220 additions & 0 deletions docs/diagrams/refactored-type-hierarchy.graphml

Large diffs are not rendered by default.

958 changes: 958 additions & 0 deletions docs/diagrams/type-hierarchy.graphml

Large diffs are not rendered by default.

177 changes: 102 additions & 75 deletions source/cppexpose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,67 +69,86 @@ set(headers
${include_path}/signal/Signal.h
${include_path}/signal/Signal.inl

${include_path}/typed/TypeInterface.h
${include_path}/typed/AbstractTyped.h
${include_path}/typed/AbstractTyped.hh
${include_path}/typed/AbstractTyped.inl
${include_path}/typed/GetTyped.h
${include_path}/typed/GetTyped.hh
${include_path}/typed/Typed.h
${include_path}/typed/Typed.hh
${include_path}/typed/Typed.inl
${include_path}/typed/TypedGeneric.h
${include_path}/typed/TypedGeneric.hh
${include_path}/typed/TypedGeneric.inl
${include_path}/typed/TypedBool.h
${include_path}/typed/TypedBool.hh
${include_path}/typed/TypedBool.inl
${include_path}/typed/TypedString.h
${include_path}/typed/TypedString.hh
${include_path}/typed/TypedString.inl
${include_path}/typed/TypedNumber.h
${include_path}/typed/TypedNumber.hh
${include_path}/typed/TypedNumber.inl
${include_path}/typed/TypedSignedIntegral.h
${include_path}/typed/TypedSignedIntegral.hh
${include_path}/typed/TypedSignedIntegral.inl
${include_path}/typed/TypedUnsignedIntegral.h
${include_path}/typed/TypedUnsignedIntegral.hh
${include_path}/typed/TypedUnsignedIntegral.inl
${include_path}/typed/TypedFloatingPoint.h
${include_path}/typed/TypedFloatingPoint.hh
${include_path}/typed/TypedFloatingPoint.inl
${include_path}/typed/TypedEnum.h
${include_path}/typed/TypedEnum.hh
${include_path}/typed/TypedEnum.inl
${include_path}/typed/TypedArray.h
${include_path}/typed/TypedArray.hh
${include_path}/typed/TypedArray.inl
${include_path}/typed/TypedVariant.h
${include_path}/typed/TypedVariant.hh
${include_path}/typed/TypedVariant.inl
${include_path}/typed/TypedFilePath.h
${include_path}/typed/TypedFilePath.hh
${include_path}/typed/TypedFilePath.inl
${include_path}/typed/DirectValue.h
${include_path}/typed/DirectValue.hh
${include_path}/typed/DirectValue.inl
${include_path}/typed/DirectValueSingle.h
${include_path}/typed/DirectValueSingle.hh
${include_path}/typed/DirectValueSingle.inl
${include_path}/typed/DirectValueArray.h
${include_path}/typed/DirectValueArray.hh
${include_path}/typed/DirectValueArray.inl
${include_path}/typed/StoredValue.h
${include_path}/typed/StoredValue.hh
${include_path}/typed/StoredValue.inl
${include_path}/typed/StoredValueSingle.h
${include_path}/typed/StoredValueSingle.hh
${include_path}/typed/StoredValueSingle.inl
${include_path}/typed/StoredValueArray.h
${include_path}/typed/StoredValueArray.hh
${include_path}/typed/StoredValueArray.inl
${include_path}/typed/typed_includes.inl
${include_path}/type/AbstractBaseType.h
${include_path}/type/AbstractBaseType.hh
${include_path}/type/AbstractTyped.h
${include_path}/type/AbstractTyped.hh
${include_path}/type/AbstractTyped.inl
${include_path}/type/BaseType.h
${include_path}/type/BaseType.hh
${include_path}/type/BaseType.inl
${include_path}/type/BaseTypeImpl.h
${include_path}/type/BaseTypeImpl.hh
${include_path}/type/BaseTypeImpl.inl
${include_path}/type/BaseTypeImplArray.h
${include_path}/type/BaseTypeImplArray.hh
${include_path}/type/BaseTypeImplArray.inl
${include_path}/type/BaseTypeImplMap.h
${include_path}/type/BaseTypeImplMap.hh
${include_path}/type/BaseTypeImplMap.inl
${include_path}/type/BaseTypeImplBool.h
${include_path}/type/BaseTypeImplBool.hh
${include_path}/type/BaseTypeImplBool.inl
${include_path}/type/BaseTypeImplEnum.h
${include_path}/type/BaseTypeImplEnum.hh
${include_path}/type/BaseTypeImplEnum.inl
${include_path}/type/BaseTypeImplFloatingPoint.h
${include_path}/type/BaseTypeImplFloatingPoint.hh
${include_path}/type/BaseTypeImplFloatingPoint.inl
${include_path}/type/BaseTypeImplGeneric.h
${include_path}/type/BaseTypeImplGeneric.hh
${include_path}/type/BaseTypeImplGeneric.inl
${include_path}/type/BaseTypeImplNumber.h
${include_path}/type/BaseTypeImplNumber.hh
${include_path}/type/BaseTypeImplNumber.inl
${include_path}/type/BaseTypeImplPointer.h
${include_path}/type/BaseTypeImplPointer.hh
${include_path}/type/BaseTypeImplPointer.inl
${include_path}/type/BaseTypeImplSignedIntegral.h
${include_path}/type/BaseTypeImplSignedIntegral.hh
${include_path}/type/BaseTypeImplSignedIntegral.inl
${include_path}/type/BaseTypeImplString.h
${include_path}/type/BaseTypeImplString.hh
${include_path}/type/BaseTypeImplString.inl
${include_path}/type/BaseTypeImplUnsignedIntegral.h
${include_path}/type/BaseTypeImplUnsignedIntegral.hh
${include_path}/type/BaseTypeImplUnsignedIntegral.inl
${include_path}/type/BaseTypeImplVector.h
${include_path}/type/BaseTypeImplVector.hh
${include_path}/type/BaseTypeImplVector.inl
${include_path}/type/Converter.h
${include_path}/type/Converter.hh
${include_path}/type/Converter.inl
${include_path}/type/ConcreteType.h
${include_path}/type/ConcreteType.hh
${include_path}/type/ConcreteType.inl
${include_path}/type/EnumValues.h
${include_path}/type/EnumValues.hh
${include_path}/type/EnumValues.inl
${include_path}/type/GetType.h
${include_path}/type/GetType.hh
${include_path}/type/MetaType.h
${include_path}/type/MetaType.hh
${include_path}/type/NullType.h
${include_path}/type/NullType.hh
${include_path}/type/ObjectType.h
${include_path}/type/ObjectType.hh
${include_path}/type/Type.h
${include_path}/type/Type.hh
${include_path}/type/type_system.h

${include_path}/value/AbstractValueContainer.h
${include_path}/value/AbstractValueContainer.hh
${include_path}/value/AbstractValueContainer.inl
${include_path}/value/ValueContainer.h
${include_path}/value/ValueContainer.hh
${include_path}/value/ValueContainer.inl
${include_path}/value/ExternalValue.h
${include_path}/value/ExternalValue.hh
${include_path}/value/ExternalValue.inl
${include_path}/value/InternalValue.h
${include_path}/value/InternalValue.hh
${include_path}/value/InternalValue.inl

${include_path}/function/Function.h
${include_path}/function/AbstractFunction.h
Expand All @@ -140,23 +159,25 @@ set(headers
${include_path}/function/ConstMemberFunction.h
${include_path}/function/ConstMemberFunction.inl

${include_path}/variant/Variant.h
${include_path}/variant/Variant.hh
${include_path}/variant/Variant.inl

${include_path}/reflection/AbstractProperty.h
${include_path}/reflection/AbstractProperty.inl
${include_path}/reflection/AbstractProperty.hh
${include_path}/reflection/Object.h
${include_path}/reflection/Object.hh
${include_path}/reflection/Object.inl
${include_path}/reflection/Property.h
${include_path}/reflection/Property.hh
${include_path}/reflection/Property.inl
${include_path}/reflection/DynamicProperty.h
${include_path}/reflection/DynamicProperty.inl
${include_path}/reflection/Method.h
${include_path}/reflection/Variant.h
${include_path}/reflection/Variant.hh
${include_path}/reflection/Variant.inl
${include_path}/reflection/variant_helpers.h
${include_path}/reflection/variant_helpers.hh
${include_path}/reflection/variant_helpers.inl

${include_path}/scripting/ScriptContext.h
${include_path}/scripting/AbstractScriptBackend.h
${include_path}/scripting/example/TreeNode.h
# ${include_path}/scripting/example/TreeNode.h

${include_path}/plugin/ComponentManager.h
${include_path}/plugin/ComponentManager.inl
Expand All @@ -169,7 +190,7 @@ set(headers
${include_path}/plugin/Component.h
${include_path}/plugin/Component.inl
${include_path}/plugin/PluginLibrary.h
${include_path}/plugin/Example.h
# ${include_path}/plugin/Example.h
)

set(sources
Expand All @@ -183,22 +204,28 @@ set(sources
${source_path}/signal/Connection.cpp
${source_path}/signal/ScopedConnection.cpp

${source_path}/typed/TypeInterface.cpp
${source_path}/typed/AbstractTyped.cpp
${source_path}/type/AbstractBaseType.cpp
${source_path}/type/AbstractTyped.cpp
${source_path}/type/Converter.cpp
${source_path}/type/MetaType.cpp
${source_path}/type/NullType.cpp
${source_path}/type/ObjectType.cpp
${source_path}/type/Type.cpp

${source_path}/value/AbstractValueContainer.cpp

${source_path}/function/Function.cpp
${source_path}/function/AbstractFunction.cpp

${source_path}/variant/Variant.cpp

${source_path}/reflection/AbstractProperty.cpp
${source_path}/reflection/Object.cpp
${source_path}/reflection/Method.cpp
${source_path}/reflection/Variant.cpp

${source_path}/scripting/duktape-1.4.0/duktape.c
${source_path}/scripting/duktape-1.4.0/duktape.h
${source_path}/scripting/duktape-1.4.0/duk_config.h
${source_path}/scripting/example/TreeNode.cpp
# ${source_path}/scripting/example/TreeNode.cpp
${source_path}/scripting/ScriptContext.cpp
${source_path}/scripting/AbstractScriptBackend.cpp
${source_path}/scripting/DuktapeScriptBackend.cpp
Expand Down
2 changes: 1 addition & 1 deletion source/cppexpose/include/cppexpose/base/Tokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string>
#include <vector>

#include <cppexpose/variant/Variant.h>
#include <cppexpose/reflection/Variant.h>


namespace cppexpose
Expand Down
Loading