![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: Creating reuseable state charts Topic Summary: Created On: 7-Dec-2007 12:26 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|||
In my current project I tried to build a statechart which consists of several substatecharts - some of them reoccur in different locations in the system. As I don't want to draw these substatecharts twice, I am searching for a possiblity to reuse the substatechart I built like a function.
I already tried to put the state chart into a new class but this is a problem because of my event mechanism. (when outsourcing substatecharts to own classes, the events to those state charts would have to be redirected, which is not too easy...) Maybe there is an easier way of sending the events to different objects without adjusting the receiver manually. Do you have any suggestions of how i can accomplish that goal? thanx in advance mike |
|||
![]() |
|||
![]() |
|||
Hi!
You should use state hierarchy. Excelent book is "Practical Statecharts in C/C++" of Miro Samek. Please, go to www.quantum-leaps.com. Sincerely Zoltan Gobor zoltan.gobor@tesbv.com |
|||
![]() |
|||
![]() |
|||
Thanx for your fast response.
It would be nice though if you could explain your idea a little bit further. Does Rhapsody support this approach or could you give me maybe a little rhapsody example of your idea. State hierarchy alone does not the trick for me, because i want to reuse a substatechart in different locations of the project. even in different classes. As i said, i would like to use it like a function. If i explained myself not clearly please tell me. thanx, Mike Edited: 9-Dec-2007 at 17:06 by mike t |
|||
![]() |
|||
![]() |
|||
Hi Mike,
My understanding is that re-using sub-state-charts in several state machines is not possible in Rhapsody at present, but is a candidate for potential inclusion in the late-2008 release. Because Telelogic may raise its priority if many users want it, I suggest that you submit an enhancement request to ssmdsupport@telelogic.com. But that won't solve your immediate problem, I realise, though the guys on support may be able to suggest a work-around. Doing a neat equivalent using parts, for example, is difficult because of the semantics of event handling (events handled at the lowest state that can receive them, ISTR). I suspect that you are left with the non-neat option of redirecting events. Some short-cuts may be possible, depending on your state structure and what states your events need to go to. We have managed some adequate (but still a bit messy) equivalents of re-used sub-state-charts by inherited state charts -- you might like to consider having a base class from which classes inherit the common state machine. (I guess you could put the common parts in an And state in the base class to make it clear what is re-used.) If you'd like further comments, a simple indication of your state structure, the bits you need to re-use and the events handled would be useful -- if you have an example that you are happy to post here. Regards, Charlie |
|||
![]() |
|||
![]() |
|||
Sorry for my late feedback and thanx for your remarks.
I tried a workaround for my project but its not a very good solution. I encountered another problem though as i tried to create an activity diagram for an operation. It works fine when i create an activity diagram for a class, but if i call the operation with the activity diagram it is not processed. Rhapsody does not generate code for the activity diagram in the operation. Maybe somebody can look at the attached project an tell me where the problem is. In the project you can see 2 activity diagrams. The one for the class is processed properly the one for the operation is not processed at all! The project is created with RiC 7.0. greets and thanx in advance
Edited: 8-Jan-2008 at 22:05 by mike t |
|||
![]() |
|||
![]() |
|||
Hi Mike, I see you have had no responses in a week, and this one isn't very helpful, I'm afraid.
I don't have a utility for opening rar files, so couldn't load your project. However, I note that in the user manual, under activity diagrams / code generation, it includes the words Rhapsody in C++ generates functor-based code for activity diagrams associated with operations. ... This might imply that for Rhapsody in C it still doesn't generate code for activity diagrams in operations -- I suggest that you consult the helpdesk about this. Regards, Charlie |
|||
![]() |
|||
![]() |
|||
Thanx for your response. I already contacted the support desk and they told me to use flow charts.
however it does not work with flow charts either. I attached the RiC projct as a .zip file this time. Would be nice if you have the time and see if you find any mistake on my side. If not, lets hope they integrate this feature in a new version of rhapsody. regards, mike
Edited: 15-Jan-2008 at 19:00 by mike t |
|||
![]() |
|||
![]() |
|||
Hi Mike,
I did as per the suggestion from support, i.e. changed the activity diagrams into flowcharts, then regenerated. It seems to show the actions in the flowchart OK. Model attached. What wasn't working for you? Regards, Charlie
|
|||
![]() |
|||
![]() |
|||
Well.. perfect
![]() Your answer was 100% helpful. My problem was/is, that i am using Rhapsody7.0 and in this version the flow chart approach does not work. If i use the current version of RiC it works just fine. Thanx for your help. You saved me a lot of time ![]() thanx good bye Mike |
|||
![]() |
|||
![]() |
|||
Hm...just out of curiousity:
"Flowcharts" are not an official part of UML, are they? I thought they were more or less replaced by ActivityDiagrams. Therefore I think this solution might work, but is probably not the cleanest one!? So if my conclusions are right - are Flowcharts the only way to model operations in RiC - or can anybody think of other ways (ideally, it should support modeling events inside operations, same as if statecharts could be used to model operations). Thanks, Michael |
|||
![]() |
Telelogic Rhapsody
» Rhapsody Category » Rhapsody
»
Creating reuseable state charts
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.