Topic
  • 5 replies
  • Latest Post - ‏2013-12-26T10:31:11Z by AM@15
AM@15
AM@15
20 Posts

Pinned topic How to generate files for blocks rather than structures in Rhapsody SysML in C

‏2013-12-20T05:56:28Z |

Hi All,

I am having SysML  project  in ''C' having blocks with in blocks and after code generation of this project all blocks are generated as

structures but I want to generate separate Specification and Implementation files for each block, Kindly let me know the settings to

generate the same.

I tried removing keyword struct from property C_CG::Class::InstanceDeclaration but still structures are generating and I am

not able get separate files.

Plz suggest the possible solution for the same.

Regards

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts
    ACCEPTED ANSWER

    Re: How to generate files for blocks rather than structures in Rhapsody SysML in C

    ‏2013-12-24T00:14:53Z  
    • AM@15
    • ‏2013-12-23T09:59:06Z

    Hi Shinji,

     

    Thanks for your response.If I include parts within blocks then specification and implementation files are generated for both blocks and parts

    separately but in these files blocks and parts are generated as structures for C project.

    I don't want these structures to be generated as I want to access attributes and functions directly as per the design.

     

    Example:

    Generated from rhapsody as:

    A) Code for block

    #ifndef block_5_H
    #define block_5_H

    /*## auto_generated */
    #include <oxf\oxf.h>
    /*## auto_generated */
    #include <..\Profiles\SysML\SIDefinitions.h>
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\TRACK\TRACK.h"
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\FOUNDATION"
    /*## package Default */

    /*## class block_5 */
    typedef struct block_5 block_5;
    struct block_5 {
     int attribute_0;        /*## attribute attribute_0 */
    };

     

    B) Code for part

    #ifndef part0_H
    #define part0_H

    /*## package SITU_LLD */

    /*## class block5::part0 */
    struct part0_t {
        int attribute_0;        /*## attribute attribute_0 */
    };

    /***    User explicit entries    ***/


    /* Operations */

    //Description:
    /*## operation Operation_1() */
    void Operation_1(void);
    #endif

     

    C) I don't want attributes and function associated with structures.That is file without structures as mentioned below:

    #ifndef block_5_H
    #define block_5_H

    /*## auto_generated */
    #include <oxf\oxf.h>
    /*## auto_generated */
    #include <..\Profiles\SysML\SIDefinitions.h>
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\TRACK\TRACK.h"
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\FOUNDATION"
    /*## package Default */

    /*## class block_5 */

    int attribute_0;        /*## attribute attribute_0 */

     

    Hi AM@15,

    Have you thought about using "File" element instead of "Block"? Every attributes/operations defined in File becomes global like (C). Also, you might create your own stereotype (applicable to: File) and allocate your preferred graphical icons to it, so that you can distinguish it from ordinary "File" elements. For more information about creating own stereotypes, take a quick look into 1638463 and Extending and Customizing Rhapsody.

    Apart from mentioned above, another possible solution would be to customize default code generation process. There are 3 ways to do so...

    (1) Post Processor
    (2) CG SDK (Simplifier, Hooks, etc)
    (3) Rules Composer (separate license is required)

    Using Post Processor, it is possible to manipulate the syntax or semantic of programming language as you wish, but doing so is quite erroneous and should be avoided especially if you use RoundTrip feature. The link below shows examples of Post Processor usage:

     

     

    Using CG SDK, you can achieve a high level of code customization. CG SDK provides all the mechanism ("Simplify" Properties and Hooks) required to perform code customization at the transformation (simplification) level, yet this process is quite complicated. If you require more information on this topic, you should go to Rational Rhapsody Enlightenment Webinar Series page and look for the topic called "Software Development: Code Generation: Basics, Customizations & Advanced Customization".

    With Rules Composer, basically, you can have 100% control over the way how the model is translated into code, yet additional license is required so not the option for everyone.

    Sorry, I'm not aware of any property to strip off "struct" keywords as suggested in (C).

    Hope it can be of any help.

    Best Regards,

    Shinji Kanai
     



     

    Updated on 2013-12-24T00:17:36Z at 2013-12-24T00:17:36Z by AE91_SHINJI_KANAI
  • AM@15
    AM@15
    20 Posts

    Re: How to generate files for blocks rather than structures in Rhapsody SysML in C

    ‏2013-12-21T14:48:10Z  

    Hi everyone.......Kindly let me know any suggestions/answer for the above mentioned question.

     

     

    Regards

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: How to generate files for blocks rather than structures in Rhapsody SysML in C

    ‏2013-12-23T08:00:42Z  
    • AM@15
    • ‏2013-12-21T14:48:10Z

    Hi everyone.......Kindly let me know any suggestions/answer for the above mentioned question.

     

     

    Regards

    Hi AM@15, 

    I believe we can't create a nested block(s) within a block, although it is possible with UML classes; please correct me if I'm wrong. If you are creating parts within a block in RiC, those parts will be translated to structures but separate specification files and implementation files should be generated for each parts of implicit type... If you could tell me how you created blocks within blocks and an example of code you want to generate, I might be able to suggest possible approaches. 

    Best Regards,

    --Shinji

  • AM@15
    AM@15
    20 Posts

    Re: How to generate files for blocks rather than structures in Rhapsody SysML in C

    ‏2013-12-23T09:59:06Z  

    Hi AM@15, 

    I believe we can't create a nested block(s) within a block, although it is possible with UML classes; please correct me if I'm wrong. If you are creating parts within a block in RiC, those parts will be translated to structures but separate specification files and implementation files should be generated for each parts of implicit type... If you could tell me how you created blocks within blocks and an example of code you want to generate, I might be able to suggest possible approaches. 

    Best Regards,

    --Shinji

    Hi Shinji,

     

    Thanks for your response.If I include parts within blocks then specification and implementation files are generated for both blocks and parts

    separately but in these files blocks and parts are generated as structures for C project.

    I don't want these structures to be generated as I want to access attributes and functions directly as per the design.

     

    Example:

    Generated from rhapsody as:

    A) Code for block

    #ifndef block_5_H
    #define block_5_H

    /*## auto_generated */
    #include <oxf\oxf.h>
    /*## auto_generated */
    #include <..\Profiles\SysML\SIDefinitions.h>
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\TRACK\TRACK.h"
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\FOUNDATION"
    /*## package Default */

    /*## class block_5 */
    typedef struct block_5 block_5;
    struct block_5 {
     int attribute_0;        /*## attribute attribute_0 */
    };

     

    B) Code for part

    #ifndef part0_H
    #define part0_H

    /*## package SITU_LLD */

    /*## class block5::part0 */
    struct part0_t {
        int attribute_0;        /*## attribute attribute_0 */
    };

    /***    User explicit entries    ***/


    /* Operations */

    //Description:
    /*## operation Operation_1() */
    void Operation_1(void);
    #endif

     

    C) I don't want attributes and function associated with structures.That is file without structures as mentioned below:

    #ifndef block_5_H
    #define block_5_H

    /*## auto_generated */
    #include <oxf\oxf.h>
    /*## auto_generated */
    #include <..\Profiles\SysML\SIDefinitions.h>
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\TRACK\TRACK.h"
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\FOUNDATION"
    /*## package Default */

    /*## class block_5 */

    int attribute_0;        /*## attribute attribute_0 */

     

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: How to generate files for blocks rather than structures in Rhapsody SysML in C

    ‏2013-12-24T00:14:53Z  
    • AM@15
    • ‏2013-12-23T09:59:06Z

    Hi Shinji,

     

    Thanks for your response.If I include parts within blocks then specification and implementation files are generated for both blocks and parts

    separately but in these files blocks and parts are generated as structures for C project.

    I don't want these structures to be generated as I want to access attributes and functions directly as per the design.

     

    Example:

    Generated from rhapsody as:

    A) Code for block

    #ifndef block_5_H
    #define block_5_H

    /*## auto_generated */
    #include <oxf\oxf.h>
    /*## auto_generated */
    #include <..\Profiles\SysML\SIDefinitions.h>
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\TRACK\TRACK.h"
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\FOUNDATION"
    /*## package Default */

    /*## class block_5 */
    typedef struct block_5 block_5;
    struct block_5 {
     int attribute_0;        /*## attribute attribute_0 */
    };

     

    B) Code for part

    #ifndef part0_H
    #define part0_H

    /*## package SITU_LLD */

    /*## class block5::part0 */
    struct part0_t {
        int attribute_0;        /*## attribute attribute_0 */
    };

    /***    User explicit entries    ***/


    /* Operations */

    //Description:
    /*## operation Operation_1() */
    void Operation_1(void);
    #endif

     

    C) I don't want attributes and function associated with structures.That is file without structures as mentioned below:

    #ifndef block_5_H
    #define block_5_H

    /*## auto_generated */
    #include <oxf\oxf.h>
    /*## auto_generated */
    #include <..\Profiles\SysML\SIDefinitions.h>
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\TRACK\TRACK.h"
    /*## auto_generated */
    #include "E:\RhapsodyProject\MainApplication\FOUNDATION"
    /*## package Default */

    /*## class block_5 */

    int attribute_0;        /*## attribute attribute_0 */

     

    Hi AM@15,

    Have you thought about using "File" element instead of "Block"? Every attributes/operations defined in File becomes global like (C). Also, you might create your own stereotype (applicable to: File) and allocate your preferred graphical icons to it, so that you can distinguish it from ordinary "File" elements. For more information about creating own stereotypes, take a quick look into 1638463 and Extending and Customizing Rhapsody.

    Apart from mentioned above, another possible solution would be to customize default code generation process. There are 3 ways to do so...

    (1) Post Processor
    (2) CG SDK (Simplifier, Hooks, etc)
    (3) Rules Composer (separate license is required)

    Using Post Processor, it is possible to manipulate the syntax or semantic of programming language as you wish, but doing so is quite erroneous and should be avoided especially if you use RoundTrip feature. The link below shows examples of Post Processor usage:

     

     

    Using CG SDK, you can achieve a high level of code customization. CG SDK provides all the mechanism ("Simplify" Properties and Hooks) required to perform code customization at the transformation (simplification) level, yet this process is quite complicated. If you require more information on this topic, you should go to Rational Rhapsody Enlightenment Webinar Series page and look for the topic called "Software Development: Code Generation: Basics, Customizations & Advanced Customization".

    With Rules Composer, basically, you can have 100% control over the way how the model is translated into code, yet additional license is required so not the option for everyone.

    Sorry, I'm not aware of any property to strip off "struct" keywords as suggested in (C).

    Hope it can be of any help.

    Best Regards,

    Shinji Kanai
     



     

    Updated on 2013-12-24T00:17:36Z at 2013-12-24T00:17:36Z by AE91_SHINJI_KANAI
  • AM@15
    AM@15
    20 Posts

    Re: How to generate files for blocks rather than structures in Rhapsody SysML in C

    ‏2013-12-26T10:31:11Z  

    Hi AM@15,

    Have you thought about using "File" element instead of "Block"? Every attributes/operations defined in File becomes global like (C). Also, you might create your own stereotype (applicable to: File) and allocate your preferred graphical icons to it, so that you can distinguish it from ordinary "File" elements. For more information about creating own stereotypes, take a quick look into 1638463 and Extending and Customizing Rhapsody.

    Apart from mentioned above, another possible solution would be to customize default code generation process. There are 3 ways to do so...

    (1) Post Processor
    (2) CG SDK (Simplifier, Hooks, etc)
    (3) Rules Composer (separate license is required)

    Using Post Processor, it is possible to manipulate the syntax or semantic of programming language as you wish, but doing so is quite erroneous and should be avoided especially if you use RoundTrip feature. The link below shows examples of Post Processor usage:

     

     

    Using CG SDK, you can achieve a high level of code customization. CG SDK provides all the mechanism ("Simplify" Properties and Hooks) required to perform code customization at the transformation (simplification) level, yet this process is quite complicated. If you require more information on this topic, you should go to Rational Rhapsody Enlightenment Webinar Series page and look for the topic called "Software Development: Code Generation: Basics, Customizations & Advanced Customization".

    With Rules Composer, basically, you can have 100% control over the way how the model is translated into code, yet additional license is required so not the option for everyone.

    Sorry, I'm not aware of any property to strip off "struct" keywords as suggested in (C).

    Hope it can be of any help.

    Best Regards,

    Shinji Kanai
     



     

     

    Thanks a lot Shinji for your answer.

     

    Regards

    AM