diff --git a/Examples/RTTI/RTTI.xml b/Examples/RTTI/RTTI.xml
new file mode 100644
index 00000000..fb42fe2d
--- /dev/null
+++ b/Examples/RTTI/RTTI.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_abi.hpp b/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_abi.hpp
new file mode 100644
index 00000000..ae254c13
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_abi.hpp
@@ -0,0 +1,196 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++-Header file in order to allow an easy
+ use of RTTI
+
+Interface version: 1.0.0
+
+*/
+
+#ifndef __RTTI_HEADER_CPP
+#define __RTTI_HEADER_CPP
+
+#ifdef __RTTI_EXPORTS
+#ifdef _WIN32
+#define RTTI_DECLSPEC __declspec (dllexport)
+#else // _WIN32
+#define RTTI_DECLSPEC __attribute__((visibility("default")))
+#endif // _WIN32
+#else // __RTTI_EXPORTS
+#define RTTI_DECLSPEC
+#endif // __RTTI_EXPORTS
+
+#include "rtti_types.hpp"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*************************************************************************************************************************
+ Class definition for Base
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Animal
+**************************************************************************************************************************/
+
+/**
+* Get the name of the animal
+*
+* @param[in] pAnimal - Animal instance.
+* @param[in] nResultBufferSize - size of the buffer (including trailing 0)
+* @param[out] pResultNeededChars - will be filled with the count of the written bytes, or needed buffer size.
+* @param[out] pResultBuffer - buffer of , may be NULL
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_animal_name(RTTI_Animal pAnimal, const RTTI_uint32 nResultBufferSize, RTTI_uint32* pResultNeededChars, char * pResultBuffer);
+
+/*************************************************************************************************************************
+ Class definition for Mammal
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Reptile
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Giraffe
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Tiger
+**************************************************************************************************************************/
+
+/**
+* Roar like a tiger
+*
+* @param[in] pTiger - Tiger instance.
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_tiger_roar(RTTI_Tiger pTiger);
+
+/*************************************************************************************************************************
+ Class definition for Snake
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Turtle
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for AnimalIterator
+**************************************************************************************************************************/
+
+/**
+* Return next animal
+*
+* @param[in] pAnimalIterator - AnimalIterator instance.
+* @param[out] pAnimal -
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_animaliterator_getnextanimal(RTTI_AnimalIterator pAnimalIterator, RTTI_Animal * pAnimal);
+
+/*************************************************************************************************************************
+ Class definition for Zoo
+**************************************************************************************************************************/
+
+/**
+* Return an iterator over all zoo animals
+*
+* @param[in] pZoo - Zoo instance.
+* @param[out] pIterator -
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_zoo_iterator(RTTI_Zoo pZoo, RTTI_AnimalIterator * pIterator);
+
+/*************************************************************************************************************************
+ Global functions
+**************************************************************************************************************************/
+
+/**
+* retrieves the binary version of this library.
+*
+* @param[out] pMajor - returns the major version of this library
+* @param[out] pMinor - returns the minor version of this library
+* @param[out] pMicro - returns the micro version of this library
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_getversion(RTTI_uint32 * pMajor, RTTI_uint32 * pMinor, RTTI_uint32 * pMicro);
+
+/**
+* Returns the last error recorded on this object
+*
+* @param[in] pInstance - Instance Handle
+* @param[in] nErrorMessageBufferSize - size of the buffer (including trailing 0)
+* @param[out] pErrorMessageNeededChars - will be filled with the count of the written bytes, or needed buffer size.
+* @param[out] pErrorMessageBuffer - buffer of Message of the last error, may be NULL
+* @param[out] pHasError - Is there a last error to query
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_getlasterror(RTTI_Base pInstance, const RTTI_uint32 nErrorMessageBufferSize, RTTI_uint32* pErrorMessageNeededChars, char * pErrorMessageBuffer, bool * pHasError);
+
+/**
+* Releases shared ownership of an Instance
+*
+* @param[in] pInstance - Instance Handle
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_releaseinstance(RTTI_Base pInstance);
+
+/**
+* Acquires shared ownership of an Instance
+*
+* @param[in] pInstance - Instance Handle
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_acquireinstance(RTTI_Base pInstance);
+
+/**
+* Injects an imported component for usage within this component
+*
+* @param[in] pNameSpace - NameSpace of the injected component
+* @param[in] pSymbolAddressMethod - Address of the SymbolAddressMethod of the injected component
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_injectcomponent(const char * pNameSpace, RTTI_pvoid pSymbolAddressMethod);
+
+/**
+* Returns the address of the SymbolLookupMethod
+*
+* @param[out] pSymbolLookupMethod - Address of the SymbolAddressMethod
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_getsymbollookupmethod(RTTI_pvoid * pSymbolLookupMethod);
+
+/**
+* Test whether an object implements a given interface
+*
+* @param[in] pObject - Instance Handle
+* @param[in] nClassHashBufferSize - Number of elements in buffer
+* @param[in] pClassHashBuffer - uint8 buffer of Hashed class name of the interface to test
+* @param[out] pImplementsInterface - Will be set to true if pInstance implements the interface, false otherwise
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_implementsinterface(RTTI_Base pObject, RTTI_uint64 nClassHashBufferSize, const RTTI_uint8 * pClassHashBuffer, bool * pImplementsInterface);
+
+/**
+* Create a new zoo with animals
+*
+* @param[out] pInstance -
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_createzoo(RTTI_Zoo * pInstance);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __RTTI_HEADER_CPP
+
diff --git a/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_dynamic.h b/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_dynamic.h
new file mode 100644
index 00000000..859684e1
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_dynamic.h
@@ -0,0 +1,199 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++-Header file in order to allow an easy
+ use of RTTI
+
+Interface version: 1.0.0
+
+*/
+
+#ifndef __RTTI_DYNAMICHEADER_CPPTYPES
+#define __RTTI_DYNAMICHEADER_CPPTYPES
+
+#include "rtti_types.hpp"
+
+
+
+/*************************************************************************************************************************
+ Class definition for Base
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Animal
+**************************************************************************************************************************/
+
+/**
+* Get the name of the animal
+*
+* @param[in] pAnimal - Animal instance.
+* @param[in] nResultBufferSize - size of the buffer (including trailing 0)
+* @param[out] pResultNeededChars - will be filled with the count of the written bytes, or needed buffer size.
+* @param[out] pResultBuffer - buffer of , may be NULL
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIAnimal_NamePtr) (RTTI_Animal pAnimal, const RTTI_uint32 nResultBufferSize, RTTI_uint32* pResultNeededChars, char * pResultBuffer);
+
+/*************************************************************************************************************************
+ Class definition for Mammal
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Reptile
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Giraffe
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Tiger
+**************************************************************************************************************************/
+
+/**
+* Roar like a tiger
+*
+* @param[in] pTiger - Tiger instance.
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTITiger_RoarPtr) (RTTI_Tiger pTiger);
+
+/*************************************************************************************************************************
+ Class definition for Snake
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Turtle
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for AnimalIterator
+**************************************************************************************************************************/
+
+/**
+* Return next animal
+*
+* @param[in] pAnimalIterator - AnimalIterator instance.
+* @param[out] pAnimal -
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIAnimalIterator_GetNextAnimalPtr) (RTTI_AnimalIterator pAnimalIterator, RTTI_Animal * pAnimal);
+
+/*************************************************************************************************************************
+ Class definition for Zoo
+**************************************************************************************************************************/
+
+/**
+* Return an iterator over all zoo animals
+*
+* @param[in] pZoo - Zoo instance.
+* @param[out] pIterator -
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIZoo_IteratorPtr) (RTTI_Zoo pZoo, RTTI_AnimalIterator * pIterator);
+
+/*************************************************************************************************************************
+ Global functions
+**************************************************************************************************************************/
+
+/**
+* retrieves the binary version of this library.
+*
+* @param[out] pMajor - returns the major version of this library
+* @param[out] pMinor - returns the minor version of this library
+* @param[out] pMicro - returns the micro version of this library
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIGetVersionPtr) (RTTI_uint32 * pMajor, RTTI_uint32 * pMinor, RTTI_uint32 * pMicro);
+
+/**
+* Returns the last error recorded on this object
+*
+* @param[in] pInstance - Instance Handle
+* @param[in] nErrorMessageBufferSize - size of the buffer (including trailing 0)
+* @param[out] pErrorMessageNeededChars - will be filled with the count of the written bytes, or needed buffer size.
+* @param[out] pErrorMessageBuffer - buffer of Message of the last error, may be NULL
+* @param[out] pHasError - Is there a last error to query
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIGetLastErrorPtr) (RTTI_Base pInstance, const RTTI_uint32 nErrorMessageBufferSize, RTTI_uint32* pErrorMessageNeededChars, char * pErrorMessageBuffer, bool * pHasError);
+
+/**
+* Releases shared ownership of an Instance
+*
+* @param[in] pInstance - Instance Handle
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIReleaseInstancePtr) (RTTI_Base pInstance);
+
+/**
+* Acquires shared ownership of an Instance
+*
+* @param[in] pInstance - Instance Handle
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIAcquireInstancePtr) (RTTI_Base pInstance);
+
+/**
+* Injects an imported component for usage within this component
+*
+* @param[in] pNameSpace - NameSpace of the injected component
+* @param[in] pSymbolAddressMethod - Address of the SymbolAddressMethod of the injected component
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIInjectComponentPtr) (const char * pNameSpace, RTTI_pvoid pSymbolAddressMethod);
+
+/**
+* Returns the address of the SymbolLookupMethod
+*
+* @param[out] pSymbolLookupMethod - Address of the SymbolAddressMethod
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIGetSymbolLookupMethodPtr) (RTTI_pvoid * pSymbolLookupMethod);
+
+/**
+* Test whether an object implements a given interface
+*
+* @param[in] pObject - Instance Handle
+* @param[in] nClassHashBufferSize - Number of elements in buffer
+* @param[in] pClassHashBuffer - uint8 buffer of Hashed class name of the interface to test
+* @param[out] pImplementsInterface - Will be set to true if pInstance implements the interface, false otherwise
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTIImplementsInterfacePtr) (RTTI_Base pObject, RTTI_uint64 nClassHashBufferSize, const RTTI_uint8 * pClassHashBuffer, bool * pImplementsInterface);
+
+/**
+* Create a new zoo with animals
+*
+* @param[out] pInstance -
+* @return error code or 0 (success)
+*/
+typedef RTTIResult (*PRTTICreateZooPtr) (RTTI_Zoo * pInstance);
+
+/*************************************************************************************************************************
+ Function Table Structure
+**************************************************************************************************************************/
+
+typedef struct {
+ void * m_LibraryHandle;
+ PRTTIAnimal_NamePtr m_Animal_Name;
+ PRTTITiger_RoarPtr m_Tiger_Roar;
+ PRTTIAnimalIterator_GetNextAnimalPtr m_AnimalIterator_GetNextAnimal;
+ PRTTIZoo_IteratorPtr m_Zoo_Iterator;
+ PRTTIGetVersionPtr m_GetVersion;
+ PRTTIGetLastErrorPtr m_GetLastError;
+ PRTTIReleaseInstancePtr m_ReleaseInstance;
+ PRTTIAcquireInstancePtr m_AcquireInstance;
+ PRTTIInjectComponentPtr m_InjectComponent;
+ PRTTIGetSymbolLookupMethodPtr m_GetSymbolLookupMethod;
+ PRTTIImplementsInterfacePtr m_ImplementsInterface;
+ PRTTICreateZooPtr m_CreateZoo;
+} sRTTIDynamicWrapperTable;
+
+#endif // __RTTI_DYNAMICHEADER_CPPTYPES
+
diff --git a/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_dynamic.hpp b/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_dynamic.hpp
new file mode 100644
index 00000000..9606ce35
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_dynamic.hpp
@@ -0,0 +1,1130 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++-Header file in order to allow an easy
+ use of RTTI
+
+Interface version: 1.0.0
+
+*/
+
+#ifndef __RTTI_CPPHEADER_DYNAMIC_CPP
+#define __RTTI_CPPHEADER_DYNAMIC_CPP
+
+#include "rtti_types.hpp"
+#include "rtti_dynamic.h"
+
+
+#ifdef _WIN32
+#include
+#else // _WIN32
+#include
+#endif // _WIN32
+#include
+#include
+#include
+#include
+#include
+
+namespace RTTI {
+
+/*************************************************************************************************************************
+ Forward Declaration of all classes
+**************************************************************************************************************************/
+class CWrapper;
+class CBase;
+class CAnimal;
+class CMammal;
+class CReptile;
+class CGiraffe;
+class CTiger;
+class CSnake;
+class CTurtle;
+class CAnimalIterator;
+class CZoo;
+
+/*************************************************************************************************************************
+ Declaration of deprecated class types
+**************************************************************************************************************************/
+typedef CWrapper CRTTIWrapper;
+typedef CBase CRTTIBase;
+typedef CAnimal CRTTIAnimal;
+typedef CMammal CRTTIMammal;
+typedef CReptile CRTTIReptile;
+typedef CGiraffe CRTTIGiraffe;
+typedef CTiger CRTTITiger;
+typedef CSnake CRTTISnake;
+typedef CTurtle CRTTITurtle;
+typedef CAnimalIterator CRTTIAnimalIterator;
+typedef CZoo CRTTIZoo;
+
+/*************************************************************************************************************************
+ Declaration of shared pointer types
+**************************************************************************************************************************/
+typedef std::shared_ptr PWrapper;
+typedef std::shared_ptr PBase;
+typedef std::shared_ptr PAnimal;
+typedef std::shared_ptr PMammal;
+typedef std::shared_ptr PReptile;
+typedef std::shared_ptr PGiraffe;
+typedef std::shared_ptr PTiger;
+typedef std::shared_ptr PSnake;
+typedef std::shared_ptr PTurtle;
+typedef std::shared_ptr PAnimalIterator;
+typedef std::shared_ptr PZoo;
+
+/*************************************************************************************************************************
+ Declaration of deprecated shared pointer types
+**************************************************************************************************************************/
+typedef PWrapper PRTTIWrapper;
+typedef PBase PRTTIBase;
+typedef PAnimal PRTTIAnimal;
+typedef PMammal PRTTIMammal;
+typedef PReptile PRTTIReptile;
+typedef PGiraffe PRTTIGiraffe;
+typedef PTiger PRTTITiger;
+typedef PSnake PRTTISnake;
+typedef PTurtle PRTTITurtle;
+typedef PAnimalIterator PRTTIAnimalIterator;
+typedef PZoo PRTTIZoo;
+
+/*************************************************************************************************************************
+ rtti_cast Definition
+**************************************************************************************************************************/
+template
+inline std::shared_ptr rtti_cast(PBase obj);
+
+using RTTI_ClassHash = std::array;
+
+/*************************************************************************************************************************
+ classParam Definition
+**************************************************************************************************************************/
+
+template class classParam {
+private:
+ const T* m_ptr;
+
+public:
+ classParam(const T* ptr)
+ : m_ptr (ptr)
+ {
+ }
+
+ classParam(std::shared_ptr sharedPtr)
+ : m_ptr (sharedPtr.get())
+ {
+ }
+
+ RTTIHandle GetHandle()
+ {
+ if (m_ptr != nullptr)
+ return m_ptr->handle();
+ return nullptr;
+ }
+};
+
+/*************************************************************************************************************************
+ Class ERTTIException
+**************************************************************************************************************************/
+class ERTTIException : public std::exception {
+protected:
+ /**
+ * Error code for the Exception.
+ */
+ RTTIResult m_errorCode;
+ /**
+ * Error message for the Exception.
+ */
+ std::string m_errorMessage;
+
+public:
+ /**
+ * Exception Constructor.
+ */
+ ERTTIException(RTTIResult errorCode, const std::string & sErrorMessage)
+ : m_errorMessage("RTTI Error " + std::to_string(errorCode) + " (" + sErrorMessage + ")")
+ {
+ m_errorCode = errorCode;
+ }
+
+ /**
+ * Returns error code
+ */
+ RTTIResult getErrorCode() const noexcept
+ {
+ return m_errorCode;
+ }
+
+ /**
+ * Returns error message
+ */
+ const char* what() const noexcept
+ {
+ return m_errorMessage.c_str();
+ }
+
+};
+
+/*************************************************************************************************************************
+ Class CInputVector
+**************************************************************************************************************************/
+template
+class CInputVector {
+private:
+
+ const T* m_data;
+ size_t m_size;
+
+public:
+
+ CInputVector( const std::vector& vec)
+ : m_data( vec.data() ), m_size( vec.size() )
+ {
+ }
+
+ CInputVector( const T* in_data, size_t in_size)
+ : m_data( in_data ), m_size(in_size )
+ {
+ }
+
+ const T* data() const
+ {
+ return m_data;
+ }
+
+ size_t size() const
+ {
+ return m_size;
+ }
+
+};
+
+// declare deprecated class name
+template
+using CRTTIInputVector = CInputVector;
+
+/*************************************************************************************************************************
+ Class CWrapper
+**************************************************************************************************************************/
+class CWrapper {
+public:
+
+ CWrapper(void* pSymbolLookupMethod)
+ {
+ CheckError(nullptr, initWrapperTable(&m_WrapperTable));
+ CheckError(nullptr, loadWrapperTableFromSymbolLookupMethod(&m_WrapperTable, pSymbolLookupMethod));
+
+ CheckError(nullptr, checkBinaryVersion());
+ }
+
+ CWrapper(const std::string &sFileName)
+ {
+ CheckError(nullptr, initWrapperTable(&m_WrapperTable));
+ CheckError(nullptr, loadWrapperTable(&m_WrapperTable, sFileName.c_str()));
+
+ CheckError(nullptr, checkBinaryVersion());
+ }
+
+ static PWrapper loadLibrary(const std::string &sFileName)
+ {
+ return std::make_shared(sFileName);
+ }
+
+ static PWrapper loadLibraryFromSymbolLookupMethod(void* pSymbolLookupMethod)
+ {
+ return std::make_shared(pSymbolLookupMethod);
+ }
+
+ ~CWrapper()
+ {
+ releaseWrapperTable(&m_WrapperTable);
+ }
+
+ inline void CheckError(CBase * pBaseClass, RTTIResult nResult);
+
+ inline void GetVersion(RTTI_uint32 & nMajor, RTTI_uint32 & nMinor, RTTI_uint32 & nMicro);
+ inline bool GetLastError(classParam pInstance, std::string & sErrorMessage);
+ inline void ReleaseInstance(classParam pInstance);
+ inline void AcquireInstance(classParam pInstance);
+ inline void InjectComponent(const std::string & sNameSpace, const RTTI_pvoid pSymbolAddressMethod);
+ inline RTTI_pvoid GetSymbolLookupMethod();
+ inline bool ImplementsInterface(classParam pObject, const CInputVector & ClassHashBuffer);
+ inline PZoo CreateZoo();
+
+private:
+ sRTTIDynamicWrapperTable m_WrapperTable;
+
+ RTTIResult checkBinaryVersion()
+ {
+ RTTI_uint32 nMajor, nMinor, nMicro;
+ GetVersion(nMajor, nMinor, nMicro);
+ if ( (nMajor != RTTI_VERSION_MAJOR) || (nMinor < RTTI_VERSION_MINOR) ) {
+ return RTTI_ERROR_INCOMPATIBLEBINARYVERSION;
+ }
+ return RTTI_SUCCESS;
+ }
+ RTTIResult initWrapperTable(sRTTIDynamicWrapperTable * pWrapperTable);
+ RTTIResult releaseWrapperTable(sRTTIDynamicWrapperTable * pWrapperTable);
+ RTTIResult loadWrapperTable(sRTTIDynamicWrapperTable * pWrapperTable, const char * pLibraryFileName);
+ RTTIResult loadWrapperTableFromSymbolLookupMethod(sRTTIDynamicWrapperTable * pWrapperTable, void* pSymbolLookupMethod);
+
+ friend class CBase;
+ friend class CAnimal;
+ friend class CMammal;
+ friend class CReptile;
+ friend class CGiraffe;
+ friend class CTiger;
+ friend class CSnake;
+ friend class CTurtle;
+ friend class CAnimalIterator;
+ friend class CZoo;
+
+};
+
+
+/*************************************************************************************************************************
+ Class CBase
+**************************************************************************************************************************/
+class CBase {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+protected:
+ /* Wrapper Object that created the class. */
+ CWrapper * m_pWrapper;
+ /* Handle to Instance in library*/
+ RTTIHandle m_pHandle;
+
+ /* Checks for an Error code and raises Exceptions */
+ void CheckError(RTTIResult nResult)
+ {
+ if (m_pWrapper != nullptr)
+ m_pWrapper->CheckError(this, nResult);
+ }
+public:
+ /**
+ * CBase::CBase - Constructor for Base class.
+ */
+ CBase(CWrapper * pWrapper, RTTIHandle pHandle)
+ : m_pWrapper(pWrapper), m_pHandle(pHandle)
+ {
+ }
+
+ /**
+ * CBase::~CBase - Destructor for Base class.
+ */
+ virtual ~CBase()
+ {
+ if (m_pWrapper != nullptr)
+ m_pWrapper->ReleaseInstance(this);
+ m_pWrapper = nullptr;
+ }
+
+ /**
+ * CBase::handle - Returns handle to instance.
+ */
+ RTTIHandle handle() const
+ {
+ return m_pHandle;
+ }
+
+ /**
+ * CBase::wrapper - Returns wrapper instance.
+ */
+ CWrapper * wrapper() const
+ {
+ return m_pWrapper;
+ }
+
+ friend class CWrapper;
+};
+
+/*************************************************************************************************************************
+ Class CAnimal
+**************************************************************************************************************************/
+class CAnimal : public CBase {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CAnimal::CAnimal - Constructor for Animal class.
+ */
+ CAnimal(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CBase(pWrapper, pHandle)
+ {
+ }
+
+ inline std::string Name();
+};
+
+/*************************************************************************************************************************
+ Class CMammal
+**************************************************************************************************************************/
+class CMammal : public CAnimal {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CMammal::CMammal - Constructor for Mammal class.
+ */
+ CMammal(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CAnimal(pWrapper, pHandle)
+ {
+ }
+
+};
+
+/*************************************************************************************************************************
+ Class CReptile
+**************************************************************************************************************************/
+class CReptile : public CAnimal {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CReptile::CReptile - Constructor for Reptile class.
+ */
+ CReptile(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CAnimal(pWrapper, pHandle)
+ {
+ }
+
+};
+
+/*************************************************************************************************************************
+ Class CGiraffe
+**************************************************************************************************************************/
+class CGiraffe : public CMammal {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CGiraffe::CGiraffe - Constructor for Giraffe class.
+ */
+ CGiraffe(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CMammal(pWrapper, pHandle)
+ {
+ }
+
+};
+
+/*************************************************************************************************************************
+ Class CTiger
+**************************************************************************************************************************/
+class CTiger : public CMammal {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CTiger::CTiger - Constructor for Tiger class.
+ */
+ CTiger(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CMammal(pWrapper, pHandle)
+ {
+ }
+
+ inline void Roar();
+};
+
+/*************************************************************************************************************************
+ Class CSnake
+**************************************************************************************************************************/
+class CSnake : public CReptile {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CSnake::CSnake - Constructor for Snake class.
+ */
+ CSnake(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CReptile(pWrapper, pHandle)
+ {
+ }
+
+};
+
+/*************************************************************************************************************************
+ Class CTurtle
+**************************************************************************************************************************/
+class CTurtle : public CReptile {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CTurtle::CTurtle - Constructor for Turtle class.
+ */
+ CTurtle(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CReptile(pWrapper, pHandle)
+ {
+ }
+
+};
+
+/*************************************************************************************************************************
+ Class CAnimalIterator
+**************************************************************************************************************************/
+class CAnimalIterator : public CBase {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CAnimalIterator::CAnimalIterator - Constructor for AnimalIterator class.
+ */
+ CAnimalIterator(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CBase(pWrapper, pHandle)
+ {
+ }
+
+ inline PAnimal GetNextAnimal();
+};
+
+/*************************************************************************************************************************
+ Class CZoo
+**************************************************************************************************************************/
+class CZoo : public CBase {
+public:
+ static inline const std::string &getClassName();
+ static inline const RTTI_ClassHash &getClassHash();
+
+ /**
+ * CZoo::CZoo - Constructor for Zoo class.
+ */
+ CZoo(CWrapper* pWrapper, RTTIHandle pHandle)
+ : CBase(pWrapper, pHandle)
+ {
+ }
+
+ inline PAnimalIterator Iterator();
+};
+
+/*************************************************************************************************************************
+ RTTI static getClassName implementations
+**************************************************************************************************************************/
+
+ const std::string &CBase::getClassName()
+ {
+ static const std::string s_sClassName = "Base";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CBase::getClassHash()
+ {
+ // MD5(Base): 095A1B43EFFEC73955E31E790438DE49
+ static const RTTI_ClassHash s_sClassHash = { 0x09, 0x5A, 0x1B, 0x43, 0xEF, 0xFE, 0xC7, 0x39, 0x55, 0xE3, 0x1E, 0x79, 0x04, 0x38, 0xDE, 0x49, };
+ return s_sClassHash;
+ }
+
+ const std::string &CAnimal::getClassName()
+ {
+ static const std::string s_sClassName = "Animal";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CAnimal::getClassHash()
+ {
+ // MD5(Animal): 161E7CE7BFDC89AB4B9F52C1D4C94212
+ static const RTTI_ClassHash s_sClassHash = { 0x16, 0x1E, 0x7C, 0xE7, 0xBF, 0xDC, 0x89, 0xAB, 0x4B, 0x9F, 0x52, 0xC1, 0xD4, 0xC9, 0x42, 0x12, };
+ return s_sClassHash;
+ }
+
+ const std::string &CMammal::getClassName()
+ {
+ static const std::string s_sClassName = "Mammal";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CMammal::getClassHash()
+ {
+ // MD5(Mammal): 37426113D129E79F548F4C90930FA697
+ static const RTTI_ClassHash s_sClassHash = { 0x37, 0x42, 0x61, 0x13, 0xD1, 0x29, 0xE7, 0x9F, 0x54, 0x8F, 0x4C, 0x90, 0x93, 0x0F, 0xA6, 0x97, };
+ return s_sClassHash;
+ }
+
+ const std::string &CReptile::getClassName()
+ {
+ static const std::string s_sClassName = "Reptile";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CReptile::getClassHash()
+ {
+ // MD5(Reptile): AA645186A4B5F3F27952C2FA5485FAB2
+ static const RTTI_ClassHash s_sClassHash = { 0xAA, 0x64, 0x51, 0x86, 0xA4, 0xB5, 0xF3, 0xF2, 0x79, 0x52, 0xC2, 0xFA, 0x54, 0x85, 0xFA, 0xB2, };
+ return s_sClassHash;
+ }
+
+ const std::string &CGiraffe::getClassName()
+ {
+ static const std::string s_sClassName = "Giraffe";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CGiraffe::getClassHash()
+ {
+ // MD5(Giraffe): 427DEBB81D265A0EDD8789F30B11BEB6
+ static const RTTI_ClassHash s_sClassHash = { 0x42, 0x7D, 0xEB, 0xB8, 0x1D, 0x26, 0x5A, 0x0E, 0xDD, 0x87, 0x89, 0xF3, 0x0B, 0x11, 0xBE, 0xB6, };
+ return s_sClassHash;
+ }
+
+ const std::string &CTiger::getClassName()
+ {
+ static const std::string s_sClassName = "Tiger";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CTiger::getClassHash()
+ {
+ // MD5(Tiger): 454C9843110686BF6F67CE5115B66617
+ static const RTTI_ClassHash s_sClassHash = { 0x45, 0x4C, 0x98, 0x43, 0x11, 0x06, 0x86, 0xBF, 0x6F, 0x67, 0xCE, 0x51, 0x15, 0xB6, 0x66, 0x17, };
+ return s_sClassHash;
+ }
+
+ const std::string &CSnake::getClassName()
+ {
+ static const std::string s_sClassName = "Snake";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CSnake::getClassHash()
+ {
+ // MD5(Snake): DFA90F1B4EB3AFFBD3B46AF34ED2477C
+ static const RTTI_ClassHash s_sClassHash = { 0xDF, 0xA9, 0x0F, 0x1B, 0x4E, 0xB3, 0xAF, 0xFB, 0xD3, 0xB4, 0x6A, 0xF3, 0x4E, 0xD2, 0x47, 0x7C, };
+ return s_sClassHash;
+ }
+
+ const std::string &CTurtle::getClassName()
+ {
+ static const std::string s_sClassName = "Turtle";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CTurtle::getClassHash()
+ {
+ // MD5(Turtle): 06DEBA5908B007EB6F32D8D95F3F61B5
+ static const RTTI_ClassHash s_sClassHash = { 0x06, 0xDE, 0xBA, 0x59, 0x08, 0xB0, 0x07, 0xEB, 0x6F, 0x32, 0xD8, 0xD9, 0x5F, 0x3F, 0x61, 0xB5, };
+ return s_sClassHash;
+ }
+
+ const std::string &CAnimalIterator::getClassName()
+ {
+ static const std::string s_sClassName = "AnimalIterator";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CAnimalIterator::getClassHash()
+ {
+ // MD5(AnimalIterator): C2B36A84C6C032204E5C923C581071E7
+ static const RTTI_ClassHash s_sClassHash = { 0xC2, 0xB3, 0x6A, 0x84, 0xC6, 0xC0, 0x32, 0x20, 0x4E, 0x5C, 0x92, 0x3C, 0x58, 0x10, 0x71, 0xE7, };
+ return s_sClassHash;
+ }
+
+ const std::string &CZoo::getClassName()
+ {
+ static const std::string s_sClassName = "Zoo";
+ return s_sClassName;
+ }
+
+ const RTTI_ClassHash &CZoo::getClassHash()
+ {
+ // MD5(Zoo): BFA888A354DB97C7CBEFB9D050B94CA3
+ static const RTTI_ClassHash s_sClassHash = { 0xBF, 0xA8, 0x88, 0xA3, 0x54, 0xDB, 0x97, 0xC7, 0xCB, 0xEF, 0xB9, 0xD0, 0x50, 0xB9, 0x4C, 0xA3, };
+ return s_sClassHash;
+ }
+
+
+/*************************************************************************************************************************
+ RTTI cast implementation
+**************************************************************************************************************************/
+
+ template
+ std::shared_ptr rtti_cast(PBase pObj)
+ {
+ static_assert(std::is_convertible::value, "T must be convertible to RTTI::CBase");
+
+ if (pObj) {
+ CWrapper *pWrapper = pObj->wrapper();
+ const RTTI_ClassHash & ClassHash = T::getClassHash();
+ CInputVector ClassHashBuffer(ClassHash.data(), ClassHash.size());
+ if (pWrapper->ImplementsInterface(pObj.get(), ClassHashBuffer)) {
+ pWrapper->AcquireInstance(pObj);
+ return std::make_shared(pWrapper, pObj->handle());
+ }
+ }
+
+ return nullptr;
+ }
+
+ /**
+ * CWrapper::GetVersion - retrieves the binary version of this library.
+ * @param[out] nMajor - returns the major version of this library
+ * @param[out] nMinor - returns the minor version of this library
+ * @param[out] nMicro - returns the micro version of this library
+ */
+ inline void CWrapper::GetVersion(RTTI_uint32 & nMajor, RTTI_uint32 & nMinor, RTTI_uint32 & nMicro)
+ {
+ CheckError(nullptr,m_WrapperTable.m_GetVersion(&nMajor, &nMinor, &nMicro));
+ }
+
+ /**
+ * CWrapper::GetLastError - Returns the last error recorded on this object
+ * @param[in] pInstance - Instance Handle
+ * @param[out] sErrorMessage - Message of the last error
+ * @return Is there a last error to query
+ */
+ inline bool CWrapper::GetLastError(classParam pInstance, std::string & sErrorMessage)
+ {
+ RTTIHandle hInstance = pInstance.GetHandle();
+ RTTI_uint32 bytesNeededErrorMessage = 0;
+ RTTI_uint32 bytesWrittenErrorMessage = 0;
+ bool resultHasError = 0;
+ CheckError(nullptr,m_WrapperTable.m_GetLastError(hInstance, 0, &bytesNeededErrorMessage, nullptr, &resultHasError));
+ std::vector bufferErrorMessage(bytesNeededErrorMessage);
+ CheckError(nullptr,m_WrapperTable.m_GetLastError(hInstance, bytesNeededErrorMessage, &bytesWrittenErrorMessage, &bufferErrorMessage[0], &resultHasError));
+ sErrorMessage = std::string(&bufferErrorMessage[0]);
+
+ return resultHasError;
+ }
+
+ /**
+ * CWrapper::ReleaseInstance - Releases shared ownership of an Instance
+ * @param[in] pInstance - Instance Handle
+ */
+ inline void CWrapper::ReleaseInstance(classParam pInstance)
+ {
+ RTTIHandle hInstance = pInstance.GetHandle();
+ CheckError(nullptr,m_WrapperTable.m_ReleaseInstance(hInstance));
+ }
+
+ /**
+ * CWrapper::AcquireInstance - Acquires shared ownership of an Instance
+ * @param[in] pInstance - Instance Handle
+ */
+ inline void CWrapper::AcquireInstance(classParam pInstance)
+ {
+ RTTIHandle hInstance = pInstance.GetHandle();
+ CheckError(nullptr,m_WrapperTable.m_AcquireInstance(hInstance));
+ }
+
+ /**
+ * CWrapper::InjectComponent - Injects an imported component for usage within this component
+ * @param[in] sNameSpace - NameSpace of the injected component
+ * @param[in] pSymbolAddressMethod - Address of the SymbolAddressMethod of the injected component
+ */
+ inline void CWrapper::InjectComponent(const std::string & sNameSpace, const RTTI_pvoid pSymbolAddressMethod)
+ {
+ CheckError(nullptr,m_WrapperTable.m_InjectComponent(sNameSpace.c_str(), pSymbolAddressMethod));
+
+ bool bNameSpaceFound = false;
+ if (!bNameSpaceFound)
+ throw ERTTIException(RTTI_ERROR_COULDNOTLOADLIBRARY, "Unknown namespace " + sNameSpace);
+ }
+
+ /**
+ * CWrapper::GetSymbolLookupMethod - Returns the address of the SymbolLookupMethod
+ * @return Address of the SymbolAddressMethod
+ */
+ inline RTTI_pvoid CWrapper::GetSymbolLookupMethod()
+ {
+ RTTI_pvoid resultSymbolLookupMethod = 0;
+ CheckError(nullptr,m_WrapperTable.m_GetSymbolLookupMethod(&resultSymbolLookupMethod));
+
+ return resultSymbolLookupMethod;
+ }
+
+ /**
+ * CWrapper::ImplementsInterface - Test whether an object implements a given interface
+ * @param[in] pObject - Instance Handle
+ * @param[in] ClassHashBuffer - Hashed class name of the interface to test
+ * @return Will be set to true if pInstance implements the interface, false otherwise
+ */
+ inline bool CWrapper::ImplementsInterface(classParam pObject, const CInputVector & ClassHashBuffer)
+ {
+ RTTIHandle hObject = pObject.GetHandle();
+ bool resultImplementsInterface = 0;
+ CheckError(nullptr,m_WrapperTable.m_ImplementsInterface(hObject, (RTTI_uint64)ClassHashBuffer.size(), ClassHashBuffer.data(), &resultImplementsInterface));
+
+ return resultImplementsInterface;
+ }
+
+ /**
+ * CWrapper::CreateZoo - Create a new zoo with animals
+ * @return
+ */
+ inline PZoo CWrapper::CreateZoo()
+ {
+ RTTIHandle hInstance = nullptr;
+ CheckError(nullptr,m_WrapperTable.m_CreateZoo(&hInstance));
+
+ if (!hInstance) {
+ CheckError(nullptr,RTTI_ERROR_INVALIDPARAM);
+ }
+ return std::make_shared(this, hInstance);
+ }
+
+ inline void CWrapper::CheckError(CBase * pBaseClass, RTTIResult nResult)
+ {
+ if (nResult != 0) {
+ std::string sErrorMessage;
+ if (pBaseClass != nullptr) {
+ GetLastError(pBaseClass, sErrorMessage);
+ }
+ throw ERTTIException(nResult, sErrorMessage);
+ }
+ }
+
+
+ inline RTTIResult CWrapper::initWrapperTable(sRTTIDynamicWrapperTable * pWrapperTable)
+ {
+ if (pWrapperTable == nullptr)
+ return RTTI_ERROR_INVALIDPARAM;
+
+ pWrapperTable->m_LibraryHandle = nullptr;
+ pWrapperTable->m_Animal_Name = nullptr;
+ pWrapperTable->m_Tiger_Roar = nullptr;
+ pWrapperTable->m_AnimalIterator_GetNextAnimal = nullptr;
+ pWrapperTable->m_Zoo_Iterator = nullptr;
+ pWrapperTable->m_GetVersion = nullptr;
+ pWrapperTable->m_GetLastError = nullptr;
+ pWrapperTable->m_ReleaseInstance = nullptr;
+ pWrapperTable->m_AcquireInstance = nullptr;
+ pWrapperTable->m_InjectComponent = nullptr;
+ pWrapperTable->m_GetSymbolLookupMethod = nullptr;
+ pWrapperTable->m_ImplementsInterface = nullptr;
+ pWrapperTable->m_CreateZoo = nullptr;
+
+ return RTTI_SUCCESS;
+ }
+
+ inline RTTIResult CWrapper::releaseWrapperTable(sRTTIDynamicWrapperTable * pWrapperTable)
+ {
+ if (pWrapperTable == nullptr)
+ return RTTI_ERROR_INVALIDPARAM;
+
+ if (pWrapperTable->m_LibraryHandle != nullptr) {
+ #ifdef _WIN32
+ HMODULE hModule = (HMODULE) pWrapperTable->m_LibraryHandle;
+ FreeLibrary(hModule);
+ #else // _WIN32
+ dlclose(pWrapperTable->m_LibraryHandle);
+ #endif // _WIN32
+ return initWrapperTable(pWrapperTable);
+ }
+
+ return RTTI_SUCCESS;
+ }
+
+ inline RTTIResult CWrapper::loadWrapperTable(sRTTIDynamicWrapperTable * pWrapperTable, const char * pLibraryFileName)
+ {
+ if (pWrapperTable == nullptr)
+ return RTTI_ERROR_INVALIDPARAM;
+ if (pLibraryFileName == nullptr)
+ return RTTI_ERROR_INVALIDPARAM;
+
+ #ifdef _WIN32
+ // Convert filename to UTF16-string
+ int nLength = (int)strlen(pLibraryFileName);
+ int nBufferSize = nLength * 2 + 2;
+ std::vector wsLibraryFileName(nBufferSize);
+ int nResult = MultiByteToWideChar(CP_UTF8, 0, pLibraryFileName, nLength, &wsLibraryFileName[0], nBufferSize);
+ if (nResult == 0)
+ return RTTI_ERROR_COULDNOTLOADLIBRARY;
+
+ HMODULE hLibrary = LoadLibraryW(wsLibraryFileName.data());
+ if (hLibrary == 0)
+ return RTTI_ERROR_COULDNOTLOADLIBRARY;
+ #else // _WIN32
+ void* hLibrary = dlopen(pLibraryFileName, RTLD_LAZY);
+ if (hLibrary == 0)
+ return RTTI_ERROR_COULDNOTLOADLIBRARY;
+ dlerror();
+ #endif // _WIN32
+
+ #ifdef _WIN32
+ pWrapperTable->m_Animal_Name = (PRTTIAnimal_NamePtr) GetProcAddress(hLibrary, "rtti_animal_name");
+ #else // _WIN32
+ pWrapperTable->m_Animal_Name = (PRTTIAnimal_NamePtr) dlsym(hLibrary, "rtti_animal_name");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_Animal_Name == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_Tiger_Roar = (PRTTITiger_RoarPtr) GetProcAddress(hLibrary, "rtti_tiger_roar");
+ #else // _WIN32
+ pWrapperTable->m_Tiger_Roar = (PRTTITiger_RoarPtr) dlsym(hLibrary, "rtti_tiger_roar");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_Tiger_Roar == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_AnimalIterator_GetNextAnimal = (PRTTIAnimalIterator_GetNextAnimalPtr) GetProcAddress(hLibrary, "rtti_animaliterator_getnextanimal");
+ #else // _WIN32
+ pWrapperTable->m_AnimalIterator_GetNextAnimal = (PRTTIAnimalIterator_GetNextAnimalPtr) dlsym(hLibrary, "rtti_animaliterator_getnextanimal");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_AnimalIterator_GetNextAnimal == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_Zoo_Iterator = (PRTTIZoo_IteratorPtr) GetProcAddress(hLibrary, "rtti_zoo_iterator");
+ #else // _WIN32
+ pWrapperTable->m_Zoo_Iterator = (PRTTIZoo_IteratorPtr) dlsym(hLibrary, "rtti_zoo_iterator");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_Zoo_Iterator == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_GetVersion = (PRTTIGetVersionPtr) GetProcAddress(hLibrary, "rtti_getversion");
+ #else // _WIN32
+ pWrapperTable->m_GetVersion = (PRTTIGetVersionPtr) dlsym(hLibrary, "rtti_getversion");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_GetVersion == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_GetLastError = (PRTTIGetLastErrorPtr) GetProcAddress(hLibrary, "rtti_getlasterror");
+ #else // _WIN32
+ pWrapperTable->m_GetLastError = (PRTTIGetLastErrorPtr) dlsym(hLibrary, "rtti_getlasterror");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_GetLastError == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_ReleaseInstance = (PRTTIReleaseInstancePtr) GetProcAddress(hLibrary, "rtti_releaseinstance");
+ #else // _WIN32
+ pWrapperTable->m_ReleaseInstance = (PRTTIReleaseInstancePtr) dlsym(hLibrary, "rtti_releaseinstance");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_ReleaseInstance == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_AcquireInstance = (PRTTIAcquireInstancePtr) GetProcAddress(hLibrary, "rtti_acquireinstance");
+ #else // _WIN32
+ pWrapperTable->m_AcquireInstance = (PRTTIAcquireInstancePtr) dlsym(hLibrary, "rtti_acquireinstance");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_AcquireInstance == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_InjectComponent = (PRTTIInjectComponentPtr) GetProcAddress(hLibrary, "rtti_injectcomponent");
+ #else // _WIN32
+ pWrapperTable->m_InjectComponent = (PRTTIInjectComponentPtr) dlsym(hLibrary, "rtti_injectcomponent");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_InjectComponent == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_GetSymbolLookupMethod = (PRTTIGetSymbolLookupMethodPtr) GetProcAddress(hLibrary, "rtti_getsymbollookupmethod");
+ #else // _WIN32
+ pWrapperTable->m_GetSymbolLookupMethod = (PRTTIGetSymbolLookupMethodPtr) dlsym(hLibrary, "rtti_getsymbollookupmethod");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_GetSymbolLookupMethod == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_ImplementsInterface = (PRTTIImplementsInterfacePtr) GetProcAddress(hLibrary, "rtti_implementsinterface");
+ #else // _WIN32
+ pWrapperTable->m_ImplementsInterface = (PRTTIImplementsInterfacePtr) dlsym(hLibrary, "rtti_implementsinterface");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_ImplementsInterface == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ #ifdef _WIN32
+ pWrapperTable->m_CreateZoo = (PRTTICreateZooPtr) GetProcAddress(hLibrary, "rtti_createzoo");
+ #else // _WIN32
+ pWrapperTable->m_CreateZoo = (PRTTICreateZooPtr) dlsym(hLibrary, "rtti_createzoo");
+ dlerror();
+ #endif // _WIN32
+ if (pWrapperTable->m_CreateZoo == nullptr)
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ pWrapperTable->m_LibraryHandle = hLibrary;
+ return RTTI_SUCCESS;
+ }
+
+ inline RTTIResult CWrapper::loadWrapperTableFromSymbolLookupMethod(sRTTIDynamicWrapperTable * pWrapperTable, void* pSymbolLookupMethod)
+{
+ if (pWrapperTable == nullptr)
+ return RTTI_ERROR_INVALIDPARAM;
+ if (pSymbolLookupMethod == nullptr)
+ return RTTI_ERROR_INVALIDPARAM;
+
+ typedef RTTIResult(*SymbolLookupType)(const char*, void**);
+
+ SymbolLookupType pLookup = (SymbolLookupType)pSymbolLookupMethod;
+
+ RTTIResult eLookupError = RTTI_SUCCESS;
+ eLookupError = (*pLookup)("rtti_animal_name", (void**)&(pWrapperTable->m_Animal_Name));
+ if ( (eLookupError != 0) || (pWrapperTable->m_Animal_Name == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_tiger_roar", (void**)&(pWrapperTable->m_Tiger_Roar));
+ if ( (eLookupError != 0) || (pWrapperTable->m_Tiger_Roar == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_animaliterator_getnextanimal", (void**)&(pWrapperTable->m_AnimalIterator_GetNextAnimal));
+ if ( (eLookupError != 0) || (pWrapperTable->m_AnimalIterator_GetNextAnimal == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_zoo_iterator", (void**)&(pWrapperTable->m_Zoo_Iterator));
+ if ( (eLookupError != 0) || (pWrapperTable->m_Zoo_Iterator == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_getversion", (void**)&(pWrapperTable->m_GetVersion));
+ if ( (eLookupError != 0) || (pWrapperTable->m_GetVersion == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_getlasterror", (void**)&(pWrapperTable->m_GetLastError));
+ if ( (eLookupError != 0) || (pWrapperTable->m_GetLastError == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_releaseinstance", (void**)&(pWrapperTable->m_ReleaseInstance));
+ if ( (eLookupError != 0) || (pWrapperTable->m_ReleaseInstance == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_acquireinstance", (void**)&(pWrapperTable->m_AcquireInstance));
+ if ( (eLookupError != 0) || (pWrapperTable->m_AcquireInstance == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_injectcomponent", (void**)&(pWrapperTable->m_InjectComponent));
+ if ( (eLookupError != 0) || (pWrapperTable->m_InjectComponent == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_getsymbollookupmethod", (void**)&(pWrapperTable->m_GetSymbolLookupMethod));
+ if ( (eLookupError != 0) || (pWrapperTable->m_GetSymbolLookupMethod == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_implementsinterface", (void**)&(pWrapperTable->m_ImplementsInterface));
+ if ( (eLookupError != 0) || (pWrapperTable->m_ImplementsInterface == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ eLookupError = (*pLookup)("rtti_createzoo", (void**)&(pWrapperTable->m_CreateZoo));
+ if ( (eLookupError != 0) || (pWrapperTable->m_CreateZoo == nullptr) )
+ return RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT;
+
+ return RTTI_SUCCESS;
+}
+
+
+
+ /**
+ * Method definitions for class CBase
+ */
+
+ /**
+ * Method definitions for class CAnimal
+ */
+
+ /**
+ * CAnimal::Name - Get the name of the animal
+ * @return
+ */
+ std::string CAnimal::Name()
+ {
+ RTTI_uint32 bytesNeededResult = 0;
+ RTTI_uint32 bytesWrittenResult = 0;
+ CheckError(m_pWrapper->m_WrapperTable.m_Animal_Name(m_pHandle, 0, &bytesNeededResult, nullptr));
+ std::vector bufferResult(bytesNeededResult);
+ CheckError(m_pWrapper->m_WrapperTable.m_Animal_Name(m_pHandle, bytesNeededResult, &bytesWrittenResult, &bufferResult[0]));
+
+ return std::string(&bufferResult[0]);
+ }
+
+ /**
+ * Method definitions for class CMammal
+ */
+
+ /**
+ * Method definitions for class CReptile
+ */
+
+ /**
+ * Method definitions for class CGiraffe
+ */
+
+ /**
+ * Method definitions for class CTiger
+ */
+
+ /**
+ * CTiger::Roar - Roar like a tiger
+ */
+ void CTiger::Roar()
+ {
+ CheckError(m_pWrapper->m_WrapperTable.m_Tiger_Roar(m_pHandle));
+ }
+
+ /**
+ * Method definitions for class CSnake
+ */
+
+ /**
+ * Method definitions for class CTurtle
+ */
+
+ /**
+ * Method definitions for class CAnimalIterator
+ */
+
+ /**
+ * CAnimalIterator::GetNextAnimal - Return next animal
+ * @return
+ */
+ PAnimal CAnimalIterator::GetNextAnimal()
+ {
+ RTTIHandle hAnimal = nullptr;
+ CheckError(m_pWrapper->m_WrapperTable.m_AnimalIterator_GetNextAnimal(m_pHandle, &hAnimal));
+
+ if (hAnimal) {
+ return std::make_shared(m_pWrapper, hAnimal);
+ } else {
+ return nullptr;
+ }
+ }
+
+ /**
+ * Method definitions for class CZoo
+ */
+
+ /**
+ * CZoo::Iterator - Return an iterator over all zoo animals
+ * @return
+ */
+ PAnimalIterator CZoo::Iterator()
+ {
+ RTTIHandle hIterator = nullptr;
+ CheckError(m_pWrapper->m_WrapperTable.m_Zoo_Iterator(m_pHandle, &hIterator));
+
+ if (!hIterator) {
+ CheckError(RTTI_ERROR_INVALIDPARAM);
+ }
+ return std::make_shared(m_pWrapper, hIterator);
+ }
+
+} // namespace RTTI
+
+#endif // __RTTI_CPPHEADER_DYNAMIC_CPP
+
diff --git a/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_types.hpp b/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_types.hpp
new file mode 100644
index 00000000..19fec9a2
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_types.hpp
@@ -0,0 +1,125 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++-Header file with basic types in
+order to allow an easy use of RTTI
+
+Interface version: 1.0.0
+
+*/
+
+#ifndef __RTTI_TYPES_HEADER_CPP
+#define __RTTI_TYPES_HEADER_CPP
+
+
+/*************************************************************************************************************************
+ Scalar types definition
+**************************************************************************************************************************/
+
+#ifdef RTTI_USELEGACYINTEGERTYPES
+
+typedef unsigned char RTTI_uint8;
+typedef unsigned short RTTI_uint16 ;
+typedef unsigned int RTTI_uint32;
+typedef unsigned long long RTTI_uint64;
+typedef char RTTI_int8;
+typedef short RTTI_int16;
+typedef int RTTI_int32;
+typedef long long RTTI_int64;
+
+#else // RTTI_USELEGACYINTEGERTYPES
+
+#include
+
+typedef uint8_t RTTI_uint8;
+typedef uint16_t RTTI_uint16;
+typedef uint32_t RTTI_uint32;
+typedef uint64_t RTTI_uint64;
+typedef int8_t RTTI_int8;
+typedef int16_t RTTI_int16;
+typedef int32_t RTTI_int32;
+typedef int64_t RTTI_int64 ;
+
+#endif // RTTI_USELEGACYINTEGERTYPES
+
+typedef float RTTI_single;
+typedef double RTTI_double;
+
+/*************************************************************************************************************************
+ General type definitions
+**************************************************************************************************************************/
+
+typedef RTTI_int32 RTTIResult;
+typedef void * RTTIHandle;
+typedef void * RTTI_pvoid;
+
+/*************************************************************************************************************************
+ Version for RTTI
+**************************************************************************************************************************/
+
+#define RTTI_VERSION_MAJOR 1
+#define RTTI_VERSION_MINOR 0
+#define RTTI_VERSION_MICRO 0
+#define RTTI_VERSION_PRERELEASEINFO ""
+#define RTTI_VERSION_BUILDINFO ""
+
+/*************************************************************************************************************************
+ Error constants for RTTI
+**************************************************************************************************************************/
+
+#define RTTI_SUCCESS 0
+#define RTTI_ERROR_NOTIMPLEMENTED 1
+#define RTTI_ERROR_INVALIDPARAM 2
+#define RTTI_ERROR_INVALIDCAST 3
+#define RTTI_ERROR_BUFFERTOOSMALL 4
+#define RTTI_ERROR_GENERICEXCEPTION 5
+#define RTTI_ERROR_COULDNOTLOADLIBRARY 6
+#define RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT 7
+#define RTTI_ERROR_INCOMPATIBLEBINARYVERSION 8
+
+/*************************************************************************************************************************
+ Error strings for RTTI
+**************************************************************************************************************************/
+
+inline const char * RTTI_GETERRORSTRING (RTTIResult nErrorCode) {
+ switch (nErrorCode) {
+ case RTTI_SUCCESS: return "no error";
+ case RTTI_ERROR_NOTIMPLEMENTED: return "functionality not implemented";
+ case RTTI_ERROR_INVALIDPARAM: return "an invalid parameter was passed";
+ case RTTI_ERROR_INVALIDCAST: return "a type cast failed";
+ case RTTI_ERROR_BUFFERTOOSMALL: return "a provided buffer is too small";
+ case RTTI_ERROR_GENERICEXCEPTION: return "a generic exception occurred";
+ case RTTI_ERROR_COULDNOTLOADLIBRARY: return "the library could not be loaded";
+ case RTTI_ERROR_COULDNOTFINDLIBRARYEXPORT: return "a required exported symbol could not be found in the library";
+ case RTTI_ERROR_INCOMPATIBLEBINARYVERSION: return "the version of the binary interface does not match the bindings interface";
+ default: return "unknown error";
+ }
+}
+
+/*************************************************************************************************************************
+ Declaration of handle classes
+**************************************************************************************************************************/
+
+typedef RTTIHandle RTTI_Base;
+typedef RTTIHandle RTTI_Animal;
+typedef RTTIHandle RTTI_Mammal;
+typedef RTTIHandle RTTI_Reptile;
+typedef RTTIHandle RTTI_Giraffe;
+typedef RTTIHandle RTTI_Tiger;
+typedef RTTIHandle RTTI_Snake;
+typedef RTTIHandle RTTI_Turtle;
+typedef RTTIHandle RTTI_AnimalIterator;
+typedef RTTIHandle RTTI_Zoo;
+
+namespace RTTI {
+
+} // namespace RTTI;
+
+// define legacy C-names for enums, structs and function types
+
+#endif // __RTTI_TYPES_HEADER_CPP
diff --git a/Examples/RTTI/RTTI_component/Bindings/Python/RTTI.py b/Examples/RTTI/RTTI_component/Bindings/Python/RTTI.py
new file mode 100644
index 00000000..db3d6e2b
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Bindings/Python/RTTI.py
@@ -0,0 +1,523 @@
+'''++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated Python file in order to allow an easy
+ use of RTTI
+
+Interface version: 1.0.0
+
+'''
+
+
+import ctypes
+import platform
+import enum
+import os
+
+name = "rtti"
+
+'''Definition of domain specific exception
+'''
+class ERTTIException(Exception):
+ def __init__(self, code, message = ''):
+ self._code = code
+ self._message = message
+
+ def __str__(self):
+ if self._message:
+ return 'RTTIException ' + str(self._code) + ': '+ str(self._message)
+ return 'RTTIException ' + str(self._code)
+
+'''Definition of binding API version
+'''
+class BindingVersion(enum.IntEnum):
+ MAJOR = 1
+ MINOR = 0
+ MICRO = 0
+
+'''Definition Error Codes
+'''
+class ErrorCodes(enum.IntEnum):
+ SUCCESS = 0
+ NOTIMPLEMENTED = 1
+ INVALIDPARAM = 2
+ INVALIDCAST = 3
+ BUFFERTOOSMALL = 4
+ GENERICEXCEPTION = 5
+ COULDNOTLOADLIBRARY = 6
+ COULDNOTFINDLIBRARYEXPORT = 7
+ INCOMPATIBLEBINARYVERSION = 8
+
+'''Definition of Function Table
+'''
+class FunctionTable:
+ rtti_getversion = None
+ rtti_getlasterror = None
+ rtti_releaseinstance = None
+ rtti_acquireinstance = None
+ rtti_injectcomponent = None
+ rtti_getsymbollookupmethod = None
+ rtti_implementsinterface = None
+ rtti_createzoo = None
+ rtti_animal_name = None
+ rtti_tiger_roar = None
+ rtti_animaliterator_getnextanimal = None
+ rtti_zoo_iterator = None
+
+
+'''Wrapper Class Implementation
+'''
+class Wrapper:
+
+ def __init__(self, libraryName = None, symbolLookupMethodAddress = None):
+ ending = ''
+ if platform.system() == 'Windows':
+ ending = 'dll'
+ elif platform.system() == 'Linux':
+ ending = 'so'
+ elif platform.system() == 'Darwin':
+ ending = 'dylib'
+ else:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY)
+
+ if (not libraryName) and (not symbolLookupMethodAddress):
+ libraryName = os.path.join(os.path.dirname(os.path.realpath(__file__)),'rtti')
+
+ if libraryName is not None:
+ path = libraryName + '.' + ending
+ try:
+ self.lib = ctypes.CDLL(path)
+ except Exception as e:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(e) + '| "'+path + '"' )
+
+ self._loadFunctionTable()
+ elif symbolLookupMethodAddress is not None:
+ self.lib = FunctionTable()
+ self._loadFunctionTableFromMethod(symbolLookupMethodAddress)
+ else:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(e))
+
+ self._checkBinaryVersion()
+
+ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress):
+ try:
+ symbolLookupMethodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p))
+ symbolLookupMethod = symbolLookupMethodType(int(symbolLookupMethodAddress))
+
+ methodAddress = ctypes.c_void_p()
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_getversion")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32))
+ self.lib.rtti_getversion = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_getlasterror")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p, ctypes.POINTER(ctypes.c_bool))
+ self.lib.rtti_getlasterror = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_releaseinstance")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p)
+ self.lib.rtti_releaseinstance = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_acquireinstance")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p)
+ self.lib.rtti_acquireinstance = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_injectcomponent")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_char_p, ctypes.c_void_p)
+ self.lib.rtti_injectcomponent = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_getsymbollookupmethod")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.POINTER(ctypes.c_void_p))
+ self.lib.rtti_getsymbollookupmethod = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_implementsinterface")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint8), ctypes.POINTER(ctypes.c_bool))
+ self.lib.rtti_implementsinterface = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_createzoo")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.POINTER(ctypes.c_void_p))
+ self.lib.rtti_createzoo = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_animal_name")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p)
+ self.lib.rtti_animal_name = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_tiger_roar")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p)
+ self.lib.rtti_tiger_roar = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_animaliterator_getnextanimal")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p))
+ self.lib.rtti_animaliterator_getnextanimal = methodType(int(methodAddress.value))
+
+ err = symbolLookupMethod(ctypes.c_char_p(str.encode("rtti_zoo_iterator")), methodAddress)
+ if err != 0:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))
+ methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p))
+ self.lib.rtti_zoo_iterator = methodType(int(methodAddress.value))
+
+ except AttributeError as ae:
+ raise ERTTIException(ErrorCodes.COULDNOTFINDLIBRARYEXPORT, ae.args[0])
+
+ def _loadFunctionTable(self):
+ try:
+ self.lib.rtti_getversion.restype = ctypes.c_int32
+ self.lib.rtti_getversion.argtypes = [ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
+
+ self.lib.rtti_getlasterror.restype = ctypes.c_int32
+ self.lib.rtti_getlasterror.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p, ctypes.POINTER(ctypes.c_bool)]
+
+ self.lib.rtti_releaseinstance.restype = ctypes.c_int32
+ self.lib.rtti_releaseinstance.argtypes = [ctypes.c_void_p]
+
+ self.lib.rtti_acquireinstance.restype = ctypes.c_int32
+ self.lib.rtti_acquireinstance.argtypes = [ctypes.c_void_p]
+
+ self.lib.rtti_injectcomponent.restype = ctypes.c_int32
+ self.lib.rtti_injectcomponent.argtypes = [ctypes.c_char_p, ctypes.c_void_p]
+
+ self.lib.rtti_getsymbollookupmethod.restype = ctypes.c_int32
+ self.lib.rtti_getsymbollookupmethod.argtypes = [ctypes.POINTER(ctypes.c_void_p)]
+
+ self.lib.rtti_implementsinterface.restype = ctypes.c_int32
+ self.lib.rtti_implementsinterface.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint8), ctypes.POINTER(ctypes.c_bool)]
+
+ self.lib.rtti_createzoo.restype = ctypes.c_int32
+ self.lib.rtti_createzoo.argtypes = [ctypes.POINTER(ctypes.c_void_p)]
+
+ self.lib.rtti_animal_name.restype = ctypes.c_int32
+ self.lib.rtti_animal_name.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p]
+
+ self.lib.rtti_tiger_roar.restype = ctypes.c_int32
+ self.lib.rtti_tiger_roar.argtypes = [ctypes.c_void_p]
+
+ self.lib.rtti_animaliterator_getnextanimal.restype = ctypes.c_int32
+ self.lib.rtti_animaliterator_getnextanimal.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)]
+
+ self.lib.rtti_zoo_iterator.restype = ctypes.c_int32
+ self.lib.rtti_zoo_iterator.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)]
+
+ except AttributeError as ae:
+ raise ERTTIException(ErrorCodes.COULDNOTFINDLIBRARYEXPORT, ae.args[0])
+
+ def _checkBinaryVersion(self):
+ nMajor, nMinor, _ = self.GetVersion()
+ if (nMajor != BindingVersion.MAJOR) or (nMinor < BindingVersion.MINOR):
+ raise ERTTIException(ErrorCodes.INCOMPATIBLEBINARYVERSION)
+
+ def checkError(self, instance, errorCode):
+ if errorCode != ErrorCodes.SUCCESS.value:
+ if instance:
+ if instance._wrapper != self:
+ raise ERTTIException(ErrorCodes.INVALIDCAST, 'invalid wrapper call')
+ message,_ = self.GetLastError(instance)
+ raise ERTTIException(errorCode, message)
+
+ def GetVersion(self):
+ pMajor = ctypes.c_uint32()
+ pMinor = ctypes.c_uint32()
+ pMicro = ctypes.c_uint32()
+ self.checkError(None, self.lib.rtti_getversion(pMajor, pMinor, pMicro))
+
+ return pMajor.value, pMinor.value, pMicro.value
+
+ def GetLastError(self, InstanceObject):
+ InstanceHandle = None
+ if InstanceObject:
+ InstanceHandle = InstanceObject._handle
+ else:
+ raise ERTTIException(ErrorCodes.INVALIDPARAM, 'Invalid return/output value')
+ nErrorMessageBufferSize = ctypes.c_uint64(0)
+ nErrorMessageNeededChars = ctypes.c_uint64(0)
+ pErrorMessageBuffer = ctypes.c_char_p(None)
+ pHasError = ctypes.c_bool()
+ self.checkError(None, self.lib.rtti_getlasterror(InstanceHandle, nErrorMessageBufferSize, nErrorMessageNeededChars, pErrorMessageBuffer, pHasError))
+ nErrorMessageBufferSize = ctypes.c_uint64(nErrorMessageNeededChars.value)
+ pErrorMessageBuffer = (ctypes.c_char * (nErrorMessageNeededChars.value))()
+ self.checkError(None, self.lib.rtti_getlasterror(InstanceHandle, nErrorMessageBufferSize, nErrorMessageNeededChars, pErrorMessageBuffer, pHasError))
+
+ return pErrorMessageBuffer.value.decode(), pHasError.value
+
+ def ReleaseInstance(self, InstanceObject):
+ InstanceHandle = None
+ if InstanceObject:
+ InstanceHandle = InstanceObject._handle
+ else:
+ raise ERTTIException(ErrorCodes.INVALIDPARAM, 'Invalid return/output value')
+ self.checkError(None, self.lib.rtti_releaseinstance(InstanceHandle))
+
+
+ def AcquireInstance(self, InstanceObject):
+ InstanceHandle = None
+ if InstanceObject:
+ InstanceHandle = InstanceObject._handle
+ else:
+ raise ERTTIException(ErrorCodes.INVALIDPARAM, 'Invalid return/output value')
+ self.checkError(None, self.lib.rtti_acquireinstance(InstanceHandle))
+
+
+ def InjectComponent(self, NameSpace, SymbolAddressMethod):
+ pNameSpace = ctypes.c_char_p(str.encode(NameSpace))
+ pSymbolAddressMethod = ctypes.c_void_p(SymbolAddressMethod)
+ self.checkError(None, self.lib.rtti_injectcomponent(pNameSpace, pSymbolAddressMethod))
+
+ bNameSpaceFound = False
+ if not bNameSpaceFound:
+ raise ERTTIException(ErrorCodes.COULDNOTLOADLIBRARY, "Unknown namespace " + NameSpace)
+
+
+ def GetSymbolLookupMethod(self):
+ pSymbolLookupMethod = ctypes.c_void_p()
+ self.checkError(None, self.lib.rtti_getsymbollookupmethod(pSymbolLookupMethod))
+
+ return pSymbolLookupMethod.value
+
+ def ImplementsInterface(self, ObjectObject, ClassHash):
+ ObjectHandle = None
+ if ObjectObject:
+ ObjectHandle = ObjectObject._handle
+ else:
+ raise ERTTIException(ErrorCodes.INVALIDPARAM, 'Invalid return/output value')
+ nClassHashCount = ctypes.c_uint64(len(ClassHash))
+ pClassHashBuffer = (ctypes.c_uint8*len(ClassHash))(*ClassHash)
+ pImplementsInterface = ctypes.c_bool()
+ self.checkError(None, self.lib.rtti_implementsinterface(ObjectHandle, nClassHashCount, pClassHashBuffer, pImplementsInterface))
+
+ return pImplementsInterface.value
+
+ def CreateZoo(self):
+ InstanceHandle = ctypes.c_void_p()
+ self.checkError(None, self.lib.rtti_createzoo(InstanceHandle))
+ if InstanceHandle:
+ InstanceObject = Zoo(InstanceHandle, self)
+ else:
+ raise ERTTIException(ErrorCodes.INVALIDCAST, 'Invalid return/output value')
+
+ return InstanceObject
+
+
+
+''' Class Implementation for Base
+'''
+class Base:
+ @staticmethod
+ def ClassName():
+ return "Base"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\x09\x5A\x1B\x43\xEF\xFE\xC7\x39\x55\xE3\x1E\x79\x04\x38\xDE\x49')
+
+ @classmethod
+ def cast(cls, instance):
+ if instance and instance._wrapper.ImplementsInterface(instance, cls.ClassHash()):
+ instance._wrapper.AcquireInstance(instance)
+ return cls(instance._handle, instance._wrapper)
+ return None
+
+ def __init__(self, handle, wrapper):
+ if not handle or not wrapper:
+ raise ERTTIException(ErrorCodes.INVALIDPARAM)
+ self._handle = handle
+ self._wrapper = wrapper
+
+ def __del__(self):
+ self._wrapper.ReleaseInstance(self)
+
+
+''' Class Implementation for Animal
+'''
+class Animal(Base):
+ @staticmethod
+ def ClassName():
+ return "Animal"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\x16\x1E\x7C\xE7\xBF\xDC\x89\xAB\x4B\x9F\x52\xC1\xD4\xC9\x42\x12')
+
+ def __init__(self, handle, wrapper):
+ Base.__init__(self, handle, wrapper)
+ def Name(self):
+ nResultBufferSize = ctypes.c_uint64(0)
+ nResultNeededChars = ctypes.c_uint64(0)
+ pResultBuffer = ctypes.c_char_p(None)
+ self._wrapper.checkError(self, self._wrapper.lib.rtti_animal_name(self._handle, nResultBufferSize, nResultNeededChars, pResultBuffer))
+ nResultBufferSize = ctypes.c_uint64(nResultNeededChars.value)
+ pResultBuffer = (ctypes.c_char * (nResultNeededChars.value))()
+ self._wrapper.checkError(self, self._wrapper.lib.rtti_animal_name(self._handle, nResultBufferSize, nResultNeededChars, pResultBuffer))
+
+ return pResultBuffer.value.decode()
+
+
+
+''' Class Implementation for Mammal
+'''
+class Mammal(Animal):
+ @staticmethod
+ def ClassName():
+ return "Mammal"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\x37\x42\x61\x13\xD1\x29\xE7\x9F\x54\x8F\x4C\x90\x93\x0F\xA6\x97')
+
+ def __init__(self, handle, wrapper):
+ Animal.__init__(self, handle, wrapper)
+
+
+''' Class Implementation for Reptile
+'''
+class Reptile(Animal):
+ @staticmethod
+ def ClassName():
+ return "Reptile"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\xAA\x64\x51\x86\xA4\xB5\xF3\xF2\x79\x52\xC2\xFA\x54\x85\xFA\xB2')
+
+ def __init__(self, handle, wrapper):
+ Animal.__init__(self, handle, wrapper)
+
+
+''' Class Implementation for Giraffe
+'''
+class Giraffe(Mammal):
+ @staticmethod
+ def ClassName():
+ return "Giraffe"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\x42\x7D\xEB\xB8\x1D\x26\x5A\x0E\xDD\x87\x89\xF3\x0B\x11\xBE\xB6')
+
+ def __init__(self, handle, wrapper):
+ Mammal.__init__(self, handle, wrapper)
+
+
+''' Class Implementation for Tiger
+'''
+class Tiger(Mammal):
+ @staticmethod
+ def ClassName():
+ return "Tiger"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\x45\x4C\x98\x43\x11\x06\x86\xBF\x6F\x67\xCE\x51\x15\xB6\x66\x17')
+
+ def __init__(self, handle, wrapper):
+ Mammal.__init__(self, handle, wrapper)
+ def Roar(self):
+ self._wrapper.checkError(self, self._wrapper.lib.rtti_tiger_roar(self._handle))
+
+
+
+
+''' Class Implementation for Snake
+'''
+class Snake(Reptile):
+ @staticmethod
+ def ClassName():
+ return "Snake"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\xDF\xA9\x0F\x1B\x4E\xB3\xAF\xFB\xD3\xB4\x6A\xF3\x4E\xD2\x47\x7C')
+
+ def __init__(self, handle, wrapper):
+ Reptile.__init__(self, handle, wrapper)
+
+
+''' Class Implementation for Turtle
+'''
+class Turtle(Reptile):
+ @staticmethod
+ def ClassName():
+ return "Turtle"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\x06\xDE\xBA\x59\x08\xB0\x07\xEB\x6F\x32\xD8\xD9\x5F\x3F\x61\xB5')
+
+ def __init__(self, handle, wrapper):
+ Reptile.__init__(self, handle, wrapper)
+
+
+''' Class Implementation for AnimalIterator
+'''
+class AnimalIterator(Base):
+ @staticmethod
+ def ClassName():
+ return "AnimalIterator"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\xC2\xB3\x6A\x84\xC6\xC0\x32\x20\x4E\x5C\x92\x3C\x58\x10\x71\xE7')
+
+ def __init__(self, handle, wrapper):
+ Base.__init__(self, handle, wrapper)
+ def GetNextAnimal(self):
+ AnimalHandle = ctypes.c_void_p()
+ self._wrapper.checkError(self, self._wrapper.lib.rtti_animaliterator_getnextanimal(self._handle, AnimalHandle))
+ if AnimalHandle:
+ AnimalObject = Animal(AnimalHandle, self._wrapper)
+ else:
+ AnimalObject = None
+
+ return AnimalObject
+
+
+
+''' Class Implementation for Zoo
+'''
+class Zoo(Base):
+ @staticmethod
+ def ClassName():
+ return "Zoo"
+
+ @staticmethod
+ def ClassHash():
+ return bytearray(b'\xBF\xA8\x88\xA3\x54\xDB\x97\xC7\xCB\xEF\xB9\xD0\x50\xB9\x4C\xA3')
+
+ def __init__(self, handle, wrapper):
+ Base.__init__(self, handle, wrapper)
+ def Iterator(self):
+ IteratorHandle = ctypes.c_void_p()
+ self._wrapper.checkError(self, self._wrapper.lib.rtti_zoo_iterator(self._handle, IteratorHandle))
+ if IteratorHandle:
+ IteratorObject = AnimalIterator(IteratorHandle, self._wrapper)
+ else:
+ raise ERTTIException(ErrorCodes.INVALIDCAST, 'Invalid return/output value')
+
+ return IteratorObject
+
+
diff --git a/Examples/RTTI/RTTI_component/Examples/CppDynamic/CMakeLists.txt b/Examples/RTTI/RTTI_component/Examples/CppDynamic/CMakeLists.txt
new file mode 100644
index 00000000..b739dd40
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Examples/CppDynamic/CMakeLists.txt
@@ -0,0 +1,26 @@
+#[[++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated CMake Project that demonstrates the
+ usage of the Dynamic C++ bindings of RTTI
+
+Interface version: 1.0.0
+
+
+]]
+
+cmake_minimum_required(VERSION 3.5)
+
+set(CMAKE_CURRENT_BINDING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Bindings/CppDynamic)
+project(RTTIExample_CPPDynamic)
+set(CMAKE_CXX_STANDARD 11)
+add_executable(RTTIExample_CPPDynamic "${CMAKE_CURRENT_SOURCE_DIR}/RTTI_example.cpp")
+if (UNIX)
+ target_link_libraries(RTTIExample_CPPDynamic ${CMAKE_DL_LIBS})
+endif (UNIX)
+target_include_directories(RTTIExample_CPPDynamic PRIVATE "${CMAKE_CURRENT_BINDING_DIR}")
diff --git a/Examples/RTTI/RTTI_component/Examples/CppDynamic/RTTI_example.cpp b/Examples/RTTI/RTTI_component/Examples/CppDynamic/RTTI_example.cpp
new file mode 100644
index 00000000..d5079a34
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Examples/CppDynamic/RTTI_example.cpp
@@ -0,0 +1,50 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++ application that demonstrates the
+ usage of the Dynamic C++ bindings of RTTI
+
+Interface version: 1.0.0
+
+*/
+
+#include
+#include "rtti_dynamic.hpp"
+
+
+int main()
+{
+ try
+ {
+ std::string libpath = (""); // TODO: put the location of the RTTI-library file here.
+ auto wrapper = RTTI::CWrapper::loadLibrary(libpath + "/rtti."); // TODO: add correct suffix of the library
+ RTTI_uint32 nMajor, nMinor, nMicro;
+ wrapper->GetVersion(nMajor, nMinor, nMicro);
+ std::cout << "RTTI.Version = " << nMajor << "." << nMinor << "." << nMicro;
+ std::cout << std::endl;
+
+
+ auto zoo = wrapper->CreateZoo();
+ auto iter = zoo->Iterator();
+
+ using namespace RTTI;
+ while (auto animal = iter->GetNextAnimal()) {
+ if (auto tiger = rtti_cast(animal)) {
+ tiger->Roar();
+ }
+ std::cout << "Animal name: " << animal->Name() << std::endl;
+ }
+ }
+ catch (std::exception &e)
+ {
+ std::cout << e.what() << std::endl;
+ return 1;
+ }
+ return 0;
+}
+
diff --git a/Examples/RTTI/RTTI_component/Examples/Python/RTTI_Example.py b/Examples/RTTI/RTTI_component/Examples/Python/RTTI_Example.py
new file mode 100644
index 00000000..984534cf
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Examples/Python/RTTI_Example.py
@@ -0,0 +1,43 @@
+'''++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated Python application that demonstrates the
+ usage of the Python bindings of RTTI
+
+Interface version: 1.0.0
+
+'''
+
+
+import os
+import sys
+sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "Bindings", "Python"))
+import RTTI
+
+
+def main():
+ libpath = '' # TODO add the location of the shared library binary here
+ wrapper = RTTI.Wrapper(libraryName = os.path.join(libpath, "rtti"))
+
+ major, minor, micro = wrapper.GetVersion()
+ print("RTTI version: {:d}.{:d}.{:d}".format(major, minor, micro), end="")
+ print("")
+
+ zoo = wrapper.CreateZoo()
+ iter = zoo.Iterator()
+
+ while animal := iter.GetNextAnimal():
+ if tiger := RTTI.Tiger.cast(animal):
+ tiger.Roar()
+ print("Animal name: " + animal.Name())
+
+if __name__ == "__main__":
+ try:
+ main()
+ except RTTI.ERTTIException as e:
+ print(e)
diff --git a/Examples/RTTI/RTTI_component/Implementations/Cpp/CMakeLists.txt b/Examples/RTTI/RTTI_component/Implementations/Cpp/CMakeLists.txt
new file mode 100644
index 00000000..d9db9617
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Implementations/Cpp/CMakeLists.txt
@@ -0,0 +1,46 @@
+#[[++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated CMakeLists file for the development of RTTI.
+
+Interface version: 1.0.0
+
+
+]]
+
+cmake_minimum_required(VERSION 3.5)
+
+### The implementation of the RTTI component
+project(RTTI)
+
+set (CMAKE_CXX_STANDARD 11)
+
+# The location of autogenerated interfaces
+set(CMAKE_CURRENT_AUTOGENERATED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Interfaces)
+
+file(GLOB RTTI_SRC
+ ${CMAKE_CURRENT_SOURCE_DIR}/Stub/*.cpp
+)
+file(GLOB RTTI_HDR
+ ${CMAKE_CURRENT_SOURCE_DIR}/Stub/*.hpp
+)
+set(RTTI_SRC ${RTTI_SRC} ${RTTI_SRC}
+ ${CMAKE_CURRENT_AUTOGENERATED_DIR}/rtti_interfaceexception.cpp
+ ${CMAKE_CURRENT_AUTOGENERATED_DIR}/rtti_interfacewrapper.cpp
+)
+
+add_library(rtti SHARED ${RTTI_SRC})
+# Do not prefix the binary's name with "lib" on Unix systems:
+set_target_properties(rtti PROPERTIES PREFIX "" IMPORT_PREFIX "" )
+# The following two properties are crucial to reduce the number of undesirably exported symbols
+set_target_properties(rtti PROPERTIES CXX_VISIBILITY_PRESET hidden)
+set_target_properties(rtti PROPERTIES VISIBILITY_INLINES_HIDDEN ON)
+# This makes sure symbols are exported
+target_compile_options(rtti PRIVATE "-D__RTTI_EXPORTS")
+target_include_directories(rtti PRIVATE ${CMAKE_CURRENT_AUTOGENERATED_DIR})
+target_include_directories(rtti PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Stub)
diff --git a/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_abi.hpp b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_abi.hpp
new file mode 100644
index 00000000..ae254c13
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_abi.hpp
@@ -0,0 +1,196 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++-Header file in order to allow an easy
+ use of RTTI
+
+Interface version: 1.0.0
+
+*/
+
+#ifndef __RTTI_HEADER_CPP
+#define __RTTI_HEADER_CPP
+
+#ifdef __RTTI_EXPORTS
+#ifdef _WIN32
+#define RTTI_DECLSPEC __declspec (dllexport)
+#else // _WIN32
+#define RTTI_DECLSPEC __attribute__((visibility("default")))
+#endif // _WIN32
+#else // __RTTI_EXPORTS
+#define RTTI_DECLSPEC
+#endif // __RTTI_EXPORTS
+
+#include "rtti_types.hpp"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*************************************************************************************************************************
+ Class definition for Base
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Animal
+**************************************************************************************************************************/
+
+/**
+* Get the name of the animal
+*
+* @param[in] pAnimal - Animal instance.
+* @param[in] nResultBufferSize - size of the buffer (including trailing 0)
+* @param[out] pResultNeededChars - will be filled with the count of the written bytes, or needed buffer size.
+* @param[out] pResultBuffer - buffer of , may be NULL
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_animal_name(RTTI_Animal pAnimal, const RTTI_uint32 nResultBufferSize, RTTI_uint32* pResultNeededChars, char * pResultBuffer);
+
+/*************************************************************************************************************************
+ Class definition for Mammal
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Reptile
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Giraffe
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Tiger
+**************************************************************************************************************************/
+
+/**
+* Roar like a tiger
+*
+* @param[in] pTiger - Tiger instance.
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_tiger_roar(RTTI_Tiger pTiger);
+
+/*************************************************************************************************************************
+ Class definition for Snake
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for Turtle
+**************************************************************************************************************************/
+
+/*************************************************************************************************************************
+ Class definition for AnimalIterator
+**************************************************************************************************************************/
+
+/**
+* Return next animal
+*
+* @param[in] pAnimalIterator - AnimalIterator instance.
+* @param[out] pAnimal -
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_animaliterator_getnextanimal(RTTI_AnimalIterator pAnimalIterator, RTTI_Animal * pAnimal);
+
+/*************************************************************************************************************************
+ Class definition for Zoo
+**************************************************************************************************************************/
+
+/**
+* Return an iterator over all zoo animals
+*
+* @param[in] pZoo - Zoo instance.
+* @param[out] pIterator -
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_zoo_iterator(RTTI_Zoo pZoo, RTTI_AnimalIterator * pIterator);
+
+/*************************************************************************************************************************
+ Global functions
+**************************************************************************************************************************/
+
+/**
+* retrieves the binary version of this library.
+*
+* @param[out] pMajor - returns the major version of this library
+* @param[out] pMinor - returns the minor version of this library
+* @param[out] pMicro - returns the micro version of this library
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_getversion(RTTI_uint32 * pMajor, RTTI_uint32 * pMinor, RTTI_uint32 * pMicro);
+
+/**
+* Returns the last error recorded on this object
+*
+* @param[in] pInstance - Instance Handle
+* @param[in] nErrorMessageBufferSize - size of the buffer (including trailing 0)
+* @param[out] pErrorMessageNeededChars - will be filled with the count of the written bytes, or needed buffer size.
+* @param[out] pErrorMessageBuffer - buffer of Message of the last error, may be NULL
+* @param[out] pHasError - Is there a last error to query
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_getlasterror(RTTI_Base pInstance, const RTTI_uint32 nErrorMessageBufferSize, RTTI_uint32* pErrorMessageNeededChars, char * pErrorMessageBuffer, bool * pHasError);
+
+/**
+* Releases shared ownership of an Instance
+*
+* @param[in] pInstance - Instance Handle
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_releaseinstance(RTTI_Base pInstance);
+
+/**
+* Acquires shared ownership of an Instance
+*
+* @param[in] pInstance - Instance Handle
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_acquireinstance(RTTI_Base pInstance);
+
+/**
+* Injects an imported component for usage within this component
+*
+* @param[in] pNameSpace - NameSpace of the injected component
+* @param[in] pSymbolAddressMethod - Address of the SymbolAddressMethod of the injected component
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_injectcomponent(const char * pNameSpace, RTTI_pvoid pSymbolAddressMethod);
+
+/**
+* Returns the address of the SymbolLookupMethod
+*
+* @param[out] pSymbolLookupMethod - Address of the SymbolAddressMethod
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_getsymbollookupmethod(RTTI_pvoid * pSymbolLookupMethod);
+
+/**
+* Test whether an object implements a given interface
+*
+* @param[in] pObject - Instance Handle
+* @param[in] nClassHashBufferSize - Number of elements in buffer
+* @param[in] pClassHashBuffer - uint8 buffer of Hashed class name of the interface to test
+* @param[out] pImplementsInterface - Will be set to true if pInstance implements the interface, false otherwise
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_implementsinterface(RTTI_Base pObject, RTTI_uint64 nClassHashBufferSize, const RTTI_uint8 * pClassHashBuffer, bool * pImplementsInterface);
+
+/**
+* Create a new zoo with animals
+*
+* @param[out] pInstance -
+* @return error code or 0 (success)
+*/
+RTTI_DECLSPEC RTTIResult rtti_createzoo(RTTI_Zoo * pInstance);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __RTTI_HEADER_CPP
+
diff --git a/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaceexception.cpp b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaceexception.cpp
new file mode 100644
index 00000000..4db45b80
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaceexception.cpp
@@ -0,0 +1,45 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++ Implementation file with the basic internal
+ exception type in order to allow an easy use of RTTI
+
+Interface version: 1.0.0
+
+*/
+
+
+#include
+
+#include "rtti_interfaceexception.hpp"
+
+/*************************************************************************************************************************
+ Class ERTTIInterfaceException
+**************************************************************************************************************************/
+ERTTIInterfaceException::ERTTIInterfaceException(RTTIResult errorCode)
+ : m_errorMessage(RTTI_GETERRORSTRING (errorCode))
+{
+ m_errorCode = errorCode;
+}
+
+ERTTIInterfaceException::ERTTIInterfaceException(RTTIResult errorCode, std::string errorMessage)
+ : m_errorMessage(errorMessage + " (" + std::to_string (errorCode) + ")")
+{
+ m_errorCode = errorCode;
+}
+
+RTTIResult ERTTIInterfaceException::getErrorCode ()
+{
+ return m_errorCode;
+}
+
+const char * ERTTIInterfaceException::what () const noexcept
+{
+ return m_errorMessage.c_str();
+}
+
diff --git a/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaceexception.hpp b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaceexception.hpp
new file mode 100644
index 00000000..a6f4795c
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaceexception.hpp
@@ -0,0 +1,60 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++ Header file with the basic internal
+ exception type in order to allow an easy use of RTTI
+
+Interface version: 1.0.0
+
+*/
+
+#ifndef __RTTI_INTERFACEEXCEPTION_HEADER
+#define __RTTI_INTERFACEEXCEPTION_HEADER
+
+#include
+#include
+#include "rtti_types.hpp"
+
+/*************************************************************************************************************************
+ Class ERTTIInterfaceException
+**************************************************************************************************************************/
+
+
+class ERTTIInterfaceException : public std::exception {
+protected:
+ /**
+ * Error code for the Exception.
+ */
+ RTTIResult m_errorCode;
+ /**
+ * Error message for the Exception.
+ */
+ std::string m_errorMessage;
+
+public:
+ /**
+ * Exception Constructor.
+ */
+ ERTTIInterfaceException(RTTIResult errorCode);
+
+ /**
+ * Custom Exception Constructor.
+ */
+ ERTTIInterfaceException(RTTIResult errorCode, std::string errorMessage);
+
+ /**
+ * Returns error code
+ */
+ RTTIResult getErrorCode();
+ /**
+ * Returns error message
+ */
+ const char* what() const noexcept override;
+};
+
+#endif // __RTTI_INTERFACEEXCEPTION_HEADER
diff --git a/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaces.hpp b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaces.hpp
new file mode 100644
index 00000000..97b074aa
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfaces.hpp
@@ -0,0 +1,392 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++ header file in order to allow easy
+development of RTTI. The implementer of RTTI needs to
+derive concrete classes from the abstract classes in this header.
+
+Interface version: 1.0.0
+
+*/
+
+
+#ifndef __RTTI_CPPINTERFACES
+#define __RTTI_CPPINTERFACES
+
+#include
+#include
+
+#include "rtti_types.hpp"
+
+
+
+namespace RTTI {
+namespace Impl {
+
+/**
+ Forward declarations of class interfaces
+*/
+class IBase;
+class IAnimal;
+class IMammal;
+class IReptile;
+class IGiraffe;
+class ITiger;
+class ISnake;
+class ITurtle;
+class IAnimalIterator;
+class IZoo;
+
+
+
+/*************************************************************************************************************************
+ Parameter Cache definitions
+**************************************************************************************************************************/
+
+class ParameterCache {
+ public:
+ virtual ~ParameterCache() {}
+};
+
+template class ParameterCache_1 : public ParameterCache {
+ private:
+ T1 m_param1;
+ public:
+ ParameterCache_1 (const T1 & param1)
+ : m_param1 (param1)
+ {
+ }
+
+ void retrieveData (T1 & param1)
+ {
+ param1 = m_param1;
+ }
+};
+
+template class ParameterCache_2 : public ParameterCache {
+ private:
+ T1 m_param1;
+ T2 m_param2;
+ public:
+ ParameterCache_2 (const T1 & param1, const T2 & param2)
+ : m_param1 (param1), m_param2 (param2)
+ {
+ }
+
+ void retrieveData (T1 & param1, T2 & param2)
+ {
+ param1 = m_param1;
+ param2 = m_param2;
+ }
+};
+
+template class ParameterCache_3 : public ParameterCache {
+ private:
+ T1 m_param1;
+ T2 m_param2;
+ T3 m_param3;
+ public:
+ ParameterCache_3 (const T1 & param1, const T2 & param2, const T3 & param3)
+ : m_param1 (param1), m_param2 (param2), m_param3 (param3)
+ {
+ }
+
+ void retrieveData (T1 & param1, T2 & param2, T3 & param3)
+ {
+ param1 = m_param1;
+ param2 = m_param2;
+ param3 = m_param3;
+ }
+};
+
+
+/*************************************************************************************************************************
+ Class interface for Base
+**************************************************************************************************************************/
+
+class IBase {
+private:
+ std::unique_ptr m_ParameterCache;
+public:
+ /**
+ * IBase::~IBase - virtual destructor of IBase
+ */
+ virtual ~IBase() {};
+
+ /**
+ * IBase::ReleaseBaseClassInterface - Releases ownership of a base class interface. Deletes the reference, if necessary.
+ * @param[in] pIBase - The base class instance to release
+ */
+ static void ReleaseBaseClassInterface(IBase* pIBase)
+ {
+ if (pIBase) {
+ pIBase->DecRefCount();
+ }
+ };
+
+ /**
+ * IBase::AcquireBaseClassInterface - Acquires shared ownership of a base class interface.
+ * @param[in] pIBase - The base class instance to acquire
+ */
+ static void AcquireBaseClassInterface(IBase* pIBase)
+ {
+ if (pIBase) {
+ pIBase->IncRefCount();
+ }
+ };
+
+
+ /**
+ * IBase::GetLastErrorMessage - Returns the last error registered of this class instance
+ * @param[out] sErrorMessage - Message of the last error registered
+ * @return Has an error been registered already
+ */
+ virtual bool GetLastErrorMessage(std::string & sErrorMessage) = 0;
+
+ /**
+ * IBase::ClearErrorMessages - Clears all registered messages of this class instance
+ */
+ virtual void ClearErrorMessages() = 0;
+
+ /**
+ * IBase::RegisterErrorMessage - Registers an error message with this class instance
+ * @param[in] sErrorMessage - Error message to register
+ */
+ virtual void RegisterErrorMessage(const std::string & sErrorMessage) = 0;
+
+ /**
+ * IBase::IncRefCount - Increases the reference count of a class instance
+ */
+ virtual void IncRefCount() = 0;
+
+ /**
+ * IBase::DecRefCount - Decreases the reference count of a class instance and free releases it, if the last reference has been removed
+ * @return Has the object been released
+ */
+ virtual bool DecRefCount() = 0;
+
+ /**
+ * IBase::_setCache - set parameter cache of object
+ */
+ void _setCache(ParameterCache * pCache)
+ {
+ m_ParameterCache.reset(pCache);
+ }
+
+ /**
+ * IBase::_getCache - returns parameter cache of object
+ */
+ ParameterCache* _getCache()
+ {
+ return m_ParameterCache.get();
+ }
+
+};
+
+
+/**
+ Definition of a shared pointer class for IBase
+*/
+template
+class IBaseSharedPtr : public std::shared_ptr
+{
+public:
+ explicit IBaseSharedPtr(T* t = nullptr)
+ : std::shared_ptr(t, IBase::ReleaseBaseClassInterface)
+ {
+ t->IncRefCount();
+ }
+
+ // Reset function, as it also needs to properly set the deleter.
+ void reset(T* t = nullptr)
+ {
+ std::shared_ptr::reset(t, IBase::ReleaseBaseClassInterface);
+ }
+
+ // Get-function that increases the Base class's reference count
+ T* getCoOwningPtr()
+ {
+ T* t = this->get();
+ t->IncRefCount();
+ return t;
+ }
+};
+
+
+typedef IBaseSharedPtr PIBase;
+
+
+/*************************************************************************************************************************
+ Class interface for Animal
+**************************************************************************************************************************/
+
+class IAnimal : public virtual IBase {
+public:
+ /**
+ * IAnimal::Name - Get the name of the animal
+ * @return
+ */
+ virtual std::string Name() = 0;
+
+};
+
+typedef IBaseSharedPtr PIAnimal;
+
+
+/*************************************************************************************************************************
+ Class interface for Mammal
+**************************************************************************************************************************/
+
+class IMammal : public virtual IAnimal {
+public:
+};
+
+typedef IBaseSharedPtr PIMammal;
+
+
+/*************************************************************************************************************************
+ Class interface for Reptile
+**************************************************************************************************************************/
+
+class IReptile : public virtual IAnimal {
+public:
+};
+
+typedef IBaseSharedPtr PIReptile;
+
+
+/*************************************************************************************************************************
+ Class interface for Giraffe
+**************************************************************************************************************************/
+
+class IGiraffe : public virtual IMammal {
+public:
+};
+
+typedef IBaseSharedPtr PIGiraffe;
+
+
+/*************************************************************************************************************************
+ Class interface for Tiger
+**************************************************************************************************************************/
+
+class ITiger : public virtual IMammal {
+public:
+ /**
+ * ITiger::Roar - Roar like a tiger
+ */
+ virtual void Roar() = 0;
+
+};
+
+typedef IBaseSharedPtr PITiger;
+
+
+/*************************************************************************************************************************
+ Class interface for Snake
+**************************************************************************************************************************/
+
+class ISnake : public virtual IReptile {
+public:
+};
+
+typedef IBaseSharedPtr PISnake;
+
+
+/*************************************************************************************************************************
+ Class interface for Turtle
+**************************************************************************************************************************/
+
+class ITurtle : public virtual IReptile {
+public:
+};
+
+typedef IBaseSharedPtr PITurtle;
+
+
+/*************************************************************************************************************************
+ Class interface for AnimalIterator
+**************************************************************************************************************************/
+
+class IAnimalIterator : public virtual IBase {
+public:
+ /**
+ * IAnimalIterator::GetNextAnimal - Return next animal
+ * @return
+ */
+ virtual IAnimal * GetNextAnimal() = 0;
+
+};
+
+typedef IBaseSharedPtr PIAnimalIterator;
+
+
+/*************************************************************************************************************************
+ Class interface for Zoo
+**************************************************************************************************************************/
+
+class IZoo : public virtual IBase {
+public:
+ /**
+ * IZoo::Iterator - Return an iterator over all zoo animals
+ * @return
+ */
+ virtual IAnimalIterator * Iterator() = 0;
+
+};
+
+typedef IBaseSharedPtr PIZoo;
+
+
+/*************************************************************************************************************************
+ Global functions declarations
+**************************************************************************************************************************/
+class CWrapper {
+public:
+ /**
+ * Irtti::GetVersion - retrieves the binary version of this library.
+ * @param[out] nMajor - returns the major version of this library
+ * @param[out] nMinor - returns the minor version of this library
+ * @param[out] nMicro - returns the micro version of this library
+ */
+ static void GetVersion(RTTI_uint32 & nMajor, RTTI_uint32 & nMinor, RTTI_uint32 & nMicro);
+
+ /**
+ * Irtti::GetLastError - Returns the last error recorded on this object
+ * @param[in] pInstance - Instance Handle
+ * @param[out] sErrorMessage - Message of the last error
+ * @return Is there a last error to query
+ */
+ static bool GetLastError(IBase* pInstance, std::string & sErrorMessage);
+
+ /**
+ * Irtti::ReleaseInstance - Releases shared ownership of an Instance
+ * @param[in] pInstance - Instance Handle
+ */
+ static void ReleaseInstance(IBase* pInstance);
+
+ /**
+ * Irtti::AcquireInstance - Acquires shared ownership of an Instance
+ * @param[in] pInstance - Instance Handle
+ */
+ static void AcquireInstance(IBase* pInstance);
+
+ /**
+ * Irtti::CreateZoo - Create a new zoo with animals
+ * @return
+ */
+ static IZoo * CreateZoo();
+
+};
+
+RTTIResult RTTI_GetProcAddress (const char * pProcName, void ** ppProcAddress);
+
+} // namespace Impl
+} // namespace RTTI
+
+#endif // __RTTI_CPPINTERFACES
diff --git a/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfacewrapper.cpp b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfacewrapper.cpp
new file mode 100644
index 00000000..341e46ee
--- /dev/null
+++ b/Examples/RTTI/RTTI_component/Implementations/Cpp/Interfaces/rtti_interfacewrapper.cpp
@@ -0,0 +1,546 @@
+/*++
+
+Copyright (C) 2020 ADSK
+
+All rights reserved.
+
+This file has been generated by the Automatic Component Toolkit (ACT) version 1.7.0-develop.
+
+Abstract: This is an autogenerated C++ implementation file in order to allow easy
+development of RTTI. The functions in this file need to be implemented. It needs to be generated only once.
+
+Interface version: 1.0.0
+
+*/
+
+#include "rtti_abi.hpp"
+#include "rtti_interfaces.hpp"
+#include "rtti_interfaceexception.hpp"
+
+#include