Implementing components in C++ [message #1829406] |
Thu, 02 July 2020 17:33  |
Eclipse User |
|
|
|
Dear TITAN community,
So far, I have implemente dozens of TTCN3 modules for titan, ranging from dualf-faced portsto to test ports implemented in C++ to translation ports, etc. I've also used native C++functions from TTCN3.
Right now I'm wondering how it would be possible to implement an entire component in C++.
The rationale is, in this case:
* I have an underlying test port to interface some type of hardware (An E1 interface card)
* I have higher-level TTCN3 components and test caess
* I have a C language implementation of the missing layer in the midle (LAPD)
And now I would want to wrap the C-language LAPD implementation into some c++ classes so it can act as a TTCN3 component in titan. It would basically have a test port on the bottom side (towards the E1 test port) and one on the upper side.
Are there any examples around whcih cover this?
Thanks in advance.
|
|
|
Re: Implementing components in C++ [message #1829445 is a reply to message #1829406] |
Fri, 03 July 2020 11:59  |
Eclipse User |
|
|
|
Hi Harald,
As the code for TTCN-3 components is generated you will not be able to have your own implementation (or if you try to edit the generated code it will be overwritten).
Reading your actual issue it is not clear if you need to have your own component implementation.
If you have a component with those 2 ports you described.
You could start a function on it, that is able receive messages on both ports.
When a message is received on one, you call an external function that invokes your middle functionalities in C/C++ code ... and sends out the result on the other port.
If you need to store some stateful information, you could still use an external function that stores the information in a C/C++ static variable.
Your external functions could read/write that object.
In this case you have to make sure to have functions for initializing/destroying the external storage and call them in the proper order from your code.
Best Regards
Kristof
|
|
|
Powered by
FUDForum. Page generated in 0.02926 seconds