Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [etrice-dev] Actor Attribute and message data with the same name

Hi Thomas,

you propose to use a keyword for the data. But this wouldn't solve the problem since also this would be in conflict with possible attributes with the same name.
Actually this is a quite common problem. In Java you would solve this by writing this.data for the attribute. Just data would bind to the local variable.
That's how I would like to treat it. And I think the Generic Action Language can solve this (even with the current parser we could do that).

Kind regards,
Henrik

Am 17.05.2012 16:47, schrieb Thomas.Jung@xxxxxxxxx:

Hi all,

 

I am working with C and I saw the following “problem”:

 

If an Actor has an Attribute like:

 

             Structure {

                    external Port ControlPort

                    SAP timer: PTimer

                    Attribute id: uint16

                    Attribute data:MyDataClass

 

And a receiving message has a parameter (which is defined in the protocol) like:

 

       ProtocolClass PButtonController {

             incoming {

                    Message setId(data: uint16)

             }

             outgoing {

                    Message pressed()

 

The C Code generator produces the following output:

 

/* Action Codes */

static void action_TRANS_tr0_FROM_waitForId_TO_released_BY_setIdControlPort(ButtonController* self, InterfaceItemBase ifitem, uint16 data) {

       self->id=self->data;

       PTimerConjPort_startTimeout(&self->constData->timer, 50);

}

 

In this case „data“ will be interpreted as the Attribute and you can never access the parameter which is sent to actor.

 

This is not a major problem but could be avoided by defining a keyword for the parameter which is sent via a message. In this case it would no longer be necessary (possible) to define your own name for a message data. You would access the received data always via the defined keyword (which is nothing more than a fixed name for the message data).

 

The problem with the current solution is that you may use the same Protocol class at several ActorClasses.

 

Can we solve this by using the action language???

If not, do you think we should change that??

 

Best Regards

Thomas

 

Thomas Jung, Senior Developer Embedded Systems
Tieto ES GmbH,
email
thomas.jung@xxxxxxxxxxx, Telefon +49 89 78 722 352, Mobil +49 160 90 77 23 61,
Schertlinstraße 8, 81379 München

Tieto ES GmbH, Schertlinstraße 8, 81379 München
Geschäftsführung: Olaf Dicker, Willem Huisman
Sitz der Gesellschaft: München, Amtsgericht München HRB 188002

Wichtiger Hinweis: Diese E-Mail und etwaige Anlagen können Betriebs- oder Geschäftsgeheimnisse, dem Anwaltsgeheimnis unterliegende oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen der Status dieser E-Mail bekannt. Bitte benachrichtigen Sie uns in diesem Fall sofort durch Antwort-Mail und löschen Sie diese E-Mail nebst etwaigen Anlagen von Ihrem System. Ebenso dürfen Sie diese E-Mail oder seine Anlagen nicht kopieren oder an Dritte weitergeben. Vielen Dank.

 



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

-- 
______________________________

Dr. Henrik Rentz-Reichert

mailto:hrr@xxxxxxxxx
+49-7551-831365

Am Bacheck 7A
D-88662 Überlingen-Deisendorf

Back to the top