![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: How to set a "dirty" flag from each of a classes attribute accessors? Topic Summary: Created On: 24-Apr-2007 14:42 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi Guys,
<noobie alert> Can anyone clue me in on the recommended way to handle accessor/mutator generation and round-tripping in the following case? Suppose I have this simple class shown below, and I want to add a "dirty" flag to the class. Obviously, I can add something like "isDirty = true;" to setAngle(), etc, using the code editor. Equally obviously, with normal settings, round-tripping removes that line again. I'd like to have the accessors/mutators generated automatically the first time round, but after that I want Rhp to keep my modified versions. How can I do that? :confused: ######################################### myClass { // blah... double Spice2MarkableObject::getAngle() const { return angle; } void Spice2MarkableObject::setAngle(double p_angle) { angle = p_angle; } // blah... //// Attributes //// protected : double angle; //## attribute angle // This is the dirty flag. // It is set true whenever an attribute is changed, and false by some sort of "cleanMeUp()" operation. bool isDirty; //## attribute isDirty // blah... } ######################################### Thanks! -- Jim Spriggs ------------------------- -- jim |
|
![]() |
|
![]() |
|
Hi Jim
Here's a good way to do it: [list=1] [*]In your package or project, set the CG::CGGeneral::GeneratedCodeInBrowser property to true. (If you set it at the project level, you might need to reload your model.) [*]You should now be able to view your generated accessors and mutators in the browser. (You can tell which operations are generated as they have a little circle in the top right of their icon.) [*]Edit mutators as you wish. [*]Note that each one you edit becomes "non-generated" and loses its little circle icon. [*]When you're done, you can turn GeneratedCodeInBrowser off again. [/list] I hope that works for you. Let me know how you get on! best regards, Simon ------------------------- Simon Morrish simon.morrish@eu.panasonic.com http://panasonic.co.uk Panasonic ideas for life |
|
![]() |
|
![]() |
|
Hi Simon,
Yup, that's exactly what I needed. Many thanks for taking the time and trouble to help me out. Cheers, -- jim ------------------------- -- jim |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.