Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 24-Apr-2007 14:42
User is offline View Users Profile Print this message


Jim Spriggs

Posts: 16
Joined: 13-Dec-2006

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
Report this to a Moderator Report this to a Moderator
 3-May-2007 08:51
User is offline View Users Profile Print this message


Simon Morrish

Posts: 127
Joined: 17-May-2005

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
Report this to a Moderator Report this to a Moderator
 4-May-2007 12:19
User is offline View Users Profile Print this message


Jim Spriggs

Posts: 16
Joined: 13-Dec-2006

Hi Simon,

Yup, that's exactly what I needed.

Many thanks for taking the time and trouble to help me out.

Cheers,
--
jim

-------------------------
--
jim
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 1 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.