├── .gitignore
├── .travis.yml
├── Build
├── Readme.md
├── build.bat
├── build.sh
└── verpatch.exe
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Documentation
├── IDL.md
└── images
│ ├── ACT_logo_50px.png
│ ├── O.png
│ ├── O32.png
│ ├── Tick.png
│ ├── Tick32.png
│ ├── X.png
│ ├── X32.png
│ ├── element_binding.png
│ ├── element_bindings.png
│ ├── element_class.png
│ ├── element_component.png
│ ├── element_enum.png
│ ├── element_error.png
│ ├── element_errors.png
│ ├── element_functiontype.png
│ ├── element_global.png
│ ├── element_implementation.png
│ ├── element_implementations.png
│ ├── element_importcomponent.png
│ ├── element_license.png
│ ├── element_line.png
│ ├── element_member.png
│ ├── element_method.png
│ ├── element_option.png
│ ├── element_param.png
│ ├── element_struct.png
│ ├── type_export.png
│ └── type_functiontype.png
├── Examples
├── Calculator
│ ├── Calculator.xml
│ └── Calculator_component
│ │ ├── Bindings
│ │ ├── CppDynamic
│ │ │ ├── calculator_abi.hpp
│ │ │ ├── calculator_dynamic.h
│ │ │ ├── calculator_dynamic.hpp
│ │ │ └── calculator_types.hpp
│ │ ├── Pascal
│ │ │ └── Unit_Calculator.pas
│ │ └── Python
│ │ │ └── Calculator.py
│ │ ├── Examples
│ │ ├── CppDynamic
│ │ │ ├── CMakeLists.txt
│ │ │ └── Calculator_example.cpp
│ │ ├── Pascal
│ │ │ ├── Calculator_Example.lpi
│ │ │ └── Calculator_Example.lpr
│ │ └── Python
│ │ │ └── Calculator_Example.py
│ │ └── Implementations
│ │ ├── Cpp
│ │ ├── Interfaces
│ │ │ ├── calculator_abi.hpp
│ │ │ ├── calculator_interfaceexception.cpp
│ │ │ ├── calculator_interfaceexception.hpp
│ │ │ ├── calculator_interfaces.hpp
│ │ │ ├── calculator_interfacewrapper.cpp
│ │ │ └── calculator_types.hpp
│ │ └── Stub
│ │ │ ├── calculator.cpp
│ │ │ ├── calculator_base.cpp
│ │ │ ├── calculator_base.hpp
│ │ │ ├── calculator_calculator.cpp
│ │ │ ├── calculator_calculator.hpp
│ │ │ ├── calculator_variable.cpp
│ │ │ └── calculator_variable.hpp
│ │ └── Pascal
│ │ ├── Interfaces
│ │ ├── calculator.lpr
│ │ ├── calculator_exception.pas
│ │ ├── calculator_exports.pas
│ │ ├── calculator_interfaces.pas
│ │ └── calculator_types.pas
│ │ ├── Stub
│ │ ├── calculator_impl.pas
│ │ ├── calculator_impl_base.pas
│ │ ├── calculator_impl_calculator.pas
│ │ └── calculator_impl_variable.pas
│ │ ├── calculator.def
│ │ └── calculator.lpi
├── Injection
│ ├── Calculation.xml
│ ├── Calculation_component
│ │ ├── Bindings
│ │ │ ├── Cpp
│ │ │ │ ├── calculation_abi.hpp
│ │ │ │ ├── calculation_implicit.hpp
│ │ │ │ └── calculation_types.hpp
│ │ │ ├── CppDynamic
│ │ │ │ ├── calculation_abi.hpp
│ │ │ │ ├── calculation_dynamic.h
│ │ │ │ ├── calculation_dynamic.hpp
│ │ │ │ └── calculation_types.hpp
│ │ │ ├── Pascal
│ │ │ │ └── Unit_Calculation.pas
│ │ │ └── Python
│ │ │ │ └── Calculation.py
│ │ ├── Examples
│ │ │ ├── Cpp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── Calculation_example.cpp
│ │ │ ├── CppDynamic
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── Calculation_example.cpp
│ │ │ ├── Pascal
│ │ │ │ ├── Calculation_Example.lpi
│ │ │ │ └── Calculation_Example.lpr
│ │ │ └── Python
│ │ │ │ └── Calculation_Example.py
│ │ └── Implementations
│ │ │ ├── Cpp
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Interfaces
│ │ │ │ ├── calculation_abi.hpp
│ │ │ │ ├── calculation_interfaceexception.cpp
│ │ │ │ ├── calculation_interfaceexception.hpp
│ │ │ │ ├── calculation_interfaces.hpp
│ │ │ │ ├── calculation_interfacewrapper.cpp
│ │ │ │ └── calculation_types.hpp
│ │ │ └── Stub
│ │ │ │ ├── calculation.cpp
│ │ │ │ ├── calculation_base.cpp
│ │ │ │ ├── calculation_base.hpp
│ │ │ │ ├── calculation_calculator.cpp
│ │ │ │ └── calculation_calculator.hpp
│ │ │ └── Pascal
│ │ │ ├── Interfaces
│ │ │ ├── calculation.lpr
│ │ │ ├── calculation_exception.pas
│ │ │ ├── calculation_exports.pas
│ │ │ ├── calculation_interfaces.pas
│ │ │ └── calculation_types.pas
│ │ │ ├── Stub
│ │ │ ├── calculation_impl.pas
│ │ │ ├── calculation_impl_base.pas
│ │ │ └── calculation_impl_calculator.pas
│ │ │ ├── calculation.def
│ │ │ └── calculation.lpi
│ ├── Numbers.xml
│ ├── Numbers_component
│ │ ├── Bindings
│ │ │ ├── CppDynamic
│ │ │ │ ├── numbers_abi.hpp
│ │ │ │ ├── numbers_dynamic.h
│ │ │ │ ├── numbers_dynamic.hpp
│ │ │ │ └── numbers_types.hpp
│ │ │ ├── Pascal
│ │ │ │ └── Unit_Numbers.pas
│ │ │ └── Python
│ │ │ │ └── Numbers.py
│ │ └── Implementations
│ │ │ ├── Cpp
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Interfaces
│ │ │ │ ├── numbers_abi.hpp
│ │ │ │ ├── numbers_interfaceexception.cpp
│ │ │ │ ├── numbers_interfaceexception.hpp
│ │ │ │ ├── numbers_interfaces.hpp
│ │ │ │ ├── numbers_interfacewrapper.cpp
│ │ │ │ └── numbers_types.hpp
│ │ │ └── Stub
│ │ │ │ ├── numbers.cpp
│ │ │ │ ├── numbers_base.cpp
│ │ │ │ ├── numbers_base.hpp
│ │ │ │ ├── numbers_variable.cpp
│ │ │ │ └── numbers_variable.hpp
│ │ │ └── Pascal
│ │ │ ├── Interfaces
│ │ │ ├── numbers.lpr
│ │ │ ├── numbers_exception.pas
│ │ │ ├── numbers_exports.pas
│ │ │ ├── numbers_interfaces.pas
│ │ │ └── numbers_types.pas
│ │ │ ├── Stub
│ │ │ ├── numbers_impl.pas
│ │ │ ├── numbers_impl_base.pas
│ │ │ └── numbers_impl_variable.pas
│ │ │ ├── numbers.def
│ │ │ └── numbers.lpi
│ └── Readme.md
├── OptionalClass
│ ├── .gitignore
│ ├── OptClass_component
│ │ ├── Bindings
│ │ │ ├── Cpp
│ │ │ │ ├── optclass_abi.hpp
│ │ │ │ ├── optclass_implicit.hpp
│ │ │ │ └── optclass_types.hpp
│ │ │ ├── CppDynamic
│ │ │ │ ├── optclass_abi.hpp
│ │ │ │ ├── optclass_dynamic.h
│ │ │ │ ├── optclass_dynamic.hpp
│ │ │ │ └── optclass_types.hpp
│ │ │ ├── Go
│ │ │ │ ├── optclass._go
│ │ │ │ └── optclass_impl._go
│ │ │ ├── Pascal
│ │ │ │ └── Unit_OptClass.pas
│ │ │ └── Python
│ │ │ │ └── OptClass.py
│ │ ├── Examples
│ │ │ ├── Cpp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── OptClass_example.cpp
│ │ │ ├── CppDynamic
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── OptClass_example.cpp
│ │ │ ├── Go
│ │ │ │ └── OptClass_example._go
│ │ │ ├── Pascal
│ │ │ │ ├── OptClass_Example.lpi
│ │ │ │ └── OptClass_Example.lpr
│ │ │ └── Python
│ │ │ │ └── OptClass_Example.py
│ │ ├── Implementations
│ │ │ ├── Cpp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── Interfaces
│ │ │ │ │ ├── optclass_abi.hpp
│ │ │ │ │ ├── optclass_interfaceexception.cpp
│ │ │ │ │ ├── optclass_interfaceexception.hpp
│ │ │ │ │ ├── optclass_interfacejournal.cpp
│ │ │ │ │ ├── optclass_interfacejournal.hpp
│ │ │ │ │ ├── optclass_interfaces.hpp
│ │ │ │ │ ├── optclass_interfacewrapper.cpp
│ │ │ │ │ └── optclass_types.hpp
│ │ │ │ └── Stub
│ │ │ │ │ ├── optclass.cpp
│ │ │ │ │ ├── optclass_base.cpp
│ │ │ │ │ └── optclass_base.hpp
│ │ │ └── Pascal
│ │ │ │ ├── Interfaces
│ │ │ │ ├── optclass.lpr
│ │ │ │ ├── optclass_exception.pas
│ │ │ │ ├── optclass_exports.pas
│ │ │ │ ├── optclass_interfaces.pas
│ │ │ │ └── optclass_types.pas
│ │ │ │ ├── Stub
│ │ │ │ ├── optclass_impl.pas
│ │ │ │ └── optclass_impl_base.pas
│ │ │ │ ├── optclass.def
│ │ │ │ └── optclass.lpi
│ │ └── license.txt
│ ├── OptionalClass.xml
│ └── Readme.md
├── Primes
│ ├── .gitignore
│ ├── LibPrimes_component
│ │ ├── Bindings
│ │ │ ├── CDynamic
│ │ │ │ ├── libprimes_dynamic.cc
│ │ │ │ ├── libprimes_dynamic.h
│ │ │ │ └── libprimes_types.h
│ │ │ ├── CSharp
│ │ │ │ └── LibPrimes.cs
│ │ │ ├── Cpp
│ │ │ │ ├── libprimes_abi.hpp
│ │ │ │ ├── libprimes_implicit.hpp
│ │ │ │ └── libprimes_types.hpp
│ │ │ ├── CppDynamic
│ │ │ │ ├── libprimes_abi.hpp
│ │ │ │ ├── libprimes_dynamic.h
│ │ │ │ ├── libprimes_dynamic.hpp
│ │ │ │ └── libprimes_types.hpp
│ │ │ ├── Pascal
│ │ │ │ └── Unit_LibPrimes.pas
│ │ │ └── Python
│ │ │ │ └── LibPrimes.py
│ │ ├── Examples
│ │ │ ├── CDynamic
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── LibPrimes_example.c
│ │ │ ├── CSharp
│ │ │ │ ├── LibPrimes_Example.cs
│ │ │ │ ├── LibPrimes_Example.csproj
│ │ │ │ └── LibPrimes_Example.sln
│ │ │ ├── Cpp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── LibPrimes_example.cpp
│ │ │ ├── CppDynamic
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── LibPrimes_example.cpp
│ │ │ ├── Pascal
│ │ │ │ ├── LibPrimes_Example.lpi
│ │ │ │ └── LibPrimes_Example.lpr
│ │ │ └── Python
│ │ │ │ └── LibPrimes_Example.py
│ │ ├── Implementations
│ │ │ ├── Cpp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── Interfaces
│ │ │ │ │ ├── libprimes_abi.hpp
│ │ │ │ │ ├── libprimes_interfaceexception.cpp
│ │ │ │ │ ├── libprimes_interfaceexception.hpp
│ │ │ │ │ ├── libprimes_interfacejournal.cpp
│ │ │ │ │ ├── libprimes_interfacejournal.hpp
│ │ │ │ │ ├── libprimes_interfaces.hpp
│ │ │ │ │ ├── libprimes_interfacewrapper.cpp
│ │ │ │ │ └── libprimes_types.hpp
│ │ │ │ └── Stub
│ │ │ │ │ ├── libprimes.cpp
│ │ │ │ │ ├── libprimes_base.cpp
│ │ │ │ │ ├── libprimes_base.hpp
│ │ │ │ │ ├── libprimes_calculator.cpp
│ │ │ │ │ ├── libprimes_calculator.hpp
│ │ │ │ │ ├── libprimes_factorizationcalculator.cpp
│ │ │ │ │ ├── libprimes_factorizationcalculator.hpp
│ │ │ │ │ ├── libprimes_sievecalculator.cpp
│ │ │ │ │ └── libprimes_sievecalculator.hpp
│ │ │ └── Pascal
│ │ │ │ ├── Interfaces
│ │ │ │ ├── libprimes.lpr
│ │ │ │ ├── libprimes_exception.pas
│ │ │ │ ├── libprimes_exports.pas
│ │ │ │ ├── libprimes_interfaces.pas
│ │ │ │ └── libprimes_types.pas
│ │ │ │ ├── Stub
│ │ │ │ ├── libprimes_impl.pas
│ │ │ │ ├── libprimes_impl_base.pas
│ │ │ │ ├── libprimes_impl_calculator.pas
│ │ │ │ ├── libprimes_impl_factorizationcalculator.pas
│ │ │ │ └── libprimes_impl_sievecalculator.pas
│ │ │ │ ├── libprimes.def
│ │ │ │ └── libprimes.lpi
│ │ └── license.txt
│ ├── Tutorial.md
│ ├── libPrimes.xml
│ └── resources
│ │ ├── 310
│ │ └── libPrimes.xml
│ │ ├── 315
│ │ └── libPrimes.xml
│ │ ├── 510
│ │ └── libPrimes.xml
│ │ ├── 610
│ │ └── libPrimes.xml
│ │ └── VSProperties.png
├── UnitTest
│ ├── Project
│ │ ├── .gitignore
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ ├── Source
│ │ │ └── Custom
│ │ │ │ ├── libunittest_implementation.cpp
│ │ │ │ ├── libunittest_implementation_testclass.cpp
│ │ │ │ └── libunittest_implementation_testclass.hpp
│ │ └── libUnitTest
│ │ │ └── main.cpp
│ └── libUnitTest.xml
└── Version
│ ├── libVersion.1.1.0.xml
│ ├── libVersion.1.2.0.xml
│ ├── libVersion.1.3.0.xml
│ ├── libVersion.2.0.0.xml
│ ├── libVersion.3.0.0.xml
│ ├── libVersion.3.1.0.xml
│ ├── libVersion.4.0.0.xml
│ ├── libVersion.4.1.0.xml
│ ├── libVersion.4.2.0.xml
│ └── libVersion.xml
├── LICENSE.md
├── README.md
├── Source
├── .gitignore
├── ACT.xsd
├── actutils.go
├── automaticcomponenttoolkit.go
├── buildbindingccpp.go
├── buildbindingcsharp.go
├── buildbindinggo.go
├── buildbindingnode.go
├── buildbindingpascal.go
├── buildbindingpython.go
├── buildimplementationcpp.go
├── buildimplementationpascal.go
├── componentdefinition.go
├── componentdiff.go
├── languagec.go
├── languagecpp.go
├── languagepascal.go
└── languagewriter.go
├── act.arm.linux32
├── act.arm.linux64
├── act.linux32
├── act.linux64
└── go.mod
/.gitignore:
--------------------------------------------------------------------------------
1 | *.cpp
2 | *.hpp
3 | *.h
4 | *.exe
5 | *.linux
6 | *.darwin
7 | *.exe
8 | *.c
9 | *.go
10 | *.orig
11 |
12 | # Visual Studio Code
13 | debug
14 | .vscode
15 |
16 | *_headers
17 | *_component
18 |
19 | Examples/*.xml
20 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # Configuration file for Travis CI (https://travis-ci.org)
2 | #
3 | # It used as a status check for all PRs and
4 | # to generate the build-status-icon in the main README.md-file.
5 |
6 | language: go
7 |
8 | go:
9 | - 1.11.x
10 |
11 | matrix:
12 | include:
13 | - os: linux
14 | compiler: gcc
15 | - os: osx
16 | osx_image: xcode7.2
17 |
18 | before_script:
19 | - cd Build
20 |
21 | script:
22 | - sh build.sh
23 |
--------------------------------------------------------------------------------
/Build/Readme.md:
--------------------------------------------------------------------------------
1 | # Release process for ACT
2 |
3 | 1. Create Release branch
4 |
5 | 2. Prepare tutorial etc
6 |
7 | 3. (optional) Pre-release RC, gather feedback + fix stuff
8 |
9 | 4. Modify release branch such that all links point to the master-branch/Actual.Version.Number
10 |
11 | 5. build:
12 |
13 | 1. Update the properties of the target act.exe by adapting the call to `build/verpatch.exe ...` in `build/build.bat`
14 |
15 | 2. `build/build.bat`
16 |
17 | 3. Ensure the binary's properties are suitable
18 |
19 | 4. sign act.exe
20 |
21 | 6. Merge release branch into master (squash)
22 |
23 | 7. Create github release
24 |
25 | 8. Merge Release branch into develop (rebase or merge)
26 |
27 | 9. Update paths and version in all documents on develop branch
28 |
29 |
30 |
31 | __Notes__:
32 |
33 | verpatch.exe is an _amazing_ tool to change resource information in EXEs and DLLs
34 |
35 | https://github.com/pavel-a/ddverpatch/releases
36 |
37 | Call like this
38 | ```
39 | verpatch.exe ..\act.exe /high /va 1.5.0 /pv "1.5.0-RC1+buildnumber-5" /s copyright "(c) 2018-2019 ACT Developers" /s desc "ACT is a code generator for software components" /s productName "Automatic Component Toolkit"
40 | ```
--------------------------------------------------------------------------------
/Build/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set startingDir="%CD%"
3 | set basepath="%~dp0"
4 |
5 | cd %basepath%\..\Source
6 | set Sources=actutils.go automaticcomponenttoolkit.go buildbindingccpp.go buildbindingcsharp.go buildbindinggo.go buildbindingnode.go buildbindingpascal.go buildbindingpython.go buildimplementationcpp.go buildimplementationpascal.go componentdefinition.go componentdiff.go languagewriter.go languagec.go languagecpp.go languagepascal.go
7 | set GOARCH=amd64
8 |
9 | set GOOS=windows
10 | echo "Build act.exe"
11 | go build -o ..\act.exe %Sources%
12 |
13 | echo "Patching properties of act.exe"
14 | ..\build\verpatch ..\act.exe /high /va 1.6.0 /pv "1.6.0" /s copyright "(c) 2018-2019 ACT Developers" /s desc "ACT is a code generator for software components" /s productName "Automatic Component Toolkit"
15 |
16 | set GOOS=linux
17 | echo "Build act.linux"
18 | go build -o ..\act.linux %Sources%
19 |
20 | set GOOS=darwin
21 | echo "Build act.darwin"
22 | go build -o ..\act.darwin %Sources%
23 |
24 | cd %startingDir%
25 |
--------------------------------------------------------------------------------
/Build/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | startingpath="$(pwd)"
4 | basepath="$(cd "$(dirname "$0")" && pwd)"
5 | cd "$basepath/../Source"
6 |
7 | Sources="actutils.go automaticcomponenttoolkit.go buildbindingccpp.go buildbindingcsharp.go buildbindinggo.go buildbindingnode.go buildbindingpascal.go buildbindingpython.go buildimplementationcpp.go buildimplementationpascal.go componentdefinition.go componentdiff.go languagewriter.go languagec.go languagecpp.go languagepascal.go"
8 | GOARCH="amd64"
9 |
10 | echo "Build act.exe"
11 | GOOS="windows"
12 | go build -o ../act.exe $Sources
13 |
14 | echo "Build act.linux"
15 | GOOS="linux"
16 | go build -o ../act.linux $Sources
17 |
18 | echo "Build act.darwin"
19 | GOOS="darwin"
20 | go build -o ../act.darwin $Sources
21 |
22 | cd "$startingpath"
23 |
--------------------------------------------------------------------------------
/Build/verpatch.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Build/verpatch.exe
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributor's Guide
2 | The Automatic Component Toolkit is an open source project.
3 |
4 | Contributions are welcome and we are looking for people that can improve existing language bindings or create new bindings or implementation stubs.
5 |
6 | You can also contribute by reporting bugs in the [Issue tracker](../../issues), helping review pull requests, participate in discussions about issues and more.
7 |
8 | ## Filing issues
9 | 1. When filing an [issue](../../issues) to report errors or problems, make sure to answer these five questions:
10 | 1. Which version of ACT are you using?
11 | Run
`act.* -v`
to print ACT's version.
12 | 2. Which operating system, programming language(s) and development tools (compiler/interpreter) are you using?
13 | 3. What did you do?
14 | 4. What did you expect to see?
15 | 5. What did you see instead?
16 |
17 | 2. When contributing to this repository, please first discuss the change you wish to make via issue with the [maintainers](#maintainers) of this repository. This way, we can ensure that there is no overlap between contributions or internal development work.
18 |
19 | 3. Adhere to the [code of conduct](CODE_OF_CONDUCT.md).
20 |
21 | ## Submitting a pull request
22 | When ready to contribute, fork this repository and submit a pull request that references the issue it resolves. Be sure to include a clear and detailed description of the changes you've made so that we can verify them and eventually merge.
23 |
24 | ACT follows the [git-flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) branching model. New developments are integrated into the [develop](../../tree/develop)-branch. ACT's maintainers will create releases from the develop-branch when appropriate.
25 |
26 | __NOTE__ _Before your code can be accepted into the project you must also sign the Contributor License Agreement (CLA). Please contact the maintainers via automatic-component-toolkit.contributor.agreements@autodesk.com for a copy of the CLA._
27 |
28 |
29 | ## Maintainers
30 | Maintainers are responsible for responding to pull requests and issues, as well as guiding the direction of the project.
31 |
32 | We currently have two maintainers:
33 | - Alexander Oster alexander.oster@autodesk.com
34 | - Martin Weismann martin.weismann@autodesk.com
35 |
36 | If you've established yourself as an impactful contributor to the project, and are willing take on the extra work, we'd love to have your help maintaining it! Email the current maintainers for details.
37 |
--------------------------------------------------------------------------------
/Documentation/images/ACT_logo_50px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/ACT_logo_50px.png
--------------------------------------------------------------------------------
/Documentation/images/O.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/O.png
--------------------------------------------------------------------------------
/Documentation/images/O32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/O32.png
--------------------------------------------------------------------------------
/Documentation/images/Tick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/Tick.png
--------------------------------------------------------------------------------
/Documentation/images/Tick32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/Tick32.png
--------------------------------------------------------------------------------
/Documentation/images/X.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/X.png
--------------------------------------------------------------------------------
/Documentation/images/X32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/X32.png
--------------------------------------------------------------------------------
/Documentation/images/element_binding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_binding.png
--------------------------------------------------------------------------------
/Documentation/images/element_bindings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_bindings.png
--------------------------------------------------------------------------------
/Documentation/images/element_class.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_class.png
--------------------------------------------------------------------------------
/Documentation/images/element_component.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_component.png
--------------------------------------------------------------------------------
/Documentation/images/element_enum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_enum.png
--------------------------------------------------------------------------------
/Documentation/images/element_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_error.png
--------------------------------------------------------------------------------
/Documentation/images/element_errors.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_errors.png
--------------------------------------------------------------------------------
/Documentation/images/element_functiontype.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_functiontype.png
--------------------------------------------------------------------------------
/Documentation/images/element_global.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_global.png
--------------------------------------------------------------------------------
/Documentation/images/element_implementation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_implementation.png
--------------------------------------------------------------------------------
/Documentation/images/element_implementations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_implementations.png
--------------------------------------------------------------------------------
/Documentation/images/element_importcomponent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_importcomponent.png
--------------------------------------------------------------------------------
/Documentation/images/element_license.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_license.png
--------------------------------------------------------------------------------
/Documentation/images/element_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_line.png
--------------------------------------------------------------------------------
/Documentation/images/element_member.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_member.png
--------------------------------------------------------------------------------
/Documentation/images/element_method.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_method.png
--------------------------------------------------------------------------------
/Documentation/images/element_option.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_option.png
--------------------------------------------------------------------------------
/Documentation/images/element_param.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_param.png
--------------------------------------------------------------------------------
/Documentation/images/element_struct.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/element_struct.png
--------------------------------------------------------------------------------
/Documentation/images/type_export.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/type_export.png
--------------------------------------------------------------------------------
/Documentation/images/type_functiontype.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/AutomaticComponentToolkit/33422936d34156d0d683e8ab363a8e10b14491c6/Documentation/images/type_functiontype.png
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Examples/CppDynamic/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated CMake Project that demonstrates the
10 | usage of the Dynamic C++ bindings of Calculator library
11 |
12 | Interface version: 1.0.0
13 |
14 |
15 | ]]
16 |
17 | cmake_minimum_required(VERSION 3.5)
18 |
19 | set(CMAKE_CURRENT_BINDING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Bindings/CppDynamic)
20 | project(CalculatorExample_CPPDynamic)
21 | set(CMAKE_CXX_STANDARD 11)
22 | add_executable(CalculatorExample_CPPDynamic "${CMAKE_CURRENT_SOURCE_DIR}/Calculator_example.cpp")
23 | if (UNIX)
24 | target_link_libraries(CalculatorExample_CPPDynamic ${CMAKE_DL_LIBS})
25 | endif (UNIX)
26 | target_include_directories(CalculatorExample_CPPDynamic PRIVATE "${CMAKE_CURRENT_BINDING_DIR}")
27 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Examples/CppDynamic/Calculator_example.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ application that demonstrates the
10 | usage of the Dynamic C++ bindings of Calculator library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #include
17 | #include "calculator_dynamic.hpp"
18 |
19 |
20 | int main()
21 | {
22 | try
23 | {
24 | std::string libpath = (""); // TODO: put the location of the Calculator-library file here.
25 | auto wrapper = Calculator::CWrapper::loadLibrary(libpath + "/calculator."); // TODO: add correct suffix of the library
26 | Calculator_uint32 nMajor, nMinor, nMicro;
27 | wrapper->GetVersion(nMajor, nMinor, nMicro);
28 | std::cout << "Calculator.Version = " << nMajor << "." << nMinor << "." << nMicro;
29 | std::cout << std::endl;
30 |
31 | auto calculator = wrapper->CreateCalculator();
32 | {
33 | auto v1 = wrapper->CreateVariable(2);
34 | calculator->EnlistVariable(v1.get());
35 |
36 | auto v2 = wrapper->CreateVariable(3);
37 | calculator->EnlistVariable(v2.get());
38 |
39 | // The application releases ownership of v1 and v2,
40 | // the calculator, however, still holds these instances.
41 | }
42 |
43 | std::cout << " sum = " << calculator->Add()->GetValue() << std::endl;
44 | {
45 | auto v1Again = calculator->GetEnlistedVariable(0);
46 | std::cout << "Changing the value of the first summand" << std::endl;
47 | v1Again->SetValue(10);
48 | std::cout << "newSum = " << calculator->Add()->GetValue() << std::endl;
49 | }
50 |
51 | }
52 | catch (std::exception &e)
53 | {
54 | std::cout << e.what() << std::endl;
55 | return 1;
56 | }
57 | return 0;
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Examples/Python/Calculator_Example.py:
--------------------------------------------------------------------------------
1 | '''++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Python application that demonstrates the
10 | usage of the Python bindings of Calculator library
11 |
12 | Interface version: 1.0.0
13 |
14 | '''
15 |
16 |
17 | import os
18 | import sys
19 | sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "Bindings", "Python"))
20 | import Calculator
21 |
22 |
23 | def main():
24 | libpath = '' # TODO add the location of the shared library binary here
25 | wrapper = Calculator.Wrapper(os.path.join(libpath, "calculator"))
26 |
27 | major, minor, micro = wrapper.GetVersion()
28 | print("Calculator version: {:d}.{:d}.{:d}".format(major, minor, micro), end="")
29 | print("")
30 |
31 | calculator = wrapper.CreateCalculator()
32 |
33 | calculator.EnlistVariable(wrapper.CreateVariable(2.0))
34 | calculator.EnlistVariable(wrapper.CreateVariable(3.0))
35 |
36 | print(" sum = " + str(calculator.Add().GetValue()))
37 | print("Changing the value of the first summand")
38 | calculator.GetEnlistedVariable(0).SetValue(10)
39 | print("newSum = " + str(calculator.Add().GetValue()))
40 |
41 | if __name__ == "__main__":
42 | try:
43 | main()
44 | except Calculator.ECalculatorException as e:
45 | print(e)
46 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Interfaces/calculator_interfaceexception.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ Implementation file with the basic internal
10 | exception type in order to allow an easy use of Calculator library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 |
17 | #include
18 |
19 | #include "calculator_interfaceexception.hpp"
20 |
21 | /*************************************************************************************************************************
22 | Class ECalculatorInterfaceException
23 | **************************************************************************************************************************/
24 | ECalculatorInterfaceException::ECalculatorInterfaceException(CalculatorResult errorCode)
25 | : m_errorMessage("Calculator Error " + std::to_string (errorCode))
26 | {
27 | m_errorCode = errorCode;
28 | }
29 |
30 | ECalculatorInterfaceException::ECalculatorInterfaceException(CalculatorResult errorCode, std::string errorMessage)
31 | : m_errorMessage(errorMessage + " (" + std::to_string (errorCode) + ")")
32 | {
33 | m_errorCode = errorCode;
34 | }
35 |
36 | CalculatorResult ECalculatorInterfaceException::getErrorCode ()
37 | {
38 | return m_errorCode;
39 | }
40 |
41 | const char * ECalculatorInterfaceException::what () const noexcept
42 | {
43 | return m_errorMessage.c_str();
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Interfaces/calculator_interfaceexception.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ Header file with the basic internal
10 | exception type in order to allow an easy use of Calculator library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #ifndef __CALCULATOR_INTERFACEEXCEPTION_HEADER
17 | #define __CALCULATOR_INTERFACEEXCEPTION_HEADER
18 |
19 | #include
20 | #include
21 | #include "calculator_types.hpp"
22 |
23 | /*************************************************************************************************************************
24 | Class ECalculatorInterfaceException
25 | **************************************************************************************************************************/
26 |
27 |
28 | class ECalculatorInterfaceException : public std::exception {
29 | protected:
30 | /**
31 | * Error code for the Exception.
32 | */
33 | CalculatorResult m_errorCode;
34 | /**
35 | * Error message for the Exception.
36 | */
37 | std::string m_errorMessage;
38 |
39 | public:
40 | /**
41 | * Exception Constructor.
42 | */
43 | ECalculatorInterfaceException(CalculatorResult errorCode);
44 |
45 | /**
46 | * Custom Exception Constructor.
47 | */
48 | ECalculatorInterfaceException(CalculatorResult errorCode, std::string errorMessage);
49 |
50 | /**
51 | * Returns error code
52 | */
53 | CalculatorResult getErrorCode();
54 | /**
55 | * Returns error message
56 | */
57 | const char* what() const noexcept override;
58 | };
59 |
60 | #endif // __CALCULATOR_INTERFACEEXCEPTION_HEADER
61 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Stub/calculator.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ implementation file in order to allow easy
10 | development of Calculator library. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #include "calculator_abi.hpp"
17 | #include "calculator_interfaces.hpp"
18 | #include "calculator_interfaceexception.hpp"
19 |
20 | #include "calculator_calculator.hpp"
21 | #include "calculator_variable.hpp"
22 |
23 | using namespace Calculator;
24 | using namespace Calculator::Impl;
25 |
26 | void CWrapper::GetVersion(Calculator_uint32 & nMajor, Calculator_uint32 & nMinor, Calculator_uint32 & nMicro)
27 | {
28 | nMajor = CALCULATOR_VERSION_MAJOR;
29 | nMinor = CALCULATOR_VERSION_MINOR;
30 | nMicro = CALCULATOR_VERSION_MICRO;
31 | }
32 |
33 | bool CWrapper::GetLastError(IBase* pInstance, std::string & sErrorMessage)
34 | {
35 | return pInstance->GetLastErrorMessage(sErrorMessage);
36 | }
37 |
38 | void CWrapper::ReleaseInstance(IBase* pInstance)
39 | {
40 | IBase::ReleaseBaseClassInterface(pInstance);
41 | }
42 |
43 | void CWrapper::AcquireInstance(IBase* pInstance)
44 | {
45 | IBase::AcquireBaseClassInterface(pInstance);
46 | }
47 |
48 | IVariable * CWrapper::CreateVariable(const Calculator_double dInitialValue)
49 | {
50 | return new CVariable(dInitialValue);
51 | }
52 |
53 | ICalculator * CWrapper::CreateCalculator()
54 | {
55 | return new CCalculator();
56 | }
57 |
58 |
59 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Stub/calculator_base.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is a stub class definition of CBase
8 |
9 | */
10 |
11 | #include "calculator_base.hpp"
12 | #include "calculator_interfaceexception.hpp"
13 |
14 | // Include custom headers here.
15 |
16 |
17 | using namespace Calculator::Impl;
18 |
19 | /*************************************************************************************************************************
20 | Class definition of CBase
21 | **************************************************************************************************************************/
22 |
23 | bool CBase::GetLastErrorMessage(std::string & sErrorMessage)
24 | {
25 | if (m_pErrors && !m_pErrors->empty()) {
26 | sErrorMessage = m_pErrors->back();
27 | return true;
28 | } else {
29 | sErrorMessage = "";
30 | return false;
31 | }
32 | }
33 |
34 | void CBase::ClearErrorMessages()
35 | {
36 | m_pErrors.reset();
37 | }
38 |
39 | void CBase::RegisterErrorMessage(const std::string & sErrorMessage)
40 | {
41 | if (!m_pErrors) {
42 | m_pErrors.reset(new std::list());
43 | }
44 | m_pErrors->clear();
45 | m_pErrors->push_back(sErrorMessage);
46 | }
47 |
48 | void CBase::IncRefCount()
49 | {
50 | ++m_nReferenceCount;
51 | }
52 |
53 | bool CBase::DecRefCount()
54 | {
55 | m_nReferenceCount--;
56 | if (!m_nReferenceCount) {;
57 | delete this;
58 | return true;
59 | }
60 | return false;
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Stub/calculator_base.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of CBase
8 |
9 | */
10 |
11 |
12 | #ifndef __CALCULATOR_BASE
13 | #define __CALCULATOR_BASE
14 |
15 | #include "calculator_interfaces.hpp"
16 | #include
17 | #include
18 | #include
19 |
20 |
21 | // Include custom headers here.
22 |
23 |
24 | namespace Calculator {
25 | namespace Impl {
26 |
27 |
28 | /*************************************************************************************************************************
29 | Class declaration of CBase
30 | **************************************************************************************************************************/
31 |
32 | class CBase : public virtual IBase {
33 | private:
34 |
35 | std::unique_ptr> m_pErrors;
36 | Calculator_uint32 m_nReferenceCount = 1;
37 |
38 | /**
39 | * Put private members here.
40 | */
41 |
42 | protected:
43 |
44 | /**
45 | * Put protected members here.
46 | */
47 |
48 | public:
49 |
50 | /**
51 | * Put additional public members here. They will not be visible in the external API.
52 | */
53 |
54 | bool GetLastErrorMessage(std::string & sErrorMessage);
55 |
56 | void ClearErrorMessages();
57 |
58 | void RegisterErrorMessage(const std::string & sErrorMessage);
59 |
60 | void IncRefCount();
61 |
62 | bool DecRefCount();
63 |
64 |
65 | /**
66 | * Public member functions to implement.
67 | */
68 |
69 | };
70 |
71 | } // namespace Impl
72 | } // namespace Calculator
73 |
74 | #endif // __CALCULATOR_BASE
75 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Stub/calculator_calculator.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is a stub class definition of CCalculator
8 |
9 | */
10 |
11 | #include "calculator_calculator.hpp"
12 | #include "calculator_interfaceexception.hpp"
13 |
14 | // Include custom headers here.
15 | #include "calculator_variable.hpp"
16 |
17 | using namespace Calculator::Impl;
18 |
19 | /*************************************************************************************************************************
20 | Class definition of CCalculator
21 | **************************************************************************************************************************/
22 |
23 | void CCalculator::EnlistVariable(IVariable* pVariable)
24 | {
25 | m_pVariables.push_back(PIVariable(pVariable));
26 | }
27 |
28 | IVariable * CCalculator::GetEnlistedVariable(const Calculator_uint32 nIndex)
29 | {
30 | if (nIndex < m_pVariables.size()) {
31 | return m_pVariables[nIndex].getCoOwningPtr();
32 | }
33 | else {
34 | throw ECalculatorInterfaceException(CALCULATOR_ERROR_INVALIDPARAM, "Invalid Index");
35 | }
36 | }
37 |
38 | void CCalculator::ClearVariables()
39 | {
40 | m_pVariables.clear();
41 | }
42 |
43 | IVariable * CCalculator::Multiply()
44 | {
45 | Calculator_double dValue = 1.0;
46 | for (const PIVariable & pVariable : m_pVariables) {
47 | dValue *= pVariable->GetValue();
48 | }
49 | return new CVariable(dValue);
50 | }
51 |
52 | IVariable * CCalculator::Add()
53 | {
54 | Calculator_double dValue = 0.0;
55 | for (const PIVariable & pVariable : m_pVariables) {
56 | dValue += pVariable->GetValue();
57 | }
58 | return new CVariable(dValue);
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Stub/calculator_calculator.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of CCalculator
8 |
9 | */
10 |
11 |
12 | #ifndef __CALCULATOR_CALCULATOR
13 | #define __CALCULATOR_CALCULATOR
14 |
15 | #include "calculator_interfaces.hpp"
16 |
17 | // Parent classes
18 | #include "calculator_base.hpp"
19 | #ifdef _MSC_VER
20 | #pragma warning(push)
21 | #pragma warning(disable : 4250)
22 | #endif
23 |
24 | // Include custom headers here.
25 |
26 | #include
27 |
28 | namespace Calculator {
29 | namespace Impl {
30 |
31 |
32 | /*************************************************************************************************************************
33 | Class declaration of CCalculator
34 | **************************************************************************************************************************/
35 |
36 | class CCalculator : public virtual ICalculator, public virtual CBase {
37 | private:
38 |
39 | /**
40 | * Put private members here.
41 | */
42 |
43 | std::vector m_pVariables;
44 |
45 | protected:
46 |
47 | /**
48 | * Put protected members here.
49 | */
50 |
51 | public:
52 |
53 | /**
54 | * Put additional public members here. They will not be visible in the external API.
55 | */
56 |
57 |
58 | /**
59 | * Public member functions to implement.
60 | */
61 |
62 | void EnlistVariable(IVariable* pVariable);
63 |
64 | IVariable * GetEnlistedVariable(const Calculator_uint32 nIndex);
65 |
66 | void ClearVariables();
67 |
68 | IVariable * Multiply();
69 |
70 | IVariable * Add();
71 |
72 | };
73 |
74 | } // namespace Impl
75 | } // namespace Calculator
76 |
77 | #ifdef _MSC_VER
78 | #pragma warning(pop)
79 | #endif
80 | #endif // __CALCULATOR_CALCULATOR
81 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Stub/calculator_variable.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is a stub class definition of CVariable
8 |
9 | */
10 |
11 | #include "calculator_variable.hpp"
12 | #include "calculator_interfaceexception.hpp"
13 |
14 | // Include custom headers here.
15 |
16 |
17 | using namespace Calculator::Impl;
18 |
19 | /*************************************************************************************************************************
20 | Class definition of CVariable
21 | **************************************************************************************************************************/
22 |
23 | CVariable::CVariable(Calculator_double dValue)
24 | : m_dValue(dValue)
25 | {
26 |
27 | }
28 |
29 | Calculator_double CVariable::GetValue()
30 | {
31 | return m_dValue;
32 | }
33 |
34 | void CVariable::SetValue(const Calculator_double dValue)
35 | {
36 | m_dValue = dValue;
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Cpp/Stub/calculator_variable.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of CVariable
8 |
9 | */
10 |
11 |
12 | #ifndef __CALCULATOR_VARIABLE
13 | #define __CALCULATOR_VARIABLE
14 |
15 | #include "calculator_interfaces.hpp"
16 |
17 | // Parent classes
18 | #include "calculator_base.hpp"
19 | #ifdef _MSC_VER
20 | #pragma warning(push)
21 | #pragma warning(disable : 4250)
22 | #endif
23 |
24 | // Include custom headers here.
25 |
26 |
27 | namespace Calculator {
28 | namespace Impl {
29 |
30 |
31 | /*************************************************************************************************************************
32 | Class declaration of CVariable
33 | **************************************************************************************************************************/
34 |
35 | class CVariable : public virtual IVariable, public virtual CBase {
36 | private:
37 |
38 | Calculator_double m_dValue;
39 |
40 | /**
41 | * Put private members here.
42 | */
43 |
44 | protected:
45 |
46 | /**
47 | * Put protected members here.
48 | */
49 |
50 | public:
51 |
52 | /**
53 | * Put additional public members here. They will not be visible in the external API.
54 | */
55 | CVariable(Calculator_double);
56 |
57 | /**
58 | * Public member functions to implement.
59 | */
60 |
61 | Calculator_double GetValue();
62 |
63 | void SetValue(const Calculator_double dValue);
64 |
65 | };
66 |
67 | } // namespace Impl
68 | } // namespace Calculator
69 |
70 | #ifdef _MSC_VER
71 | #pragma warning(pop)
72 | #endif
73 | #endif // __CALCULATOR_VARIABLE
74 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Pascal/Interfaces/calculator.lpr:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal project file in order to allow easy
10 | development of Calculator library.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | library calculator;
18 |
19 | uses
20 | {$IFDEF UNIX}
21 | cthreads,
22 | {$ENDIF UNIX}
23 | syncobjs,
24 | calculator_types,
25 | calculator_exports,
26 | Classes,
27 | sysutils;
28 |
29 | exports
30 | calculator_variable_getvalue,
31 | calculator_variable_setvalue,
32 | calculator_calculator_enlistvariable,
33 | calculator_calculator_getenlistedvariable,
34 | calculator_calculator_clearvariables,
35 | calculator_calculator_multiply,
36 | calculator_calculator_add,
37 | calculator_getversion,
38 | calculator_getlasterror,
39 | calculator_releaseinstance,
40 | calculator_acquireinstance,
41 | calculator_createvariable,
42 | calculator_createcalculator;
43 |
44 | begin
45 |
46 | end.
47 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Pascal/Interfaces/calculator_interfaces.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal interface definition file in order to allow easy
10 | development of Calculator library. The functions in this file need to be implemented. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | {$INTERFACES CORBA}
18 | unit calculator_interfaces;
19 |
20 | interface
21 |
22 | uses
23 | calculator_types,
24 | Classes,
25 | sysutils;
26 |
27 |
28 | type
29 |
30 | (*************************************************************************************************************************
31 | Interface definition for Base
32 | **************************************************************************************************************************)
33 |
34 | ICalculatorBase = interface
35 | ['{52FDFC07-2182-454F-963F-5F0F9A621D72}']
36 |
37 | function GetLastErrorMessage(out AErrorMessage: String): Boolean;
38 | procedure ClearErrorMessages();
39 | procedure RegisterErrorMessage(const AErrorMessage: String);
40 | procedure IncRefCount();
41 | function DecRefCount(): Boolean;
42 | end;
43 |
44 |
45 | (*************************************************************************************************************************
46 | Interface definition for Variable
47 | **************************************************************************************************************************)
48 |
49 | ICalculatorVariable = interface(ICalculatorBase)
50 | ['{9566C74D-1003-4C4D-BBBB-0407D1E2C649}']
51 |
52 | function GetValue(): Double;
53 | procedure SetValue(const AValue: Double);
54 | end;
55 |
56 |
57 | (*************************************************************************************************************************
58 | Interface definition for Calculator
59 | **************************************************************************************************************************)
60 |
61 | ICalculatorCalculator = interface(ICalculatorBase)
62 | ['{81855AD8-681D-4D86-91E9-1E00167939CB}']
63 |
64 | procedure EnlistVariable(AVariable: TObject);
65 | function GetEnlistedVariable(const AIndex: Cardinal): TObject;
66 | procedure ClearVariables();
67 | function Multiply(): TObject;
68 | function Add(): TObject;
69 | end;
70 |
71 | implementation
72 |
73 | end.
74 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Pascal/Interfaces/calculator_types.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal type definition file in order to allow easy
10 | development of Calculator library. The functions in this file need to be implemented. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | unit calculator_types;
18 |
19 | interface
20 |
21 | uses
22 | Classes,
23 | sysutils;
24 |
25 | (*************************************************************************************************************************
26 | Version definition for Calculator
27 | **************************************************************************************************************************)
28 |
29 | const
30 | CALCULATOR_VERSION_MAJOR = 1;
31 | CALCULATOR_VERSION_MINOR = 0;
32 | CALCULATOR_VERSION_MICRO = 0;
33 | CALCULATOR_VERSION_PRERELEASEINFO = '';
34 | CALCULATOR_VERSION_BUILDINFO = '';
35 |
36 |
37 | (*************************************************************************************************************************
38 | General type definitions
39 | **************************************************************************************************************************)
40 |
41 | type
42 | TCalculatorResult = Cardinal;
43 | TCalculatorHandle = Pointer;
44 |
45 | PCalculatorResult = ^TCalculatorResult;
46 | PCalculatorHandle = ^TCalculatorHandle;
47 |
48 | (*************************************************************************************************************************
49 | Error Constants for Calculator
50 | **************************************************************************************************************************)
51 |
52 | const
53 | CALCULATOR_SUCCESS = 0;
54 | CALCULATOR_ERROR_NOTIMPLEMENTED = 1;
55 | CALCULATOR_ERROR_INVALIDPARAM = 2;
56 | CALCULATOR_ERROR_INVALIDCAST = 3;
57 | CALCULATOR_ERROR_BUFFERTOOSMALL = 4;
58 | CALCULATOR_ERROR_GENERICEXCEPTION = 5;
59 | CALCULATOR_ERROR_COULDNOTLOADLIBRARY = 6;
60 | CALCULATOR_ERROR_COULDNOTFINDLIBRARYEXPORT = 7;
61 | CALCULATOR_ERROR_INCOMPATIBLEBINARYVERSION = 8;
62 |
63 |
64 | implementation
65 |
66 | end.
67 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Pascal/Stub/calculator_impl.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal implementation file in order to allow easy
10 | development of Calculator library. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | Unit calculator_impl;
18 |
19 | interface
20 |
21 | uses
22 | calculator_types,
23 | calculator_exception,
24 | calculator_interfaces,
25 | calculator_impl_variable,
26 | calculator_impl_calculator,
27 | Classes,
28 | sysutils;
29 |
30 | type
31 | TCalculatorWrapper = class (TObject)
32 | public
33 | class procedure GetVersion(out AMajor: Cardinal; out AMinor: Cardinal; out AMicro: Cardinal);
34 | class function GetLastError(AInstance: TObject; out AErrorMessage: String): Boolean;
35 | class procedure ReleaseInstance(AInstance: TObject);
36 | class procedure AcquireInstance(AInstance: TObject);
37 | class function CreateVariable(const AInitialValue: Double): TObject;
38 | class function CreateCalculator(): TObject;
39 | end;
40 |
41 |
42 | implementation
43 |
44 | class procedure TCalculatorWrapper.GetVersion(out AMajor: Cardinal; out AMinor: Cardinal; out AMicro: Cardinal);
45 | begin
46 | AMajor := CALCULATOR_VERSION_MAJOR;
47 | AMinor := CALCULATOR_VERSION_MINOR;
48 | AMicro := CALCULATOR_VERSION_MICRO;
49 | end;
50 |
51 | class function TCalculatorWrapper.GetLastError(AInstance: TObject; out AErrorMessage: String): Boolean;
52 | begin
53 | result := (AInstance as ICalculatorBase).GetLastErrorMessage(AErrorMessage);
54 | end;
55 |
56 | class procedure TCalculatorWrapper.ReleaseInstance(AInstance: TObject);
57 | begin
58 | (AInstance as ICalculatorBase).DecRefCount();
59 | end;
60 |
61 | class procedure TCalculatorWrapper.AcquireInstance(AInstance: TObject);
62 | begin
63 | (AInstance as ICalculatorBase).IncRefCount();
64 | end;
65 |
66 | class function TCalculatorWrapper.CreateVariable(const AInitialValue: Double): TObject;
67 | begin
68 | result := TCalculatorVariable.Create();
69 | (result as TCalculatorVariable).SetValue(AInitialValue);
70 | end;
71 |
72 | class function TCalculatorWrapper.CreateCalculator(): TObject;
73 | begin
74 | result := TCalculatorCalculator.Create();
75 | end;
76 |
77 |
78 | end.
79 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Pascal/Stub/calculator_impl_base.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of TCalculatorBase
8 |
9 | *)
10 |
11 | {$MODE DELPHI}
12 | unit calculator_impl_base;
13 |
14 | interface
15 |
16 | uses
17 | calculator_types,
18 | calculator_interfaces,
19 | calculator_exception,
20 | Classes,
21 | sysutils;
22 |
23 | type
24 | TCalculatorBase = class(TObject, ICalculatorBase)
25 | private
26 | FMessages: TStringList;
27 | FReferenceCount: integer;
28 |
29 | protected
30 |
31 | public
32 | constructor Create();
33 | destructor Destroy(); override;
34 | function GetLastErrorMessage(out AErrorMessage: String): Boolean;
35 | procedure ClearErrorMessages();
36 | procedure RegisterErrorMessage(const AErrorMessage: String);
37 | procedure IncRefCount();
38 | function DecRefCount(): Boolean;
39 | end;
40 |
41 | implementation
42 |
43 | constructor TCalculatorBase.Create();
44 | begin
45 | inherited Create();
46 | FMessages := TStringList.Create();
47 | FReferenceCount := 1;
48 | end;
49 |
50 | destructor TCalculatorBase.Destroy();
51 | begin
52 | FreeAndNil(FMessages);
53 | inherited Destroy();
54 | end;
55 |
56 | function TCalculatorBase.GetLastErrorMessage(out AErrorMessage: String): Boolean;
57 | begin
58 | result := (FMessages.Count>0);
59 | if (result) then
60 | AErrorMessage := FMessages[FMessages.Count-1];
61 | end;
62 |
63 | procedure TCalculatorBase.ClearErrorMessages();
64 | begin
65 | FMessages.Clear();
66 | end;
67 |
68 | procedure TCalculatorBase.RegisterErrorMessage(const AErrorMessage: String);
69 | begin
70 | FMessages.Clear();
71 | FMessages.Add(AErrorMessage);
72 | end;
73 |
74 | procedure TCalculatorBase.IncRefCount();
75 | begin
76 | inc(FReferenceCount);
77 | end;
78 |
79 | function TCalculatorBase.DecRefCount(): Boolean;
80 | begin
81 | dec(FReferenceCount);
82 | if (FReferenceCount = 0) then begin
83 | result := true;
84 | self.Destroy();
85 | end;
86 | result := false;
87 | end;
88 |
89 | end.
90 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Pascal/Stub/calculator_impl_variable.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculator developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of TCalculatorVariable
8 |
9 | *)
10 |
11 | {$MODE DELPHI}
12 | unit calculator_impl_variable;
13 |
14 | interface
15 |
16 | uses
17 | calculator_types,
18 | calculator_interfaces,
19 | calculator_exception,
20 | calculator_impl_base,
21 | Classes,
22 | sysutils;
23 |
24 | type
25 | TCalculatorVariable = class(TCalculatorBase, ICalculatorVariable)
26 | private
27 | FValue : double;
28 | protected
29 |
30 | public
31 | function GetValue(): Double;
32 | procedure SetValue(const AValue: Double);
33 | end;
34 |
35 | implementation
36 |
37 | function TCalculatorVariable.GetValue(): Double;
38 | begin
39 | result := FValue;
40 | end;
41 |
42 | procedure TCalculatorVariable.SetValue(const AValue: Double);
43 | begin
44 | FValue := AValue;
45 | end;
46 |
47 | end.
48 |
--------------------------------------------------------------------------------
/Examples/Calculator/Calculator_component/Implementations/Pascal/calculator.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | calculator_getversion
3 | calculator_getlasterror
4 | calculator_releaseinstance
5 | calculator_acquireinstance
6 | calculator_createvariable
7 | calculator_createcalculator
8 | calculator_variable_getvalue
9 | calculator_variable_setvalue
10 | calculator_calculator_enlistvariable
11 | calculator_calculator_getenlistedvariable
12 | calculator_calculator_clearvariables
13 | calculator_calculator_multiply
14 | calculator_calculator_add
15 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Examples/Cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated CMake Project that demonstrates the
10 | usage of the C++ bindings of Calculation library
11 |
12 | Interface version: 1.0.0
13 |
14 |
15 | ]]
16 |
17 | cmake_minimum_required(VERSION 3.5)
18 |
19 | set(CMAKE_CURRENT_BINDING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Bindings/Cpp)
20 | project(CalculationExample_CPPImplicit)
21 | set(CMAKE_CXX_STANDARD 11)
22 | add_executable(CalculationExample_CPPImplicit "${CMAKE_CURRENT_SOURCE_DIR}/Calculation_example.cpp")
23 | if (UNIX)
24 | target_link_libraries(CalculationExample_CPPImplicit ${CMAKE_DL_LIBS})
25 | endif (UNIX)
26 | find_library(CALCULATIONLOCATION NAMES calculation.dll calculation.so calculation.dylib PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../../Implementations/Cpp/build/")
27 | target_link_libraries(CalculationExample_CPPImplicit ${CALCULATIONLOCATION})
28 | target_include_directories(CalculationExample_CPPImplicit PRIVATE "${CMAKE_CURRENT_BINDING_DIR}")
29 | target_include_directories(CalculationExample_CPPImplicit PRIVATE "${CMAKE_CURRENT_BINDING_DIR}/../../../Numbers_component/Bindings/CppDynamic")
30 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Examples/Cpp/Calculation_example.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ application that demonstrates the
10 | usage of the C++ bindings of Calculation library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #include
17 | #include "calculation_implicit.hpp"
18 |
19 |
20 | int main()
21 | {
22 | try
23 | {
24 | auto wrapper = Calculation::CWrapper::loadLibrary();
25 | Calculation_uint32 nMajor, nMinor, nMicro;
26 | wrapper->GetVersion(nMajor, nMinor, nMicro);
27 | std::cout << "Calculation.Version = " << nMajor << "." << nMinor << "." << nMicro;
28 | std::cout << std::endl;
29 |
30 | std::string libpath = "";
31 | auto numbers = Numbers::CWrapper::loadLibrary(libpath + "/numbers.");
32 | numbers->GetVersion(nMajor, nMinor, nMicro);
33 | std::cout << "Numbers.Version = " << nMajor << "." << nMinor << "." << nMicro;
34 | std::cout << std::endl;
35 |
36 | wrapper->InjectComponent("Numbers", numbers->GetSymbolLookupMethod());
37 |
38 | auto calculator = wrapper->CreateCalculator();
39 | auto v1 = numbers->CreateVariable(10.0);
40 | calculator->EnlistVariable(v1.get());
41 |
42 | calculator->EnlistVariable(numbers->CreateVariable(5.0).get());
43 |
44 | Numbers::PVariable pSum = calculator->Add();
45 | std::cout << " sum = " << pSum->GetValue() << std::endl;
46 |
47 | {
48 | auto v2New = calculator->GetEnlistedVariable(1);
49 | v2New->SetValue(15.0);
50 | }
51 |
52 | std::cout << "newSum = " << calculator->Add()->GetValue() << std::endl;
53 | }
54 | catch (std::exception &e)
55 | {
56 | std::cout << e.what() << std::endl;
57 | return 1;
58 | }
59 | return 0;
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Examples/CppDynamic/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated CMake Project that demonstrates the
10 | usage of the Dynamic C++ bindings of Calculation library
11 |
12 | Interface version: 1.0.0
13 |
14 |
15 | ]]
16 |
17 | cmake_minimum_required(VERSION 3.5)
18 |
19 | set(CMAKE_CURRENT_BINDING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Bindings/CppDynamic)
20 | project(CalculationExample_CPPDynamic)
21 | set(CMAKE_CXX_STANDARD 11)
22 | add_executable(CalculationExample_CPPDynamic "${CMAKE_CURRENT_SOURCE_DIR}/Calculation_example.cpp")
23 | if (UNIX)
24 | target_link_libraries(CalculationExample_CPPDynamic ${CMAKE_DL_LIBS})
25 | endif (UNIX)
26 | target_include_directories(CalculationExample_CPPDynamic PRIVATE "${CMAKE_CURRENT_BINDING_DIR}")
27 | target_include_directories(CalculationExample_CPPDynamic PRIVATE "${CMAKE_CURRENT_BINDING_DIR}/../../../Numbers_component/Bindings/CppDynamic")
28 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Examples/CppDynamic/Calculation_example.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ application that demonstrates the
10 | usage of the Dynamic C++ bindings of Calculation library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #include
17 | #include "calculation_dynamic.hpp"
18 |
19 |
20 | int main()
21 | {
22 | try
23 | {
24 | std::string libpath = ""; // TODO: put the location of the Calculation-library file here.
25 | auto wrapper = Calculation::CWrapper::loadLibrary(libpath + "/calculation."); // TODO: add correct suffix of the library
26 |
27 | libpath = "";
28 | auto numbers = Numbers::CWrapper::loadLibrary(libpath + "/numbers.");
29 |
30 | Calculation_uint32 nMajor, nMinor, nMicro;
31 | wrapper->GetVersion(nMajor, nMinor, nMicro);
32 | std::cout << "Calculation.Version = " << nMajor << "." << nMinor << "." << nMicro;
33 | std::cout << std::endl;
34 |
35 | wrapper->InjectComponent("Numbers", numbers->GetSymbolLookupMethod());
36 |
37 |
38 | auto calculator = wrapper->CreateCalculator();
39 | auto v1 = numbers->CreateVariable(10.0);
40 | calculator->EnlistVariable(v1.get());
41 |
42 | calculator->EnlistVariable(numbers->CreateVariable(5.0).get());
43 |
44 | Numbers::PVariable pSum = calculator->Add();
45 | std::cout << " sum = " << pSum->GetValue() << std::endl;
46 |
47 | {
48 | auto v2New = calculator->GetEnlistedVariable(1);
49 | v2New->SetValue(15.0);
50 | }
51 |
52 | std::cout << "newSum = " << calculator->Add()->GetValue() << std::endl;
53 |
54 | }
55 | catch (std::exception &e)
56 | {
57 | std::cout << e.what() << std::endl;
58 | return 1;
59 | }
60 | return 0;
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Examples/Python/Calculation_Example.py:
--------------------------------------------------------------------------------
1 | '''++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Python application that demonstrates the
10 | usage of the Python bindings of Calculation library
11 |
12 | Interface version: 1.0.0
13 |
14 | '''
15 |
16 |
17 | import os
18 | import sys
19 | sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "Bindings", "Python"))
20 | import Calculation
21 |
22 |
23 | def main():
24 | libpath = '' # TODO add the location of the shared library binary here
25 | wrapper = Calculation.Wrapper(libraryName = os.path.join(libpath, "calculation"))
26 |
27 | major, minor, micro = wrapper.GetVersion()
28 | print("Calculation version: {:d}.{:d}.{:d}".format(major, minor, micro), end="")
29 | print("")
30 |
31 | libpath = '' # TODO add the location of the shared library binary here
32 | numbers = Calculation.Numbers.Wrapper(os.path.join(libpath, "numbers"))
33 | major, minor, micro = numbers.GetVersion()
34 | print("Numbers version: {:d}.{:d}.{:d}".format(major, minor, micro), end="")
35 | print("")
36 |
37 | wrapper.InjectComponent("Numbers", numbers.GetSymbolLookupMethod())
38 |
39 | calculator = wrapper.CreateCalculator()
40 | calculator.EnlistVariable(numbers.CreateVariable(10.0))
41 | calculator.EnlistVariable(numbers.CreateVariable(5.0))
42 | print(" sum="+str(calculator.Add().GetValue()))
43 | calculator.GetEnlistedVariable(1).SetValue(15.0)
44 | print("newSum="+str(calculator.Add().GetValue()))
45 |
46 | if __name__ == "__main__":
47 | try:
48 | main()
49 | except Calculation.ECalculationException as e:
50 | print(e)
51 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated CMakeLists file for the development of Calculation library.
10 |
11 | Interface version: 1.0.0
12 |
13 |
14 | ]]
15 |
16 | cmake_minimum_required(VERSION 3.5)
17 |
18 | ### The implementation of the Calculation library component
19 | project(Calculation)
20 |
21 | set (CMAKE_CXX_STANDARD 11)
22 |
23 | # The location of autogenerated interfaces
24 | set(CMAKE_CURRENT_AUTOGENERATED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Interfaces)
25 |
26 | file(GLOB CALCULATION_SRC
27 | ${CMAKE_CURRENT_SOURCE_DIR}/Stub/*.cpp
28 | )
29 | file(GLOB CALCULATION_HDR
30 | ${CMAKE_CURRENT_SOURCE_DIR}/Stub/*.hpp
31 | )
32 | set(CALCULATION_SRC ${CALCULATION_SRC} ${CALCULATION_SRC}
33 | ${CMAKE_CURRENT_AUTOGENERATED_DIR}/calculation_interfaceexception.cpp
34 | ${CMAKE_CURRENT_AUTOGENERATED_DIR}/calculation_interfacewrapper.cpp
35 | )
36 |
37 | add_library(calculation SHARED ${CALCULATION_SRC})
38 | # Do not prefix the binary's name with "lib" on Unix systems:
39 | set_target_properties(calculation PROPERTIES PREFIX "" IMPORT_PREFIX "" )
40 | # The following two properties are crucial to reduce the number of undesirably exported symbols
41 | set_target_properties(calculation PROPERTIES CXX_VISIBILITY_PRESET hidden)
42 | set_target_properties(calculation PROPERTIES VISIBILITY_INLINES_HIDDEN ON)
43 | # This makes sure symbols are exported
44 | target_compile_options(calculation PRIVATE "-D__CALCULATION_EXPORTS")
45 | target_include_directories(calculation PRIVATE ${CMAKE_CURRENT_AUTOGENERATED_DIR})
46 | target_include_directories(calculation PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Stub)
47 | target_include_directories(calculation PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../../Numbers_component/Bindings/CppDynamic")
48 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Cpp/Interfaces/calculation_interfaceexception.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ Implementation file with the basic internal
10 | exception type in order to allow an easy use of Calculation library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 |
17 | #include
18 |
19 | #include "calculation_interfaceexception.hpp"
20 |
21 | /*************************************************************************************************************************
22 | Class ECalculationInterfaceException
23 | **************************************************************************************************************************/
24 | ECalculationInterfaceException::ECalculationInterfaceException(CalculationResult errorCode)
25 | : m_errorMessage("Calculation Error " + std::to_string (errorCode))
26 | {
27 | m_errorCode = errorCode;
28 | }
29 |
30 | ECalculationInterfaceException::ECalculationInterfaceException(CalculationResult errorCode, std::string errorMessage)
31 | : m_errorMessage(errorMessage + " (" + std::to_string (errorCode) + ")")
32 | {
33 | m_errorCode = errorCode;
34 | }
35 |
36 | CalculationResult ECalculationInterfaceException::getErrorCode ()
37 | {
38 | return m_errorCode;
39 | }
40 |
41 | const char * ECalculationInterfaceException::what () const noexcept
42 | {
43 | return m_errorMessage.c_str();
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Cpp/Interfaces/calculation_interfaceexception.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ Header file with the basic internal
10 | exception type in order to allow an easy use of Calculation library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #ifndef __CALCULATION_INTERFACEEXCEPTION_HEADER
17 | #define __CALCULATION_INTERFACEEXCEPTION_HEADER
18 |
19 | #include
20 | #include
21 | #include "calculation_types.hpp"
22 |
23 | /*************************************************************************************************************************
24 | Class ECalculationInterfaceException
25 | **************************************************************************************************************************/
26 |
27 |
28 | class ECalculationInterfaceException : public std::exception {
29 | protected:
30 | /**
31 | * Error code for the Exception.
32 | */
33 | CalculationResult m_errorCode;
34 | /**
35 | * Error message for the Exception.
36 | */
37 | std::string m_errorMessage;
38 |
39 | public:
40 | /**
41 | * Exception Constructor.
42 | */
43 | ECalculationInterfaceException(CalculationResult errorCode);
44 |
45 | /**
46 | * Custom Exception Constructor.
47 | */
48 | ECalculationInterfaceException(CalculationResult errorCode, std::string errorMessage);
49 |
50 | /**
51 | * Returns error code
52 | */
53 | CalculationResult getErrorCode();
54 | /**
55 | * Returns error message
56 | */
57 | const char* what() const noexcept override;
58 | };
59 |
60 | #endif // __CALCULATION_INTERFACEEXCEPTION_HEADER
61 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Cpp/Stub/calculation.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ implementation file in order to allow easy
10 | development of Calculation library. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #include "calculation_abi.hpp"
17 | #include "calculation_interfaces.hpp"
18 | #include "calculation_interfaceexception.hpp"
19 |
20 | #include "calculation_calculator.hpp"
21 |
22 | using namespace Calculation;
23 | using namespace Calculation::Impl;
24 |
25 | // Injected Components
26 | Numbers::PWrapper CWrapper::sPNumbersWrapper;
27 |
28 | ICalculator * CWrapper::CreateCalculator()
29 | {
30 | return new CCalculator();
31 | }
32 |
33 | void CWrapper::GetVersion(Calculation_uint32 & nMajor, Calculation_uint32 & nMinor, Calculation_uint32 & nMicro)
34 | {
35 | nMajor = CALCULATION_VERSION_MAJOR;
36 | nMinor = CALCULATION_VERSION_MINOR;
37 | nMicro = CALCULATION_VERSION_MICRO;
38 | }
39 |
40 | bool CWrapper::GetLastError(IBase* pInstance, std::string & sErrorMessage)
41 | {
42 | if (pInstance) {
43 | return pInstance->GetLastErrorMessage(sErrorMessage);
44 | }
45 | else {
46 | throw ECalculationInterfaceException(CALCULATION_ERROR_INVALIDPARAM);
47 | }
48 | }
49 |
50 | void CWrapper::ReleaseInstance(IBase* pInstance)
51 | {
52 | IBase::ReleaseBaseClassInterface(pInstance);
53 | }
54 |
55 | void CWrapper::AcquireInstance(IBase* pInstance)
56 | {
57 | IBase::AcquireBaseClassInterface(pInstance);
58 | }
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Cpp/Stub/calculation_base.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is a stub class definition of CBase
8 |
9 | */
10 |
11 | #include "calculation_base.hpp"
12 | #include "calculation_interfaceexception.hpp"
13 |
14 | // Include custom headers here.
15 |
16 |
17 | using namespace Calculation::Impl;
18 |
19 | /*************************************************************************************************************************
20 | Class definition of CBase
21 | **************************************************************************************************************************/
22 |
23 | bool CBase::GetLastErrorMessage(std::string & sErrorMessage)
24 | {
25 | if (m_pErrors && !m_pErrors->empty()) {
26 | sErrorMessage = m_pErrors->back();
27 | return true;
28 | } else {
29 | sErrorMessage = "";
30 | return false;
31 | }
32 | }
33 |
34 | void CBase::ClearErrorMessages()
35 | {
36 | m_pErrors.reset();
37 | }
38 |
39 | void CBase::RegisterErrorMessage(const std::string & sErrorMessage)
40 | {
41 | if (!m_pErrors) {
42 | m_pErrors.reset(new std::list());
43 | }
44 | m_pErrors->clear();
45 | m_pErrors->push_back(sErrorMessage);
46 | }
47 |
48 | void CBase::IncRefCount()
49 | {
50 | ++m_nReferenceCount;
51 | }
52 |
53 | bool CBase::DecRefCount()
54 | {
55 | m_nReferenceCount--;
56 | if (!m_nReferenceCount) {;
57 | delete this;
58 | return true;
59 | }
60 | return false;
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Cpp/Stub/calculation_base.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of CBase
8 |
9 | */
10 |
11 |
12 | #ifndef __CALCULATION_BASE
13 | #define __CALCULATION_BASE
14 |
15 | #include "calculation_interfaces.hpp"
16 | #include
17 | #include
18 | #include
19 |
20 |
21 | // Include custom headers here.
22 |
23 |
24 | namespace Calculation {
25 | namespace Impl {
26 |
27 |
28 | /*************************************************************************************************************************
29 | Class declaration of CBase
30 | **************************************************************************************************************************/
31 |
32 | class CBase : public virtual IBase {
33 | private:
34 |
35 | std::unique_ptr> m_pErrors;
36 | Calculation_uint32 m_nReferenceCount = 1;
37 |
38 | /**
39 | * Put private members here.
40 | */
41 |
42 | protected:
43 |
44 | /**
45 | * Put protected members here.
46 | */
47 |
48 | public:
49 |
50 | /**
51 | * Put additional public members here. They will not be visible in the external API.
52 | */
53 |
54 | bool GetLastErrorMessage(std::string & sErrorMessage);
55 |
56 | void ClearErrorMessages();
57 |
58 | void RegisterErrorMessage(const std::string & sErrorMessage);
59 |
60 | void IncRefCount();
61 |
62 | bool DecRefCount();
63 |
64 |
65 | /**
66 | * Public member functions to implement.
67 | */
68 |
69 | };
70 |
71 | } // namespace Impl
72 | } // namespace Calculation
73 |
74 | #endif // __CALCULATION_BASE
75 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Cpp/Stub/calculation_calculator.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is a stub class definition of CCalculator
8 |
9 | */
10 |
11 | #include "calculation_calculator.hpp"
12 | #include "calculation_interfaceexception.hpp"
13 |
14 | // Include custom headers here.
15 |
16 |
17 | using namespace Calculation::Impl;
18 |
19 | /*************************************************************************************************************************
20 | Class definition of CCalculator
21 | **************************************************************************************************************************/
22 |
23 | void CCalculator::EnlistVariable(Numbers::PVariable pVariable)
24 | {
25 | m_vVariables.push_back(pVariable);
26 | }
27 |
28 | Numbers::PVariable CCalculator::GetEnlistedVariable(const Calculation_uint32 nIndex)
29 | {
30 | return m_vVariables[nIndex];
31 | }
32 |
33 | void CCalculator::ClearVariables()
34 | {
35 | m_vVariables.clear();
36 | }
37 |
38 | Numbers::PVariable CCalculator::Multiply()
39 | {
40 | double sum = 1.0;
41 | for (auto& pVar : m_vVariables) {
42 | sum += pVar->GetValue();
43 | }
44 | return CWrapper::sPNumbersWrapper->CreateVariable(sum);
45 | }
46 |
47 | Numbers::PVariable CCalculator::Add()
48 | {
49 | double sum = 0.;
50 | for (auto& pVar : m_vVariables) {
51 | sum += pVar->GetValue();
52 | }
53 | return CWrapper::sPNumbersWrapper->CreateVariable(sum);
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Cpp/Stub/calculation_calculator.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of CCalculator
8 |
9 | */
10 |
11 |
12 | #ifndef __CALCULATION_CALCULATOR
13 | #define __CALCULATION_CALCULATOR
14 |
15 | #include "calculation_interfaces.hpp"
16 |
17 | // Parent classes
18 | #include "calculation_base.hpp"
19 | #ifdef _MSC_VER
20 | #pragma warning(push)
21 | #pragma warning(disable : 4250)
22 | #endif
23 |
24 | // Include custom headers here.
25 | #include
26 |
27 | namespace Calculation {
28 | namespace Impl {
29 |
30 |
31 | /*************************************************************************************************************************
32 | Class declaration of CCalculator
33 | **************************************************************************************************************************/
34 |
35 | class CCalculator : public virtual ICalculator, public virtual CBase {
36 | private:
37 |
38 | std::vector m_vVariables;
39 | /**
40 | * Put private members here.
41 | */
42 |
43 | protected:
44 |
45 | /**
46 | * Put protected members here.
47 | */
48 |
49 | public:
50 |
51 | /**
52 | * Put additional public members here. They will not be visible in the external API.
53 | */
54 |
55 |
56 | /**
57 | * Public member functions to implement.
58 | */
59 |
60 | void EnlistVariable(Numbers::PVariable pVariable);
61 |
62 | Numbers::PVariable GetEnlistedVariable(const Calculation_uint32 nIndex);
63 |
64 | void ClearVariables();
65 |
66 | Numbers::PVariable Multiply();
67 |
68 | Numbers::PVariable Add();
69 |
70 | };
71 |
72 | } // namespace Impl
73 | } // namespace Calculation
74 |
75 | #ifdef _MSC_VER
76 | #pragma warning(pop)
77 | #endif
78 | #endif // __CALCULATION_CALCULATOR
79 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Pascal/Interfaces/calculation.lpr:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal project file in order to allow easy
10 | development of Calculation library.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | library calculation;
18 |
19 | uses
20 | {$IFDEF UNIX}
21 | cthreads,
22 | {$ENDIF UNIX}
23 | syncobjs,
24 | calculation_types,
25 | calculation_exports,
26 | Classes,
27 | sysutils;
28 |
29 | exports
30 | calculation_calculator_enlistvariable,
31 | calculation_calculator_getenlistedvariable,
32 | calculation_calculator_clearvariables,
33 | calculation_calculator_multiply,
34 | calculation_calculator_add,
35 | calculation_createcalculator,
36 | calculation_getversion,
37 | calculation_getlasterror,
38 | calculation_releaseinstance,
39 | calculation_acquireinstance,
40 | calculation_injectcomponent,
41 | calculation_getsymbollookupmethod;
42 |
43 | begin
44 |
45 | end.
46 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Pascal/Interfaces/calculation_interfaces.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal interface definition file in order to allow easy
10 | development of Calculation library. The functions in this file need to be implemented. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | {$INTERFACES CORBA}
18 | unit calculation_interfaces;
19 |
20 | interface
21 |
22 | uses
23 | calculation_types,
24 | Unit_Numbers,
25 | Classes,
26 | sysutils;
27 |
28 |
29 | type
30 |
31 | (*************************************************************************************************************************
32 | Interface definition for Base
33 | **************************************************************************************************************************)
34 |
35 | ICalculationBase = interface
36 | ['{81855AD8-681D-4D86-91E9-1E00167939CB}']
37 |
38 | function GetLastErrorMessage(out AErrorMessage: String): Boolean;
39 | procedure ClearErrorMessages();
40 | procedure RegisterErrorMessage(const AErrorMessage: String);
41 | procedure IncRefCount();
42 | function DecRefCount(): Boolean;
43 | end;
44 |
45 |
46 | (*************************************************************************************************************************
47 | Interface definition for Calculator
48 | **************************************************************************************************************************)
49 |
50 | ICalculationCalculator = interface(ICalculationBase)
51 | ['{6694D2C4-22AC-4208-A007-2939487F6999}']
52 |
53 | procedure EnlistVariable(AVariable: TNumbersVariable);
54 | function GetEnlistedVariable(const AIndex: Cardinal): TNumbersVariable;
55 | procedure ClearVariables();
56 | function Multiply(): TNumbersVariable;
57 | function Add(): TNumbersVariable;
58 | end;
59 |
60 | implementation
61 |
62 | end.
63 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Pascal/Interfaces/calculation_types.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal type definition file in order to allow easy
10 | development of Calculation library. The functions in this file need to be implemented. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | unit calculation_types;
18 |
19 | interface
20 |
21 | uses
22 | Classes,
23 | sysutils;
24 |
25 | (*************************************************************************************************************************
26 | Version definition for Calculation
27 | **************************************************************************************************************************)
28 |
29 | const
30 | CALCULATION_VERSION_MAJOR = 1;
31 | CALCULATION_VERSION_MINOR = 0;
32 | CALCULATION_VERSION_MICRO = 0;
33 | CALCULATION_VERSION_PRERELEASEINFO = '';
34 | CALCULATION_VERSION_BUILDINFO = '';
35 |
36 |
37 | (*************************************************************************************************************************
38 | General type definitions
39 | **************************************************************************************************************************)
40 |
41 | type
42 | TCalculationResult = Cardinal;
43 | TCalculationHandle = Pointer;
44 |
45 | PCalculationResult = ^TCalculationResult;
46 | PCalculationHandle = ^TCalculationHandle;
47 |
48 | (*************************************************************************************************************************
49 | Error Constants for Calculation
50 | **************************************************************************************************************************)
51 |
52 | const
53 | CALCULATION_SUCCESS = 0;
54 | CALCULATION_ERROR_NOTIMPLEMENTED = 1;
55 | CALCULATION_ERROR_INVALIDPARAM = 2;
56 | CALCULATION_ERROR_INVALIDCAST = 3;
57 | CALCULATION_ERROR_BUFFERTOOSMALL = 4;
58 | CALCULATION_ERROR_GENERICEXCEPTION = 5;
59 | CALCULATION_ERROR_COULDNOTLOADLIBRARY = 6;
60 | CALCULATION_ERROR_COULDNOTFINDLIBRARYEXPORT = 7;
61 | CALCULATION_ERROR_INCOMPATIBLEBINARYVERSION = 8;
62 |
63 |
64 | implementation
65 |
66 | end.
67 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Pascal/Stub/calculation_impl.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal implementation file in order to allow easy
10 | development of Calculation library. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | Unit calculation_impl;
18 |
19 | interface
20 |
21 | uses
22 | calculation_types,
23 | calculation_exception,
24 | calculation_interfaces,
25 | Classes,
26 | Unit_Numbers,
27 | calculation_impl_calculator,
28 | sysutils;
29 |
30 | type
31 | TCalculationWrapper = class(TObject)
32 | private
33 | class var GNumbersWrapper: TNumbersWrapper;
34 | class function GetNumbersWrapper: TNumbersWrapper; static;
35 | class procedure SetNumbersWrapper(ANumbersWrapper: TNumbersWrapper); static;
36 | public
37 | class property NumbersWrapper: TNumbersWrapper read GetNumbersWrapper write SetNumbersWrapper;
38 | class function CreateCalculator(): TObject;
39 | class procedure GetVersion(out AMajor: Cardinal; out AMinor: Cardinal; out AMicro: Cardinal);
40 | class function GetLastError(AInstance: TObject; out AErrorMessage: String): Boolean;
41 | class procedure ReleaseInstance(AInstance: TObject);
42 | class procedure AcquireInstance(AInstance: TObject);
43 | end;
44 |
45 |
46 | implementation
47 |
48 | class procedure TCalculationWrapper.SetNumbersWrapper(ANumbersWrapper: TNumbersWrapper);
49 | begin
50 | if assigned(GNumbersWrapper) then
51 | raise ECalculationException.Create(CALCULATION_ERROR_COULDNOTLOADLIBRARY);
52 | GNumbersWrapper := ANumbersWrapper;
53 | end;
54 |
55 | class function TCalculationWrapper.GetNumbersWrapper(): TNumbersWrapper;
56 | begin
57 | if not assigned(GNumbersWrapper) then
58 | raise ECalculationException.Create(CALCULATION_ERROR_COULDNOTLOADLIBRARY);
59 | result := GNumbersWrapper;
60 | end;
61 |
62 | class function TCalculationWrapper.CreateCalculator(): TObject;
63 | begin
64 | result := TCalculationCalculator.Create();
65 | end;
66 |
67 | class procedure TCalculationWrapper.GetVersion(out AMajor: Cardinal; out AMinor: Cardinal; out AMicro: Cardinal);
68 | begin
69 | AMajor := CALCULATION_VERSION_MAJOR;
70 | AMinor := CALCULATION_VERSION_MINOR;
71 | AMicro := CALCULATION_VERSION_MICRO;
72 | end;
73 |
74 | class function TCalculationWrapper.GetLastError(AInstance: TObject; out AErrorMessage: String): Boolean;
75 | begin
76 | result := false;
77 | if supports(AInstance, ICalculationBase) then
78 | result := (AInstance as ICalculationBase).GetLastErrorMessage(AErrorMessage);
79 | end;
80 |
81 | class procedure TCalculationWrapper.ReleaseInstance(AInstance: TObject);
82 | begin
83 | (AInstance as ICalculationBase).DecRefCount();
84 | end;
85 |
86 | class procedure TCalculationWrapper.AcquireInstance(AInstance: TObject);
87 | begin
88 | (AInstance as ICalculationBase).IncRefCount();
89 | end;
90 |
91 |
92 | end.
93 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Pascal/Stub/calculation_impl_base.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of TCalculationBase
8 |
9 | *)
10 |
11 | {$MODE DELPHI}
12 | unit calculation_impl_base;
13 |
14 | interface
15 |
16 | uses
17 | calculation_types,
18 | calculation_interfaces,
19 | calculation_exception,
20 | Unit_Numbers,
21 | Classes,
22 | sysutils;
23 |
24 | type
25 | TCalculationBase = class(TObject, ICalculationBase)
26 | private
27 | FMessages: TStringList;
28 | FReferenceCount: integer;
29 |
30 | protected
31 |
32 | public
33 | constructor Create();
34 | destructor Destroy(); override;
35 | function GetLastErrorMessage(out AErrorMessage: String): Boolean;
36 | procedure ClearErrorMessages();
37 | procedure RegisterErrorMessage(const AErrorMessage: String);
38 | procedure IncRefCount();
39 | function DecRefCount(): Boolean;
40 | end;
41 |
42 | implementation
43 |
44 | constructor TCalculationBase.Create();
45 | begin
46 | inherited Create();
47 | FMessages := TStringList.Create();
48 | FReferenceCount := 1;
49 | end;
50 |
51 | destructor TCalculationBase.Destroy();
52 | begin
53 | FreeAndNil(FMessages);
54 | inherited Destroy();
55 | end;
56 |
57 | function TCalculationBase.GetLastErrorMessage(out AErrorMessage: String): Boolean;
58 | begin
59 | result := (FMessages.Count>0);
60 | if (result) then
61 | AErrorMessage := FMessages[FMessages.Count-1];
62 | end;
63 |
64 | procedure TCalculationBase.ClearErrorMessages();
65 | begin
66 | FMessages.Clear();
67 | end;
68 |
69 | procedure TCalculationBase.RegisterErrorMessage(const AErrorMessage: String);
70 | begin
71 | FMessages.Clear();
72 | FMessages.Add(AErrorMessage);
73 | end;
74 |
75 | procedure TCalculationBase.IncRefCount();
76 | begin
77 | inc(FReferenceCount);
78 | end;
79 |
80 | function TCalculationBase.DecRefCount(): Boolean;
81 | begin
82 | dec(FReferenceCount);
83 | if (FReferenceCount = 0) then begin
84 | result := true;
85 | self.Destroy();
86 | end;
87 | result := false;
88 | end;
89 |
90 | end.
91 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Pascal/Stub/calculation_impl_calculator.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Calculation developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of TCalculationCalculator
8 |
9 | *)
10 |
11 | {$MODE DELPHI}
12 | unit calculation_impl_calculator;
13 |
14 | interface
15 |
16 | uses
17 | calculation_types,
18 | calculation_interfaces,
19 | calculation_exception,
20 | calculation_impl_base,
21 | Unit_Numbers,
22 | Classes,
23 | sysutils,
24 | contnrs;
25 |
26 | type
27 | TCalculationCalculator = class(TCalculationBase, ICalculationCalculator)
28 | private
29 | FVariableList : TObjectList;
30 | protected
31 |
32 | public
33 | constructor Create();
34 | destructor Destroy(); override;
35 | procedure EnlistVariable(AVariable: TNumbersVariable);
36 | function GetEnlistedVariable(const AIndex: Cardinal): TNumbersVariable;
37 | procedure ClearVariables();
38 | function Multiply(): TNumbersVariable;
39 | function Add(): TNumbersVariable;
40 | end;
41 |
42 | implementation
43 |
44 | uses calculation_impl;
45 |
46 | constructor TCalculationCalculator.Create();
47 | begin
48 | inherited Create();
49 |
50 | FVariableList := TObjectList.Create(True);
51 | end;
52 |
53 | destructor TCalculationCalculator.Destroy();
54 | begin
55 | ClearVariables();
56 |
57 | FreeAndNil(FVariableList);
58 | inherited Destroy();
59 | end;
60 |
61 | procedure TCalculationCalculator.EnlistVariable(AVariable: TNumbersVariable);
62 | begin
63 | FVariableList.Add(AVariable);
64 | end;
65 |
66 | function TCalculationCalculator.GetEnlistedVariable(const AIndex: Cardinal): TNumbersVariable;
67 | begin
68 | if AIndex >= FVariableList.Count then begin
69 | raise ECalculationException.Create(CALCULATION_ERROR_INVALIDPARAM);
70 | end;
71 | result := FVariableList[AIndex] as TNumbersVariable;
72 | end;
73 |
74 | procedure TCalculationCalculator.ClearVariables();
75 | begin
76 | FVariableList.Clear;
77 | end;
78 |
79 | function TCalculationCalculator.Multiply(): TNumbersVariable;
80 | var
81 | AVar: TNumbersVariable;
82 | I: integer;
83 | ResVal : double;
84 | begin
85 | ResVal := 1.0;
86 | For I := 0 to FVariableList.Count - 1 do begin
87 | AVar := (FVariableList[I] as TNumbersVariable);
88 | ResVal := ResVal * AVar.GetValue();
89 | end;
90 | result := TCalculationWrapper.NumbersWrapper.CreateVariable(ResVal);
91 | end;
92 |
93 | function TCalculationCalculator.Add(): TNumbersVariable;
94 | var
95 | AVar: TNumbersVariable;
96 | I: integer;
97 | ResVal : double;
98 | begin
99 | ResVal := 0.0;
100 | For I := 0 to FVariableList.Count - 1 do begin
101 | AVar := (FVariableList[I] as TNumbersVariable);
102 | ResVal := ResVal + AVar.GetValue();
103 | end;
104 | result := TCalculationWrapper.NumbersWrapper.CreateVariable(ResVal);
105 | end;
106 |
107 | end.
108 |
--------------------------------------------------------------------------------
/Examples/Injection/Calculation_component/Implementations/Pascal/calculation.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | calculation_createcalculator
3 | calculation_getversion
4 | calculation_getlasterror
5 | calculation_releaseinstance
6 | calculation_acquireinstance
7 | calculation_injectcomponent
8 | calculation_getsymbollookupmethod
9 | calculation_calculator_enlistvariable
10 | calculation_calculator_getenlistedvariable
11 | calculation_calculator_clearvariables
12 | calculation_calculator_multiply
13 | calculation_calculator_add
14 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated CMakeLists file for the development of Numbers library.
10 |
11 | Interface version: 1.0.0
12 |
13 |
14 | ]]
15 |
16 | cmake_minimum_required(VERSION 3.5)
17 |
18 | ### The implementation of the Numbers library component
19 | project(Numbers)
20 |
21 | set (CMAKE_CXX_STANDARD 11)
22 |
23 | # The location of autogenerated interfaces
24 | set(CMAKE_CURRENT_AUTOGENERATED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Interfaces)
25 |
26 | file(GLOB NUMBERS_SRC
27 | ${CMAKE_CURRENT_SOURCE_DIR}/Stub/*.cpp
28 | )
29 | file(GLOB NUMBERS_HDR
30 | ${CMAKE_CURRENT_SOURCE_DIR}/Stub/*.hpp
31 | )
32 | set(NUMBERS_SRC ${NUMBERS_SRC} ${NUMBERS_SRC}
33 | ${CMAKE_CURRENT_AUTOGENERATED_DIR}/numbers_interfaceexception.cpp
34 | ${CMAKE_CURRENT_AUTOGENERATED_DIR}/numbers_interfacewrapper.cpp
35 | )
36 |
37 | add_library(numbers SHARED ${NUMBERS_SRC})
38 | # Do not prefix the binary's name with "lib" on Unix systems:
39 | set_target_properties(numbers PROPERTIES PREFIX "" IMPORT_PREFIX "" )
40 | # The following two properties are crucial to reduce the number of undesirably exported symbols
41 | set_target_properties(numbers PROPERTIES CXX_VISIBILITY_PRESET hidden)
42 | set_target_properties(numbers PROPERTIES VISIBILITY_INLINES_HIDDEN ON)
43 | # This makes sure symbols are exported
44 | target_compile_options(numbers PRIVATE "-D__NUMBERS_EXPORTS")
45 | target_include_directories(numbers PRIVATE ${CMAKE_CURRENT_AUTOGENERATED_DIR})
46 | target_include_directories(numbers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Stub)
47 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Cpp/Interfaces/numbers_interfaceexception.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ Implementation file with the basic internal
10 | exception type in order to allow an easy use of Numbers library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 |
17 | #include
18 |
19 | #include "numbers_interfaceexception.hpp"
20 |
21 | /*************************************************************************************************************************
22 | Class ENumbersInterfaceException
23 | **************************************************************************************************************************/
24 | ENumbersInterfaceException::ENumbersInterfaceException(NumbersResult errorCode)
25 | : m_errorMessage("Numbers Error " + std::to_string (errorCode))
26 | {
27 | m_errorCode = errorCode;
28 | }
29 |
30 | ENumbersInterfaceException::ENumbersInterfaceException(NumbersResult errorCode, std::string errorMessage)
31 | : m_errorMessage(errorMessage + " (" + std::to_string (errorCode) + ")")
32 | {
33 | m_errorCode = errorCode;
34 | }
35 |
36 | NumbersResult ENumbersInterfaceException::getErrorCode ()
37 | {
38 | return m_errorCode;
39 | }
40 |
41 | const char * ENumbersInterfaceException::what () const noexcept
42 | {
43 | return m_errorMessage.c_str();
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Cpp/Interfaces/numbers_interfaceexception.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ Header file with the basic internal
10 | exception type in order to allow an easy use of Numbers library
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #ifndef __NUMBERS_INTERFACEEXCEPTION_HEADER
17 | #define __NUMBERS_INTERFACEEXCEPTION_HEADER
18 |
19 | #include
20 | #include
21 | #include "numbers_types.hpp"
22 |
23 | /*************************************************************************************************************************
24 | Class ENumbersInterfaceException
25 | **************************************************************************************************************************/
26 |
27 |
28 | class ENumbersInterfaceException : public std::exception {
29 | protected:
30 | /**
31 | * Error code for the Exception.
32 | */
33 | NumbersResult m_errorCode;
34 | /**
35 | * Error message for the Exception.
36 | */
37 | std::string m_errorMessage;
38 |
39 | public:
40 | /**
41 | * Exception Constructor.
42 | */
43 | ENumbersInterfaceException(NumbersResult errorCode);
44 |
45 | /**
46 | * Custom Exception Constructor.
47 | */
48 | ENumbersInterfaceException(NumbersResult errorCode, std::string errorMessage);
49 |
50 | /**
51 | * Returns error code
52 | */
53 | NumbersResult getErrorCode();
54 | /**
55 | * Returns error message
56 | */
57 | const char* what() const noexcept override;
58 | };
59 |
60 | #endif // __NUMBERS_INTERFACEEXCEPTION_HEADER
61 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Cpp/Stub/numbers.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated C++ implementation file in order to allow easy
10 | development of Numbers library. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | */
15 |
16 | #include "numbers_abi.hpp"
17 | #include "numbers_interfaces.hpp"
18 | #include "numbers_interfaceexception.hpp"
19 |
20 | #include "numbers_variable.hpp"
21 |
22 | using namespace Numbers;
23 | using namespace Numbers::Impl;
24 |
25 | IVariable * CWrapper::CreateVariable(const Numbers_double dInitialValue)
26 | {
27 | return new CVariable(dInitialValue);
28 | }
29 |
30 | void CWrapper::GetVersion(Numbers_uint32 & nMajor, Numbers_uint32 & nMinor, Numbers_uint32 & nMicro)
31 | {
32 | nMajor = NUMBERS_VERSION_MAJOR;
33 | nMinor = NUMBERS_VERSION_MINOR;
34 | nMicro = NUMBERS_VERSION_MICRO;
35 | }
36 |
37 | bool CWrapper::GetLastError(IBase* pInstance, std::string & sErrorMessage)
38 | {
39 | if (pInstance) {
40 | return pInstance->GetLastErrorMessage(sErrorMessage);
41 | }
42 | else {
43 | throw ENumbersInterfaceException(NUMBERS_ERROR_INVALIDPARAM);
44 | }
45 | }
46 |
47 | void CWrapper::ReleaseInstance(IBase* pInstance)
48 | {
49 | IBase::ReleaseBaseClassInterface(pInstance);
50 | }
51 |
52 | void CWrapper::AcquireInstance(IBase* pInstance)
53 | {
54 | IBase::AcquireBaseClassInterface(pInstance);
55 | }
56 |
57 |
58 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Cpp/Stub/numbers_base.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is a stub class definition of CBase
8 |
9 | */
10 |
11 | #include "numbers_base.hpp"
12 | #include "numbers_interfaceexception.hpp"
13 |
14 | // Include custom headers here.
15 |
16 |
17 | using namespace Numbers::Impl;
18 |
19 | /*************************************************************************************************************************
20 | Class definition of CBase
21 | **************************************************************************************************************************/
22 |
23 | bool CBase::GetLastErrorMessage(std::string & sErrorMessage)
24 | {
25 | if (m_pErrors && !m_pErrors->empty()) {
26 | sErrorMessage = m_pErrors->back();
27 | return true;
28 | } else {
29 | sErrorMessage = "";
30 | return false;
31 | }
32 | }
33 |
34 | void CBase::ClearErrorMessages()
35 | {
36 | m_pErrors.reset();
37 | }
38 |
39 | void CBase::RegisterErrorMessage(const std::string & sErrorMessage)
40 | {
41 | if (!m_pErrors) {
42 | m_pErrors.reset(new std::list());
43 | }
44 | m_pErrors->clear();
45 | m_pErrors->push_back(sErrorMessage);
46 | }
47 |
48 | void CBase::IncRefCount()
49 | {
50 | ++m_nReferenceCount;
51 | }
52 |
53 | bool CBase::DecRefCount()
54 | {
55 | m_nReferenceCount--;
56 | if (!m_nReferenceCount) {;
57 | delete this;
58 | return true;
59 | }
60 | return false;
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Cpp/Stub/numbers_base.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of CBase
8 |
9 | */
10 |
11 |
12 | #ifndef __NUMBERS_BASE
13 | #define __NUMBERS_BASE
14 |
15 | #include "numbers_interfaces.hpp"
16 | #include
17 | #include
18 | #include
19 |
20 |
21 | // Include custom headers here.
22 |
23 |
24 | namespace Numbers {
25 | namespace Impl {
26 |
27 |
28 | /*************************************************************************************************************************
29 | Class declaration of CBase
30 | **************************************************************************************************************************/
31 |
32 | class CBase : public virtual IBase {
33 | private:
34 |
35 | std::unique_ptr> m_pErrors;
36 | Numbers_uint32 m_nReferenceCount = 1;
37 |
38 | /**
39 | * Put private members here.
40 | */
41 |
42 | protected:
43 |
44 | /**
45 | * Put protected members here.
46 | */
47 |
48 | public:
49 |
50 | /**
51 | * Put additional public members here. They will not be visible in the external API.
52 | */
53 |
54 | bool GetLastErrorMessage(std::string & sErrorMessage);
55 |
56 | void ClearErrorMessages();
57 |
58 | void RegisterErrorMessage(const std::string & sErrorMessage);
59 |
60 | void IncRefCount();
61 |
62 | bool DecRefCount();
63 |
64 |
65 | /**
66 | * Public member functions to implement.
67 | */
68 |
69 | };
70 |
71 | } // namespace Impl
72 | } // namespace Numbers
73 |
74 | #endif // __NUMBERS_BASE
75 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Cpp/Stub/numbers_variable.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is a stub class definition of CVariable
8 |
9 | */
10 |
11 | #include "numbers_variable.hpp"
12 | #include "numbers_interfaceexception.hpp"
13 |
14 | // Include custom headers here.
15 |
16 |
17 | using namespace Numbers::Impl;
18 |
19 | /*************************************************************************************************************************
20 | Class definition of CVariable
21 | **************************************************************************************************************************/
22 |
23 | CVariable::CVariable(double dInitialValue)
24 | : m_dValue(dInitialValue)
25 | {
26 |
27 | }
28 |
29 | Numbers_double CVariable::GetValue()
30 | {
31 | return m_dValue;
32 | }
33 |
34 | void CVariable::SetValue(const Numbers_double dValue)
35 | {
36 | m_dValue = dValue;
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Cpp/Stub/numbers_variable.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of CVariable
8 |
9 | */
10 |
11 |
12 | #ifndef __NUMBERS_VARIABLE
13 | #define __NUMBERS_VARIABLE
14 |
15 | #include "numbers_interfaces.hpp"
16 |
17 | // Parent classes
18 | #include "numbers_base.hpp"
19 | #ifdef _MSC_VER
20 | #pragma warning(push)
21 | #pragma warning(disable : 4250)
22 | #endif
23 |
24 | // Include custom headers here.
25 |
26 |
27 | namespace Numbers {
28 | namespace Impl {
29 |
30 |
31 | /*************************************************************************************************************************
32 | Class declaration of CVariable
33 | **************************************************************************************************************************/
34 |
35 | class CVariable : public virtual IVariable, public virtual CBase {
36 | private:
37 |
38 | double m_dValue;
39 |
40 | protected:
41 |
42 | /**
43 | * Put protected members here.
44 | */
45 |
46 | public:
47 |
48 | /**
49 | * Put additional public members here. They will not be visible in the external API.
50 | */
51 | CVariable(double dInitialValue);
52 |
53 | /**
54 | * Public member functions to implement.
55 | */
56 |
57 | Numbers_double GetValue();
58 |
59 | void SetValue(const Numbers_double dValue);
60 |
61 | };
62 |
63 | } // namespace Impl
64 | } // namespace Numbers
65 |
66 | #ifdef _MSC_VER
67 | #pragma warning(pop)
68 | #endif
69 | #endif // __NUMBERS_VARIABLE
70 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Pascal/Interfaces/numbers.lpr:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal project file in order to allow easy
10 | development of Numbers library.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | library numbers;
18 |
19 | uses
20 | {$IFDEF UNIX}
21 | cthreads,
22 | {$ENDIF UNIX}
23 | syncobjs,
24 | numbers_types,
25 | numbers_exports,
26 | Classes,
27 | sysutils;
28 |
29 | exports
30 | numbers_variable_getvalue,
31 | numbers_variable_setvalue,
32 | numbers_createvariable,
33 | numbers_getversion,
34 | numbers_getlasterror,
35 | numbers_releaseinstance,
36 | numbers_acquireinstance,
37 | numbers_getsymbollookupmethod;
38 |
39 | begin
40 |
41 | end.
42 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Pascal/Interfaces/numbers_interfaces.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal interface definition file in order to allow easy
10 | development of Numbers library. The functions in this file need to be implemented. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | {$INTERFACES CORBA}
18 | unit numbers_interfaces;
19 |
20 | interface
21 |
22 | uses
23 | numbers_types,
24 | Classes,
25 | sysutils;
26 |
27 |
28 | type
29 |
30 | (*************************************************************************************************************************
31 | Interface definition for Base
32 | **************************************************************************************************************************)
33 |
34 | INumbersBase = interface
35 | ['{52FDFC07-2182-454F-963F-5F0F9A621D72}']
36 |
37 | function GetLastErrorMessage(out AErrorMessage: String): Boolean;
38 | procedure ClearErrorMessages();
39 | procedure RegisterErrorMessage(const AErrorMessage: String);
40 | procedure IncRefCount();
41 | function DecRefCount(): Boolean;
42 | end;
43 |
44 |
45 | (*************************************************************************************************************************
46 | Interface definition for Variable
47 | **************************************************************************************************************************)
48 |
49 | INumbersVariable = interface(INumbersBase)
50 | ['{9566C74D-1003-4C4D-BBBB-0407D1E2C649}']
51 |
52 | function GetValue(): Double;
53 | procedure SetValue(const AValue: Double);
54 | end;
55 |
56 | implementation
57 |
58 | end.
59 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Pascal/Interfaces/numbers_types.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal type definition file in order to allow easy
10 | development of Numbers library. The functions in this file need to be implemented. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | unit numbers_types;
18 |
19 | interface
20 |
21 | uses
22 | Classes,
23 | sysutils;
24 |
25 | (*************************************************************************************************************************
26 | Version definition for Numbers
27 | **************************************************************************************************************************)
28 |
29 | const
30 | NUMBERS_VERSION_MAJOR = 1;
31 | NUMBERS_VERSION_MINOR = 0;
32 | NUMBERS_VERSION_MICRO = 0;
33 | NUMBERS_VERSION_PRERELEASEINFO = '';
34 | NUMBERS_VERSION_BUILDINFO = '';
35 |
36 |
37 | (*************************************************************************************************************************
38 | General type definitions
39 | **************************************************************************************************************************)
40 |
41 | type
42 | TNumbersResult = Cardinal;
43 | TNumbersHandle = Pointer;
44 |
45 | PNumbersResult = ^TNumbersResult;
46 | PNumbersHandle = ^TNumbersHandle;
47 |
48 | (*************************************************************************************************************************
49 | Error Constants for Numbers
50 | **************************************************************************************************************************)
51 |
52 | const
53 | NUMBERS_SUCCESS = 0;
54 | NUMBERS_ERROR_NOTIMPLEMENTED = 1;
55 | NUMBERS_ERROR_INVALIDPARAM = 2;
56 | NUMBERS_ERROR_INVALIDCAST = 3;
57 | NUMBERS_ERROR_BUFFERTOOSMALL = 4;
58 | NUMBERS_ERROR_GENERICEXCEPTION = 5;
59 | NUMBERS_ERROR_COULDNOTLOADLIBRARY = 6;
60 | NUMBERS_ERROR_COULDNOTFINDLIBRARYEXPORT = 7;
61 | NUMBERS_ERROR_INCOMPATIBLEBINARYVERSION = 8;
62 |
63 |
64 | implementation
65 |
66 | end.
67 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Pascal/Stub/numbers_impl.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
8 |
9 | Abstract: This is an autogenerated Pascal implementation file in order to allow easy
10 | development of Numbers library. It needs to be generated only once.
11 |
12 | Interface version: 1.0.0
13 |
14 | *)
15 |
16 | {$MODE DELPHI}
17 | Unit numbers_impl;
18 |
19 | interface
20 |
21 | uses
22 | numbers_types,
23 | numbers_exception,
24 | numbers_interfaces,
25 | numbers_impl_variable,
26 | Classes,
27 | sysutils;
28 |
29 | type
30 | TNumbersWrapper = class(TObject)
31 | public
32 | class function CreateVariable(const AInitialValue: Double): TObject;
33 | class procedure GetVersion(out AMajor: Cardinal; out AMinor: Cardinal; out AMicro: Cardinal);
34 | class function GetLastError(AInstance: TObject; out AErrorMessage: String): Boolean;
35 | class procedure ReleaseInstance(AInstance: TObject);
36 | class procedure AcquireInstance(AInstance: TObject);
37 | end;
38 |
39 |
40 | implementation
41 |
42 | class function TNumbersWrapper.CreateVariable(const AInitialValue: Double): TObject;
43 | begin
44 | result := TNumbersVariable.Create(AInitialValue);
45 | end;
46 |
47 | class procedure TNumbersWrapper.GetVersion(out AMajor: Cardinal; out AMinor: Cardinal; out AMicro: Cardinal);
48 | begin
49 | AMajor := NUMBERS_VERSION_MAJOR;
50 | AMinor := NUMBERS_VERSION_MINOR;
51 | AMicro := NUMBERS_VERSION_MICRO;
52 | end;
53 |
54 | class function TNumbersWrapper.GetLastError(AInstance: TObject; out AErrorMessage: String): Boolean;
55 | begin
56 | result := false;
57 | if supports(AInstance, INumbersBase) then
58 | result := (AInstance as INumbersBase).GetLastErrorMessage(AErrorMessage);
59 | end;
60 |
61 | class procedure TNumbersWrapper.ReleaseInstance(AInstance: TObject);
62 | begin
63 | (AInstance as INumbersBase).DecRefCount();
64 | end;
65 |
66 | class procedure TNumbersWrapper.AcquireInstance(AInstance: TObject);
67 | begin
68 | (AInstance as INumbersBase).IncRefCount();
69 | end;
70 |
71 |
72 | end.
73 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Pascal/Stub/numbers_impl_base.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of TNumbersBase
8 |
9 | *)
10 |
11 | {$MODE DELPHI}
12 | unit numbers_impl_base;
13 |
14 | interface
15 |
16 | uses
17 | numbers_types,
18 | numbers_interfaces,
19 | numbers_exception,
20 | Classes,
21 | sysutils;
22 |
23 | type
24 | TNumbersBase = class(TObject, INumbersBase)
25 | private
26 | FMessages: TStringList;
27 | FReferenceCount: integer;
28 |
29 | protected
30 |
31 | public
32 | constructor Create();
33 | destructor Destroy(); override;
34 | function GetLastErrorMessage(out AErrorMessage: String): Boolean;
35 | procedure ClearErrorMessages();
36 | procedure RegisterErrorMessage(const AErrorMessage: String);
37 | procedure IncRefCount();
38 | function DecRefCount(): Boolean;
39 | end;
40 |
41 | implementation
42 |
43 | constructor TNumbersBase.Create();
44 | begin
45 | inherited Create();
46 | FMessages := TStringList.Create();
47 | FReferenceCount := 1;
48 | end;
49 |
50 | destructor TNumbersBase.Destroy();
51 | begin
52 | FreeAndNil(FMessages);
53 | inherited Destroy();
54 | end;
55 |
56 | function TNumbersBase.GetLastErrorMessage(out AErrorMessage: String): Boolean;
57 | begin
58 | result := (FMessages.Count>0);
59 | if (result) then
60 | AErrorMessage := FMessages[FMessages.Count-1];
61 | end;
62 |
63 | procedure TNumbersBase.ClearErrorMessages();
64 | begin
65 | FMessages.Clear();
66 | end;
67 |
68 | procedure TNumbersBase.RegisterErrorMessage(const AErrorMessage: String);
69 | begin
70 | FMessages.Clear();
71 | FMessages.Add(AErrorMessage);
72 | end;
73 |
74 | procedure TNumbersBase.IncRefCount();
75 | begin
76 | inc(FReferenceCount);
77 | end;
78 |
79 | function TNumbersBase.DecRefCount(): Boolean;
80 | begin
81 | dec(FReferenceCount);
82 | if (FReferenceCount = 0) then begin
83 | result := true;
84 | self.Destroy();
85 | end;
86 | result := false;
87 | end;
88 |
89 | end.
90 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Pascal/Stub/numbers_impl_variable.pas:
--------------------------------------------------------------------------------
1 | (*++
2 |
3 | Copyright (C) 2019 Numbers developers
4 |
5 | All rights reserved.
6 |
7 | Abstract: This is the class declaration of TNumbersVariable
8 |
9 | *)
10 |
11 | {$MODE DELPHI}
12 | unit numbers_impl_variable;
13 |
14 | interface
15 |
16 | uses
17 | numbers_types,
18 | numbers_interfaces,
19 | numbers_exception,
20 | numbers_impl_base,
21 | Classes,
22 | sysutils;
23 |
24 | type
25 | TNumbersVariable = class(TNumbersBase, INumbersVariable)
26 | private
27 | FValue : double;
28 | protected
29 |
30 | public
31 | constructor Create(AInitialValue: double);
32 | function GetValue(): Double;
33 | procedure SetValue(const AValue: Double);
34 | end;
35 |
36 | implementation
37 |
38 | constructor TNumbersVariable.Create(AInitialValue: double);
39 | begin
40 | inherited Create();
41 | FValue := AInitialValue;
42 | end;
43 |
44 | function TNumbersVariable.GetValue(): Double;
45 | begin
46 | result := FValue;
47 | end;
48 |
49 | procedure TNumbersVariable.SetValue(const AValue: Double);
50 | begin
51 | FValue := AValue;
52 | end;
53 |
54 | end.
55 |
--------------------------------------------------------------------------------
/Examples/Injection/Numbers_component/Implementations/Pascal/numbers.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | numbers_createvariable
3 | numbers_getversion
4 | numbers_getlasterror
5 | numbers_releaseinstance
6 | numbers_acquireinstance
7 | numbers_getsymbollookupmethod
8 | numbers_variable_getvalue
9 | numbers_variable_setvalue
10 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/.gitignore:
--------------------------------------------------------------------------------
1 | OptClass_component
2 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Examples/Cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated CMake Project that demonstrates the
9 | usage of the C++ bindings of Optional Class Library
10 |
11 | Interface version: 1.0.0
12 |
13 |
14 | ]]
15 |
16 | cmake_minimum_required(VERSION 3.5)
17 |
18 | set(CMAKE_CURRENT_BINDING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Bindings/Cpp)
19 | project(OptClassExample_CPPImplicit)
20 | set(CMAKE_CXX_STANDARD 11)
21 | add_executable(OptClassExample_CPPImplicit "${CMAKE_CURRENT_SOURCE_DIR}/OptClass_example.cpp")
22 | find_library(OPTCLASSLOCATION optclass "D:/PUBLIC/AutomaticComponentToolkit/Examples/OptionalClass//OptClass_component/Bindings/Cpp/../../Implementations/*/*/*")
23 | target_link_libraries(OptClassExample_CPPImplicit ${OPTCLASSLOCATION})
24 | target_include_directories(OptClassExample_CPPImplicit PRIVATE "${CMAKE_CURRENT_BINDING_DIR}")
25 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Examples/Cpp/OptClass_example.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated C++ application that demonstrates the
9 | usage of the C++ bindings of Optional Class Library
10 |
11 | Interface version: 1.0.0
12 |
13 | */
14 |
15 | #include
16 | #include "optclass_implicit.hpp"
17 |
18 |
19 | int main()
20 | {
21 | try
22 | {
23 | auto wrapper = OptClass::CWrapper::loadLibrary();
24 | OptClass_uint32 nMajor, nMinor, nMicro;
25 | wrapper->GetVersion(nMajor, nMinor, nMicro);
26 | std::cout << "OptClass.Version = " << nMajor << "." << nMinor << "." << nMicro;
27 | std::cout << std::endl;
28 | }
29 | catch (std::exception &e)
30 | {
31 | std::cout << e.what() << std::endl;
32 | return 1;
33 | }
34 | return 0;
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Examples/CppDynamic/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated CMake Project that demonstrates the
9 | usage of the Dynamic C++ bindings of Optional Class Library
10 |
11 | Interface version: 1.0.0
12 |
13 |
14 | ]]
15 |
16 | cmake_minimum_required(VERSION 3.5)
17 |
18 | set(CMAKE_CURRENT_BINDING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Bindings/CppDynamic)
19 | project(OptClassExample_CPPDynamic)
20 | set(CMAKE_CXX_STANDARD 11)
21 | add_executable(OptClassExample_CPPDynamic "${CMAKE_CURRENT_SOURCE_DIR}/OptClass_example.cpp")
22 | if (UNIX)
23 | target_link_libraries(OptClassExample_CPPDynamic ${CMAKE_DL_LIBS})
24 | endif (UNIX)
25 | target_include_directories(OptClassExample_CPPDynamic PRIVATE "${CMAKE_CURRENT_BINDING_DIR}")
26 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Examples/CppDynamic/OptClass_example.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated C++ application that demonstrates the
9 | usage of the Dynamic C++ bindings of Optional Class Library
10 |
11 | Interface version: 1.0.0
12 |
13 | */
14 |
15 | #include
16 | #include "optclass_dynamic.hpp"
17 |
18 |
19 | int main()
20 | {
21 | try
22 | {
23 | std::string libpath = (""); // TODO: put the location of the OptClass-library file here.
24 | auto wrapper = OptClass::CWrapper::loadLibrary(libpath + "/optclass.dll"); // TODO: add correct suffix of the library
25 | OptClass_uint32 nMajor, nMinor, nMicro;
26 | wrapper->GetVersion(nMajor, nMinor, nMicro);
27 | std::cout << "OptClass.Version = " << nMajor << "." << nMinor << "." << nMicro;
28 | std::cout << std::endl;
29 |
30 | wrapper->CreateInstanceWithName("A");
31 | auto baseA = wrapper->FindInstanceA("A");
32 | if (baseA == nullptr) {
33 | std::cout << "Error: Expected to find Instance \"A\"." << std::endl;
34 | return 1;
35 | }
36 |
37 | OptClass::PBase baseB;
38 | wrapper->FindInstanceB("DoesNotExist", baseB);
39 | if (baseB != nullptr) {
40 | std::cout << "Error: Did not expect to find Instance \"DoesNotExist\"." << std::endl;
41 | return 1;
42 | }
43 |
44 | if (!wrapper->UseInstanceMaybe(baseA.get())) {
45 | std::cout << "Error: Expected to use Instance \"A\"." << std::endl;
46 | return 1;
47 | }
48 | if (wrapper->UseInstanceMaybe(baseB.get())) {
49 | std::cout << "Error: Did not expect to use Instance \"DoesNotExist\"." << std::endl;
50 | return 1;
51 | }
52 |
53 | std::cout << "Passed." << std::endl;
54 | }
55 | catch (std::exception &e)
56 | {
57 | std::cout << e.what() << std::endl;
58 | return 1;
59 | }
60 | return 0;
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Examples/Go/OptClass_example._go:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated Go application that demonstrates the
9 | usage of the Go bindings of Optional Class Library
10 |
11 | Interface version: 1.0.0
12 |
13 | */
14 |
15 |
16 | package main
17 |
18 | import (
19 | "fmt"
20 | "log"
21 | "../../Bindings/Go"
22 | )
23 |
24 | func main() {
25 | wrapper, err := optclass.OptClassLoadWrapper("../../Implementations/Cpp/build/Debug/optclass.dll") // TODO: add-path here
26 | if (err != nil) {
27 | log.Fatal(err)
28 | }
29 |
30 | nMajor, nMinor, nMicro, err := wrapper.GetVersion()
31 | if (err != nil) {
32 | log.Fatal(err)
33 | }
34 | versionString := fmt.Sprintf("optclass.version = %d.%d.%d", nMajor, nMinor, nMicro)
35 |
36 | fmt.Println(versionString)
37 |
38 | err = wrapper.CreateInstanceWithName("A")
39 | if (err != nil) {
40 | log.Fatal(err)
41 | }
42 |
43 | baseA, err := wrapper.FindInstanceA("A")
44 | if (err != nil) {
45 | log.Fatal(err)
46 | }
47 | if (!baseA.Handle.IsValid()) {
48 | log.Fatal("Error: Expected to find Instance \"A\".")
49 | }
50 | baseB, err := wrapper.FindInstanceB("DoesNotExist")
51 | if (err != nil) {
52 | log.Fatal(err)
53 | }
54 | if (baseB.Handle.IsValid()) {
55 | log.Fatal("Error: Did not expect to find Instance \"DoesNotExist\".")
56 | }
57 |
58 | usedA, err := wrapper.UseInstanceMaybe(baseA.Handle)
59 | if (err != nil) {
60 | log.Fatal(err)
61 | }
62 | if (!usedA) {
63 | log.Fatal("Error: Expected to use Instance \"A\".")
64 | }
65 |
66 | usedB, err := wrapper.UseInstanceMaybe(baseB.Handle)
67 | if (err != nil) {
68 | log.Fatal(err)
69 | }
70 | if (usedB) {
71 | log.Fatal("Error: Did not expect to use Instance \"DoesNotExist\".")
72 | }
73 |
74 | fmt.Println("Passed.")
75 | }
76 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Examples/Python/OptClass_Example.py:
--------------------------------------------------------------------------------
1 | '''++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated Python application that demonstrates the
9 | usage of the Python bindings of Optional Class Library
10 |
11 | Interface version: 1.0.0
12 |
13 | '''
14 |
15 |
16 | import os
17 | import sys
18 | sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "Bindings", "Python"))
19 | import OptClass
20 |
21 |
22 | def main():
23 | libpath = '' # TODO add the location of the shared library binary here
24 | wrapper = OptClass.Wrapper(libraryName = os.path.join(libpath, "projectoptclass"))
25 |
26 | major, minor, micro = wrapper.GetVersion()
27 | print("OptClass version: {:d}.{:d}.{:d}".format(major, minor, micro), end="")
28 | print("")
29 |
30 | wrapper.CreateInstanceWithName("A")
31 | baseA = wrapper.FindInstanceA("A")
32 | if baseA is None:
33 | print("Error: Expected to find Instance \"A\".")
34 | return 1
35 |
36 | baseB = wrapper.FindInstanceB("DoesNotExist")
37 | if baseB is not None:
38 | print("Error: Did not expect to find Instance \"DoesNotExist\".")
39 | return 1
40 |
41 | if not wrapper.UseInstanceMaybe(baseA):
42 | print("Error: Expected to use Instance \"A\".")
43 | return 1
44 |
45 | if wrapper.UseInstanceMaybe(baseB):
46 | print("Error: Expected to use Instance \"DoesNotExist\".")
47 | return 1
48 |
49 | print("Passed.")
50 |
51 | if __name__ == "__main__":
52 | try:
53 | main()
54 | except OptClass.EOptClassException as e:
55 | print(e)
56 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Implementations/Cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated CMakeLists file for the development of Optional Class Library.
9 |
10 | Interface version: 1.0.0
11 |
12 |
13 | ]]
14 |
15 | cmake_minimum_required(VERSION 3.5)
16 |
17 | ### The implementation of the Optional Class Library component
18 | project(OptClass)
19 |
20 | set (CMAKE_CXX_STANDARD 11)
21 |
22 | # The location of autogenerated interfaces
23 | set(CMAKE_CURRENT_AUTOGENERATED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Interfaces)
24 |
25 | file(GLOB OPTCLASS_SRC
26 | ${CMAKE_CURRENT_SOURCE_DIR}/Stub/*.cpp
27 | )
28 | file(GLOB OPTCLASS_HDR
29 | ${CMAKE_CURRENT_SOURCE_DIR}/Stub/*.hpp
30 | )
31 | set(OPTCLASS_SRC ${OPTCLASS_SRC} ${OPTCLASS_SRC}
32 | ${CMAKE_CURRENT_AUTOGENERATED_DIR}/optclass_interfaceexception.cpp
33 | ${CMAKE_CURRENT_AUTOGENERATED_DIR}/optclass_interfacewrapper.cpp
34 | ${CMAKE_CURRENT_AUTOGENERATED_DIR}/optclass_interfacejournal.cpp
35 | )
36 |
37 | add_library(optclass SHARED ${OPTCLASS_SRC})
38 | # Do not prefix the binary's name with "lib" on Unix systems:
39 | set_target_properties(optclass PROPERTIES PREFIX "" IMPORT_PREFIX "" )
40 | # The following two properties are crucial to reduce the number of undesirably exported symbols
41 | set_target_properties(optclass PROPERTIES CXX_VISIBILITY_PRESET hidden)
42 | set_target_properties(optclass PROPERTIES VISIBILITY_INLINES_HIDDEN ON)
43 | # This makes sure symbols are exported
44 | target_compile_options(optclass PRIVATE "-D__OPTCLASS_EXPORTS")
45 | target_include_directories(optclass PRIVATE ${CMAKE_CURRENT_AUTOGENERATED_DIR})
46 | target_include_directories(optclass PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Stub)
47 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Implementations/Cpp/Interfaces/optclass_interfaceexception.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated C++ Implementation file with the basic internal
9 | exception type in order to allow an easy use of Optional Class Library
10 |
11 | Interface version: 1.0.0
12 |
13 | */
14 |
15 |
16 | #include
17 |
18 | #include "optclass_interfaceexception.hpp"
19 |
20 | /*************************************************************************************************************************
21 | Class EOptClassInterfaceException
22 | **************************************************************************************************************************/
23 | EOptClassInterfaceException::EOptClassInterfaceException(OptClassResult errorCode)
24 | : m_errorMessage("OptClass Error " + std::to_string (errorCode))
25 | {
26 | m_errorCode = errorCode;
27 | }
28 |
29 | EOptClassInterfaceException::EOptClassInterfaceException(OptClassResult errorCode, std::string errorMessage)
30 | : m_errorMessage(errorMessage + " (" + std::to_string (errorCode) + ")")
31 | {
32 | m_errorCode = errorCode;
33 | }
34 |
35 | OptClassResult EOptClassInterfaceException::getErrorCode ()
36 | {
37 | return m_errorCode;
38 | }
39 |
40 | const char * EOptClassInterfaceException::what () const noexcept
41 | {
42 | return m_errorMessage.c_str();
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Implementations/Cpp/Interfaces/optclass_interfaceexception.hpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated C++ Header file with the basic internal
9 | exception type in order to allow an easy use of Optional Class Library
10 |
11 | Interface version: 1.0.0
12 |
13 | */
14 |
15 | #ifndef __OPTCLASS_INTERFACEEXCEPTION_HEADER
16 | #define __OPTCLASS_INTERFACEEXCEPTION_HEADER
17 |
18 | #include
19 | #include
20 | #include "optclass_types.hpp"
21 |
22 | /*************************************************************************************************************************
23 | Class EOptClassInterfaceException
24 | **************************************************************************************************************************/
25 |
26 |
27 | class EOptClassInterfaceException : public std::exception {
28 | protected:
29 | /**
30 | * Error code for the Exception.
31 | */
32 | OptClassResult m_errorCode;
33 | /**
34 | * Error message for the Exception.
35 | */
36 | std::string m_errorMessage;
37 |
38 | public:
39 | /**
40 | * Exception Constructor.
41 | */
42 | EOptClassInterfaceException(OptClassResult errorCode);
43 |
44 | /**
45 | * Custom Exception Constructor.
46 | */
47 | EOptClassInterfaceException(OptClassResult errorCode, std::string errorMessage);
48 |
49 | /**
50 | * Returns error code
51 | */
52 | OptClassResult getErrorCode();
53 | /**
54 | * Returns error message
55 | */
56 | const char* what() const noexcept override;
57 | };
58 |
59 | #endif // __OPTCLASS_INTERFACEEXCEPTION_HEADER
60 |
--------------------------------------------------------------------------------
/Examples/OptionalClass/OptClass_component/Implementations/Cpp/Stub/optclass.cpp:
--------------------------------------------------------------------------------
1 | /*++
2 |
3 | Copyright (C) 2019 ACT Developers
4 |
5 |
6 | This file has been generated by the Automatic Component Toolkit (ACT) version 1.6.0.
7 |
8 | Abstract: This is an autogenerated C++ implementation file in order to allow easy
9 | development of Optional Class Library. It needs to be generated only once.
10 |
11 | Interface version: 1.0.0
12 |
13 | */
14 |
15 | #include "optclass_abi.hpp"
16 | #include "optclass_interfaces.hpp"
17 | #include "optclass_interfaceexception.hpp"
18 |
19 | #include "optclass_base.hpp"
20 |
21 | #include