Topic
2 replies Latest Post - ‏2012-11-24T06:00:00Z by SystemAdmin
SystemAdmin
SystemAdmin
1305 Posts
ACCEPTED ANSWER

Pinned topic Object constructor and threadname

‏2012-11-23T04:40:36Z |
Hi,

I'm using rhapsody7.5, i want to create a object from class CA,which is an active class,and has the constructor CA(int arg). I have two ways to create the object.

1. I drag the CA to the model graph, and then make it to object.but the object has no property "activethreadname", so i cannot name the thread. Although i can name the class CA's thread name, i want to make the object's thread name different.
2. I make a object first, and then draw generalization relation to CA.In this way, I can name the object's threadname. But there is another problem, i can not set the object constructor's input parameter like the first way.

So what can I do if I want to set the constructor's input parameter, and also want to set the object's threadname?

Any suggestion will be appreciated.
Updated on 2012-11-24T06:00:00Z at 2012-11-24T06:00:00Z by SystemAdmin
  • Yevo
    Yevo
    278 Posts
    ACCEPTED ANSWER

    Re: Object constructor and threadname

    ‏2012-11-23T08:45:30Z  in response to SystemAdmin
    It is a bit tricky, but works.
    1) define your own CA constructor with parameter thrName of char* type
    2) set CG::Class::ActiveThreadName property to the thrName (its value should be the same as the name of parameter)
    3) uncheck CG::Class::GenerateImplicitConstructors property
    4) now you can define an object of CA and set the name of its thread in its initialization field of Features dialog. Don't forget quotes.

    See attached picture for more understanding.
    • SystemAdmin
      SystemAdmin
      1305 Posts
      ACCEPTED ANSWER

      Re: Object constructor and threadname

      ‏2012-11-24T06:00:00Z  in response to Yevo
      Yes,it's really tricky, but it really works.
      Thank you.