Topic
  • 2 replies
  • Latest Post - ‏2013-04-19T11:48:03Z by RJadhav
RJadhav
RJadhav
11 Posts

Pinned topic Generate a function in 7.6.1.3

‏2013-04-19T08:03:43Z |

Hello

How do I create a function in Rhapsody in C 7.6.1.3 so that the code is generated in the following format in the specification file:

 

static int myFunc1(void)  { return (int)myFunc2(void);  }

Note that I want all this generated in the specification file.

Thanks.

 

  • shanz9903
    shanz9903
    314 Posts

    Re: Generate a function in 7.6.1.3

    ‏2013-04-19T09:08:03Z  

    I don't use Rhapsosdy in C, only C++.

    In C++ I can produce this using properties :- CPP_CG::Operation::Inline = in_declaration

    *  in_declaration - A class operation is generated inline in the class declaration. A global function is generated inline in the package specification file.

    Inlining an operation in the header might cause problems if the function body refers to other classes. For example, if the inlined code refers to another class (by way of a pointer such as itsRelatedClass), inlined code that is generated in a header might not compile. The implementation file for the class would have an #include for RelatedClass, but the specification file would not. The workaround is to create a Usage dependency of the class with the inlined function on the related class. This forces an #include of the related class to be generated in the header of the dependent class with the inlined function.
     

    class class_0 {
        ////    Constructors and destructors    ////
        
    public :

        //## auto_generated
        class_0();
        
        //## auto_generated
        ~class_0();
        
        ////    Operations    ////
        
        //## operation myFunc1()
       inline static int myFunc1() {
            //#[ operation myFunc1()
            return (int)myFunc2(void);

            //#]
        }
    };

  • RJadhav
    RJadhav
    11 Posts

    Re: Generate a function in 7.6.1.3

    ‏2013-04-19T11:48:03Z  
    • shanz9903
    • ‏2013-04-19T09:08:03Z

    I don't use Rhapsosdy in C, only C++.

    In C++ I can produce this using properties :- CPP_CG::Operation::Inline = in_declaration

    *  in_declaration - A class operation is generated inline in the class declaration. A global function is generated inline in the package specification file.

    Inlining an operation in the header might cause problems if the function body refers to other classes. For example, if the inlined code refers to another class (by way of a pointer such as itsRelatedClass), inlined code that is generated in a header might not compile. The implementation file for the class would have an #include for RelatedClass, but the specification file would not. The workaround is to create a Usage dependency of the class with the inlined function on the related class. This forces an #include of the related class to be generated in the header of the dependent class with the inlined function.
     

    class class_0 {
        ////    Constructors and destructors    ////
        
    public :

        //## auto_generated
        class_0();
        
        //## auto_generated
        ~class_0();
        
        ////    Operations    ////
        
        //## operation myFunc1()
       inline static int myFunc1() {
            //#[ operation myFunc1()
            return (int)myFunc2(void);

            //#]
        }
    };

    Hi

    When I use inline property in Rhapsody in C, it generates it as #define

    #define myFunc1(void)  \

                  return (int)myFunc2(void); 

    Plus there is no inline = in_declaration property. There is in_header property!

     

    Any idea?