Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [etrice-dev] Fwd: Status of cpp code generator (by Peter Karlitschek)

Hi Peter,

good to hear you are already so far with the C++ generator!

I'll try to answer your questions:
- building attribute initializer lists: in cpp I don't want to create instances of data classes on the heap, but instead I would like to initialize those attributes in the constructor. -> would be good to get some generic support here
have a look at the Java generator. There we have attribute initialization in the constructor
/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend, line 117ff

The attributeInitialization Xtend-method is Java specific right now. You might want to copy and modify it and see later whether we can sort of unify this for C++ and Java
- building the state machine code: in cpp I have to split up the generated code into .h and .cpp file, for example I need the member function declarations in the header and the implementation in the code. This is currently not supported by the generic generator -> I think we need support here similar to operation-generation functions
we currently
already have this split for C. We achieved this for operations using two distinct methods in the ProcedureHelpers:
operationsDeclaration and operationsImplementation
The generic state machine generator produces a number of implementation functions which have to be declared in the private part of the class definition though.
To make these available you could add a method to the
/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend
which generates the method declarations, e.g.
def genStateMachineMethodDeclarations(ExpandedActorClass xpac)
- Message pooling: efficient allocation scheme for Messages is still needed
sure. But for the beginning just keep it simple (as in C where we currently just use a fixed message size)
- Threading: Question is which library to base it onto. My favorite would be to use boost and later switch to C++11 threads
we should have a generic interface which shields us from the actual implementation. This would be located (similar to C) in a common/platform part.
We need threads, a synchronization object (semaphore) and a timer giving a (reliable and accurate) system time.
Then we should have a generic platform implementation (again similar to C) which should use the posix interface (and thus works with MinGW or on *nix systems)
- Unittests: For the runtime and for the generator itself. On which test framework should the cpp-runtime tests be based.
please use the etUnit framework we created as part of the C runtime library. It is very simple (see the runtime.c.tests for usage examples) and general enough for our purposes.
It produces a simple ASCII text file which can be converted using our etunit.converter into the xunit xml format.
For high level tests of the code generators we recently introduced target language independent models located in generator.common.tests. They are used by both, generator.java.tests and generator.c.tests. In the language dependent part there are Ant scripts which copy the appropriate models, compile and link all sources, execute the tests and convert and copy the results.
The two tests we currently have should also work for C++. You can use the generator.c.tests as a template to create generator.cpp.tests and adjust the Ant script.


You could push your code to Gerrit (for an explanation how to use it see http://wiki.eclipse.org/ETrice/Development/Repository#Gerrit).
Then I could have a look at it. I'm really excited to see it!

-Henrik

Am 28.09.2012 13:09, schrieb Henrik Rentz-Reichert:
this message was meant for etrice-dev@xxxxxxxxxxx - so I just forward it...


-------- Original-Nachricht --------
Betreff: Status of cpp code generator
Datum: Thu, 27 Sep 2012 08:15:19 +0200
Von: Karlitschek, Peter <Peter.Karlitschek@xxxxxxxxxxx>
An: 'Henrik Rentz-Reichert' <hrr@xxxxxxxxx>, "Thomas.Jung@xxxxxxxxx" <Thomas.Jung@xxxxxxxxx>, Thomas Schuetz <ts@xxxxxxxxx>


Hi developers,
I just wanted to let you know how far I have come until now. The last weeks I could make some slow but steady progress and today I could for the first time _build_ an executable from a simple model, with all the generators in place (protocol, data class, actor, subsystem, subsytem runner).  That doesn't mean that the executable already does anything, but that's the next step.

There are some topics that I worked around which require more attention in the next step or later.
Here is my todo list:

- building attribute initializer lists: in cpp I don't want to create instances of data classes on the heap, but instead I would like to initialize those attributes in the constructor. -> would be good to get some generic support here

- building the state machine code: in cpp I have to split up the generated code into .h and .cpp file, for example I need the member function declarations in the header and the implementation in the code. This is currently not supported by the generic generator -> I think we need support here similar to operation-generation functions

- Message pooling: efficient allocation scheme for Messages is still needed

- Threading: Question is which library to base it onto. My favorite would be to use boost and later switch to C++11 threads

- Unittests: For the runtime and for the generator itself. On which test framework should the cpp-runtime tests be based.

- Modellib:	 Not started yet

Hope this gives a picture of the current status. I'm happy about any suggestions how to continue, especially to test the code.
Best regards,
Peter

Dr. Peter Karlitschek

Senior Software Engineer
R&D Software Algorithms and Applications

Dräger Medical GmbH
Moislinger Allee 53─55
23558 Lübeck, Germany
Tel  +49 451 882-5076
Fax +49 451 882-75076
peter.karlitschek@xxxxxxxxxxx
www.draeger.com

Dräger. Technology for Life ®

P Please consider the environment before printing this e-mail

Sitz der Gesellschaft/Registered office: Lübeck; Handelsregister/Commercial register: Amtsgericht/Local court Lübeck HRB 4358 HL; Geschäftsführer/General manager: Stefan Dräger (Vors./chairm.), Dr. Herbert Fehrecke, Andreas Frahm, Gert-Hartwig Lescow, Anton Schrofner
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.

Diese Nachricht enthaelt vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfaenger dieser E-mail sein, senden Sie bitte diese an den Absender zurueck und loeschen Sie die E-mail aus Ihrem System.

--
______________________________
Dr. Henrik Rentz-Reichert

hrr@xxxxxxxxx
+49-7551-831365

Am Bacheck 7A
D-88662 Überlingen-Deisendorf

EclipseCon Europe 2012




_______________________________________________
etrice-dev mailing list
etrice-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/etrice-dev


Back to the top