Author Topic: Pointer data types  (Read 5792 times)

Dani

  • EA User
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
Pointer data types
« on: January 20, 2005, 02:05:56 am »
How do people handle the following situation:

I am defining an interface (C++) and some of the parameters in my methods are pointer types. I have types defined for their non pointer counterparts, i.e. types for each class but no type for pointer to class. To enter the type of a parameter I select the appropriate class from the "type" drop down list and then add a "*" manually to indicate it is a pointer. The problem arises if later on I decide to change the name of the class. All pointer parameters stay with the old name as adding the "*" seems to break the link. Is there an elegant way to model this in EA ?

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: Pointer data types
« Reply #1 on: January 20, 2005, 06:24:24 am »
How about using integer type and Hungarian Notation for the name?

E.g., "ptrCurrentForm".


Just a thought....
Verbal Use Cases aren't worth the paper they are written upon.

Dani

  • EA User
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
Re: Pointer data types
« Reply #2 on: January 20, 2005, 06:28:07 am »
That would be lying about the real type of the argument. All generated dcoumentation and code would be wrong.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Pointer data types
« Reply #3 on: January 20, 2005, 01:58:50 pm »
If you set Kind=out or Kind=inout (in the listbox just below the Type combobox) that will put the '*' in automatically for you.
The Sparx Team
[email protected]

Dani

  • EA User
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
Re: Pointer data types
« Reply #4 on: January 21, 2005, 12:16:06 am »
Hi,

Thanks very much for your reply. I noticed that effect with the "inout" kind alright. However the "out" doesn't seem to add the "*" for me which I remember thinking it was strange.

However, even though that improves the situation it still doesn't completely resolve it because I could have an input ("in") parameter that I pass in as a pointer.

I could alwyas use the "inout" to work around the pointer isuue and somehow remove the "kind" field from the documentation, but that would be fudging the issue.

By the way I'm using 4.5 build 744.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Pointer data types
« Reply #5 on: January 23, 2005, 01:28:58 pm »
The default code templates don't use the parameter kind, you would need to modify your template to make it generate a pointer from that.

For that matter if you really wanted to you could generate the '*' if the notes contained (or started with) "this parameter is a pointer" and then strip that out of the generated comments if needed.  A down side of this though is that reverse engineering will not do this.

Simon

Dani

  • EA User
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
Re: Pointer data types
« Reply #6 on: January 24, 2005, 05:15:49 am »
Actually, it's the documentation generation rather than code that worries me. I guess I can investigate the rtf template (looks pretty cryptic at first glance) or have a look at the automation interface and the report generation add-in.