Book a Demo

Author Topic: Question about C++ code generation  (Read 3125 times)

Gluber

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Question about C++ code generation
« on: March 10, 2004, 03:41:36 pm »
Hi !
My company is currently evaluating EA for our inhouse UML modelling needs.

So far we are very impressed ( best showing from an UML tool so far ) However there is one detail left that i need to sort out.

We generate code for our C++ applications, and using the integrated template language we have bound the generation of code almost to our will. However there is one thing left.

We have a very rigorous in company coding standard, here is an example header file:

//----------------------------------------------------------------------------------------
//  ______      _             _ _____             _ _ _        
// |  ____|    | |           | |  __ \           | (_) |        
// | |__   __ _| | __ ___  __| | |__) | ___  __ _| |_| |_ _   _
// |  __| / _` | |/ // _ \/ _` |  _  / / _ \/ _` | | | __| | | |
// | |   | (_| |   <|  __/ (_| | | \ \|  __/ (_| | | | |_| |_| |
// |_|    \__,_|_|\_\\___|\__,_|_|  \_\\___|\__,_|_|_|\__|\__, |
//                                                         __/ |
//                                                        |___/
//
//----------------------------------------------------------------------------------------
// Originally created on 10/01/2004 by Bernhard Glueck
// Copyright 2004, Realspace Technologies OEG, all rights reserved.
//----------------------------------------------------------------------------------------
//
//    $URL: http://dummy $
// $Author: $
//    $Rev: 3 $
//   $Date: 2004-01-19 10:06:30 +0100 (Mon, 19 Jan 2004) $
//
//----------------------------------------------------------------------------------------
//  
//    Contents:
//
//----------------------------------------------------------------------------------------
#ifndef _FR_CORE_IO_ENDIAN_
#define _FR_CORE_IO_ENDIAN_

namespace Fr
{
   namespace Core
   {
       namespace Io
       {
           class Endian
           {
               public:

               private:

           };
       }
   }
}

#endif // _FR_CORE_IO_ENDIAN_

//----------------------------------------------------------------------------------------
// End of file
//----------------------------------------------------------------------------------------


We managed to reproduce that source code look almost exactly however i can't generate the namespace declarations from the packages.. Ideally every package should correspond to one namespace.....  The docs metnion that the namespace list is not available to C++ .... ( we set "Package as namespace Root" ) of course...

This is how far we got:

//----------------------------------------------------------------------------------------
//  ______      _             _ _____             _ _ _        
// |  ____|    | |           | |  __ \           | (_) |        
// | |__   __ _| | __ ___  __| | |__) | ___  __ _| |_| |_ _   _
// |  __| / _` | |/ // _ \/ _` |  _  / / _ \/ _` | | | __| | | |
// | |   | (_| |   <|  __/ (_| | | \ \|  __/ (_| | | | |_| |_| |
// |_|    \__,_|_|\_\\___|\__,_|_|  \_\\___|\__,_|_|_|\__|\__, |
//                                                         __/ |
//                                                        |___/
//
//----------------------------------------------------------------------------------------
// Originally created on 11-Mär-2004 00:26:50 by .
// Copyright 2004, Realspace Technologies OEG, all rights reserved.
//----------------------------------------------------------------------------------------
//
//    $URL: $
// $Author: $
//    $Rev: $
//   $Date: $
//
//----------------------------------------------------------------------------------------
//  
//    Contents: Declaration of the Class Vertex.
//
//----------------------------------------------------------------------------------------
#ifndef _FR_GRAPHICS_ART_VERTEX_HPP_
#define _FR_GRAPHICS_ART_VERTEX_HPP_

#include "Polygon.h"

class Vertex
{

public:
     Vertex();
     virtual ~Vertex();

public:
     Polygon *Polygon;

};

#endif // _FR_GRAPHICS_ART_VERTEX_HPP_

//----------------------------------------------------------------------------------------
// End of file
//----------------------------------------------------------------------------------------


Also note that the package as namespace root option seems to be somewhat buggy... ( if you remove such an option using the project ->namespaces dialog it is not transferred to the model elements, you have to clear each flag in the project browser too.... )

ALso note that i generate the include guards in the above example using the "PackagePath" macro ..... but if i set a package as a namespace root, this package disappears from the PackagePath variable.......

And last, a TO_UPPER macro would also be great ( right now i have it done manually using a series of REPLACE calls )

Anyone knows if this can be done ?

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: Question about C++ code generation
« Reply #1 on: March 10, 2004, 09:38:52 pm »
Hi Gluber,

EA 4.0 will help you with the namespace generation- a previous thread outlined the limitations of the current version.  See:

http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.cgi?board=general;action=display;num=1066144223

Regarding the TO_UPPER macro- thanks for the suggestion. There are plans to augment the current set of function macros and this will be included.

Regards,
Ben

Gluber

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Question about C++ code generation
« Reply #2 on: March 11, 2004, 09:29:45 am »
Thanks for your quick reply and help
Considering this i just bought a EA Professional License and downloaded EA 4.0 ..
I will now try to achieve what i want with that version.

However still, with those little problems EA is the best showing so far from any UML tool ( including ROSE, XDE,TOGETHER, and others )