Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3e2b56b
Add RTTI example basis
fsahmad Dec 7, 2020
59cef79
Implement stubs
fsahmad Dec 7, 2020
be3950b
Add ImplementsInterface to implementation
fsahmad Dec 8, 2020
1524a7f
Add casts to bindings and examples
fsahmad Dec 8, 2020
c21150b
Change Cpp binding static member var to function
fsahmad Dec 8, 2020
6a5743f
Autogenerate skeleton for ImplementsInterfaceMethod
martinweismann Dec 15, 2020
c0224d3
Update RTTI example with changes
fsahmad Jan 4, 2021
7ba28d4
Generate implementsinterface method
fsahmad Jan 4, 2021
9589592
RTTI methods in CppDynamic binding
fsahmad Jan 4, 2021
3d85067
Delete pycache file from example
fsahmad Jan 4, 2021
ef7e591
Python RTTI
fsahmad Jan 5, 2021
1731ad4
Fix hardcoded namespace RTTI
fsahmad Jan 18, 2021
a256dd7
Inline binding getClassName method
fsahmad Jan 18, 2021
d462710
Update RTTI example
fsahmad Jan 28, 2021
2339361
Update RTTI generated code (inline getClassName)
fsahmad Jan 28, 2021
e7042a5
Fix CPP binding to inc ref count
fsahmad Jan 28, 2021
883d6e0
Fix Python binding to inc ref count
fsahmad Jan 28, 2021
a40ca23
Update RTTI examples to print name
fsahmad Jan 28, 2021
40fb5f3
Add missing Name method to RTTI.xml
fsahmad Feb 23, 2021
64d1a73
Merge branch 'develop' into rtti
martinweismann Mar 12, 2021
c302c9e
Fix names of special classes and methods in generation code
martinweismann Apr 7, 2021
a55da70
Hash class ids in C++ bindings
fsahmad Apr 8, 2021
67088cb
Use hash to id class in C++ implementation
fsahmad Apr 8, 2021
d378681
Hash class ids in Python bindings
fsahmad Apr 12, 2021
84a92c7
Merge branch 'develop' into rtti
alexanderoster Aug 10, 2021
745f92b
Merge branch 'develop' into rtti
alexanderoster Aug 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions Examples/RTTI/RTTI.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<component xmlns="http://schemas.autodesk.com/netfabb/automaticcomponenttoolkit/2018" libraryname="RTTI" namespace="RTTI" copyright="ADSK" year="2020" basename="rtti" version="1.0.0">

<!-- class="Namespace:*" becomes aware of this.-->

<license>
<line value="All rights reserved."/>
</license>

<bindings>
<binding language="CppDynamic" indentation="tabs"/>
<binding language="Python" indentation="tabs"/>
</bindings>
<implementations>
<implementation language="Cpp" indentation="tabs"/>
</implementations>

<errors>
<error name="NOTIMPLEMENTED" code="1" description="functionality not implemented"/>
<error name="INVALIDPARAM" code="2" description="an invalid parameter was passed"/>
<error name="INVALIDCAST" code="3" description="a type cast failed"/>
<error name="BUFFERTOOSMALL" code="4" description="a provided buffer is too small"/>
<error name="GENERICEXCEPTION" code="5" description="a generic exception occurred"/>
<error name="COULDNOTLOADLIBRARY" code="6" description="the library could not be loaded"/>
<error name="COULDNOTFINDLIBRARYEXPORT" code="7"
description="a required exported symbol could not be found in the library"/>
<error name="INCOMPATIBLEBINARYVERSION" code="8"
description="the version of the binary interface does not match the bindings interface"/>
</errors>


<class name="Base">
</class>

<class name="Animal" parent="Base" description="">
<method name="Name" description="Get the name of the animal">
<param name="Result" type="string" pass="return" />
</method>
</class>

<class name="Mammal" parent="Animal" description="">
</class>

<class name="Reptile" parent="Animal" description="">
</class>

<class name="Giraffe" parent="Mammal" description="">
</class>

<class name="Tiger" parent="Mammal" description="">
<method name="Roar" description="Roar like a tiger" />
</class>

<class name="Snake" parent="Reptile" description="">
</class>

<class name="Turtle" parent="Reptile" description="">
</class>

<class name="AnimalIterator" description="">
<method name="GetNextAnimal" description="Return next animal">
<param name="Animal" pass="return" type="optionalclass" class="Animal"/>
</method>
</class>

<class name="Zoo" description="">
<method name="Iterator" description="Return an iterator over all zoo animals">
<param name="Iterator" pass="return" type="class" class="AnimalIterator"/>
</method>
</class>

<global baseclassname="Base" releasemethod="ReleaseInstance" acquiremethod="AcquireInstance"
versionmethod="GetVersion" errormethod="GetLastError" injectionmethod="InjectComponent"
symbollookupmethod="GetSymbolLookupMethod" implementsinterfacemethod="ImplementsInterface"
stringoutclassname="Base">
<method name="GetVersion" description="retrieves the binary version of this library.">
<param name="Major" type="uint32" pass="out" description="returns the major version of this library"/>
<param name="Minor" type="uint32" pass="out" description="returns the minor version of this library"/>
<param name="Micro" type="uint32" pass="out" description="returns the micro version of this library"/>
</method>
<method name="GetLastError" description="Returns the last error recorded on this object">
<param name="Instance" type="class" class="Base" pass="in" description="Instance Handle"/>
<param name="ErrorMessage" type="string" pass="out" description="Message of the last error"/>
<param name="HasError" type="bool" pass="return" description="Is there a last error to query"/>
</method>
<method name="ReleaseInstance" description="Releases shared ownership of an Instance">
<param name="Instance" type="class" class="Base" pass="in" description="Instance Handle"/>
</method>
<method name="AcquireInstance" description="Acquires shared ownership of an Instance">
<param name="Instance" type="class" class="Base" pass="in" description="Instance Handle"/>
</method>
<method name="InjectComponent" description="Injects an imported component for usage within this component">
<param name="NameSpace" type="string" pass="in" description="NameSpace of the injected component" />
<param name="SymbolAddressMethod" type="pointer" pass="in" description="Address of the SymbolAddressMethod of the injected component" />
</method>
<method name="GetSymbolLookupMethod" description="Returns the address of the SymbolLookupMethod">
<param name="SymbolLookupMethod" type="pointer" pass="return" description="Address of the SymbolAddressMethod" />
</method>
<method name="ImplementsInterface" description="Test whether an object implements a given interface">
<param name="Object" type="class" class="Base" pass="in" description="Instance Handle" />
<param name="ClassHash" type="basicarray" class="uint8" pass="in" description="Hashed class name of the interface to test" />
<param name="ImplementsInterface" type="bool" pass="return" description="Will be set to true if pInstance implements the interface, false otherwise" />
</method>
<method name="CreateZoo" description="Create a new zoo with animals">
<param name="Instance" pass="return" type="class" class="Zoo"/>
</method>
</global>

</component>
196 changes: 196 additions & 0 deletions Examples/RTTI/RTTI_component/Bindings/CppDynamic/rtti_abi.hpp
Original file line number Diff line number Diff line change
@@ -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

Loading