It is currently Tue Feb 07, 2012 9:18 pm

All times are UTC



Welcome
Welcome to RHAPSODY4YOU

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, respond to polls, upload and download content, and access many other special features. Registration is fast, simple, and absolutely free, so please, register to join our community today.





 Page 1 of 1 [ 2 posts ] 
Author Message
 Post subject: accessing event parameter after entry-to-new-state action
PostPosted: Fri Aug 27, 2010 12:28 pm 

Joined: Tue Jun 24, 2008 6:18 pm
Posts: 141
Location: Ankara
Think of a state which can be entered from many transitions, and assume that each event for each transition carries a specific object as its parameter.

So, the execution order is : Exit-from-prev-state-action, transition action, Enter-to-new-state-action.

The event parameter is only achievable during the transition-action via "params" macro, isn't it ? It can not be accessed after the new state is entered. Right ?

I want to be able to process the specific object, carried by each event, at the end of this execution sequence, namely only after the enter-to-new-state-action execution is completed.

How can I achieve that ?


Offline
 Profile  
 
 Post subject: Re: accessing event parameter after entry-to-new-state action
PostPosted: Sun Sep 05, 2010 12:16 am 

Joined: Wed Oct 31, 2007 3:09 pm
Posts: 58
Location: Milkyway, classic 9-planet solar system
Why would you like to do it like that?

Of course you could do it, but it creates a lot of additional work.

As you say, you like to enter that state via various different transitions which get triggered by events, that may (or may not) have an event argument (accessible via params pointer only during the transition).

This means, that you would have to save some additional information during the transition (as a transition action), because otherwise you cannot know, which transition had been taken and which parameter had been passed, when you finally reach that state-entry (assuming not every transition carries the same number and the same type of arguments).

So the information you'll need to save (within local attributes of the class) are the id of the triggering event and the parameters carried along with it... and then you'll have to implement a switch/case decision within the state-entry-action of that state, in order to perform an event specific evaluation of arguments. Utilizing event operations (Copy Ctor and Assignment Operator) may help to finally do that.

But to be honest:
Rather than doing that additional coding work, I'd prefer to call the same kind of argument consumption operation at every single transition to that one state.

My opinion.

-Luke.



_________________
May the force be with you ...
Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:


suspicion-preferred