![]() |
OTX-Runtime for C++
|
|
A DotNet Assembly implementation is a DotNet class which public elements can be bound to a certain OTX signature, see Mappable OTX Activities. Inside this class an arbitrary complexity can be implemented.
Note: The Assembly Implementation is the default implementation of IMeasureImplementation (see DefaultMeasureImplementation), IExternalServiceProviderImplementation (see DefaultExternalServiceProviderImplementation), IContextVariableImplementation (see ContextVariableImplementation) and IStateVariableImplementation (see StateVariableImplementation) delivered with the OTX runtime API.
The Assembly implementation supports the following OTX data types:
The following OTX Signatures can be mapped to related objects inside a DotNet Assembly.
Signature | Can be mapped to | Activity to process in OTX |
---|---|---|
Measure.DeviceSignature | Public method of a public class | Measure.ExecuteDeviceService |
ExternalServiceProvider.ConstructorSignature | Public constructor of a public class | ExternalServiceProvider.CreateProvider |
ExternalServiceProvider.PropertyDeclaration | Public property of a public class | ExternalServiceProvider.SetProperty, GetProperty |
ExternalServiceProvider.ServiceSignature | Public method of a public class | ExternalServiceProvider.ExecuteService |
ExternalServiceProvider.EventSignature | Public event of a public class | ExternalServiceProvider.ServiceProviderEventSource |
The example shows the C# code of an assembly implementation. The full code is inside this Sample OTX-Mapping PTX with including Visual Studio Project, see folder Apps/OtxMappingSample.
Another OTF Sample Solution for OTX-Mapping with Player (source code see folder
\EmotiveSampleSolution\OtxMappingSample\OTX-Mapping
)
Note: The assembly (APP) must be copied into ExternalAppPath.
To see the complete example click here to fold.
For the above Signatures, in order for an exception caught inside of an Assembly Implementation to be thrown in an OTX flow, the following steps are required for each Signature.
Measure.DeviceSignature
For Measure.DeviceSignature, in order to throw an exception caught inside the Assembly Implemtation in the OTX flow,
Step 1. The exception must be declared using the ThrowsAttribute on the public element.
The ThrowsAttribute is constructed as follows:
This class is then used to declare all exceptions that can be thrown inside the public element. Please see the following example:
Furthermore, user-written exceptions can also be added using the throw attribute.
Step 2. The declared exceptions will be available for OTX-mapping and each exception must be mapped to any following OTX Measure Exceptions:
This can be done via the OTF Project setting
After mapping, every time any declared exceptions is thrown in the Assembly Implementation, its corresponding exception above will be thrown in OTX.
ExternalServiceProvider.ConstructorSignature, ExternalServiceProvider.PropertyDeclaration, ExternalServiceProvider.ServiceSignature, ExternalServiceProvider.EventSignature
For these Signatures, the declaration of exceptions for each public element is not required. An exception that is thrown inside the Assembly Implementation is automatically mapped to an ExecuteException exception in OTX and will thrown the flow.