Book a Demo

Author Topic: C++ #include behaviors  (Read 4008 times)

chepburn

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
C++ #include behaviors
« on: December 07, 2007, 11:48:11 am »
Hi,
We are attempting to Forward Engineer the following:
namespace pkgA
{
classA:public otherBBpackage::classB
{

public:
 int methodA(otherXXClass *a);
 int methodB(otherYYClass &b);
};
}

where the parameters for methodA are defined as
a: otherXXClass [in]

and methodB parameter is
b: otherYYClass [inout]

The code generator generates

#include "otherBBPackage\classB.h"
#include "theXXpackagefoldername\otherXXClass.h"

but it does NOT generate
#include "theYYpackagefoldername\otherYYClass.h"

nor does it add
class otherYYClass;
before the class definition, or add
#include "theYYpackagefoldername\otherYYClass.h"
in the implementation cpp file.

What are we doing wrong here?  It seems that only [inout] parameter references stimulate the generation of an include file in the referencing class' definition.(or implementation)




danm

  • EA User
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: C++ #include behaviors
« Reply #1 on: December 07, 2007, 02:09:15 pm »
You have to learn and look at the code templates. Sparx (correctly in my mind) gives you minimal templates, ones that few people should use.

To get use out of the product you have to learn to roll your own.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ #include behaviors
« Reply #2 on: December 09, 2007, 01:00:00 pm »
My guess is that the classifier for the parameter of type otherYYClass isn't set.

chepburn

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: C++ #include behaviors
« Reply #3 on: December 10, 2007, 12:17:54 pm »
Hmmm.
We had a look at the classifiers, and nothing is jumping out at us. Still not successful.  We have experimented further with the use of pointers to classes in general.

In one class definition, we added a forward class declaration of:


class AbstractComponentState;

namespace subsystemCommon
{
class SubsystemComponentStatePool
{
public:
SubsystemComponentStatePool();
virtual ~SubsystemComponentStatePool();
void setState (AbstractComponentState *state);
      };
}

We reversed this code back to our model, and the
forward declaration added a dependency connector in the
SubsystemComponentStatePool  class diagram to
AbstractComponentState ... which is good.  And, it compiles.
However, if SubsystemComponentStatePool  is Forwarded
again,  the forward declaration is removed ,and of course, the code no longer compiles.

In addition, if we manually add an unnamed directional dependency in our class diagram, it ALSO does not generate any kind of forward declaration.

Either the forward declaration, or, the addition of the include file when a pointer to a class is used as a parameter would be nice to have.