Dear,
C++ generator do not detect circular dependencies (exemple enclosed). The great thing is the generator write :
FILE 1 :
class Classe2 {} // TO AVOID CIRCULAR DEPENDENCY. Only the class where target the dependency is rewrite.
/// class Classe1 -
class Classe1 {
// Attributes
public:
Classe2 * c2;
};
FILE 2 :
class Classe1 {} // TO AVOID CIRCULAR DEPENDENCY.
/// class Classe2 -
class Classe2 {
// Attributes
public:
Classe1 c1;
};
Dear,
C++ generator do not detect circular dependencies (exemple enclosed). The great thing is the generator write :
FILE 1 :
#ifndef __CLASSE1_H__
#define __CLASSE1_H__
#include "Classe2.h"
class Classe2 {} // TO AVOID CIRCULAR DEPENDENCY. Only the class where target the dependency is rewrite.
/// class Classe1 -
class Classe1 {
// Attributes
public:
Classe2 * c2;
};
#endif
FILE 2 :
#ifndef __CLASSE2_H__
#define __CLASSE2_H__
#include "Classe1.h"
class Classe1 {} // TO AVOID CIRCULAR DEPENDENCY.
/// class Classe2 -
class Classe2 {
// Attributes
public:
Classe1 c1;
};
#endif
But first, to avoid the bufferoverflow, the enclosed patch should be apply.
About the second part (adding "class Classe1 {};") that prevent circular dependency, I don't have any idea to solve that problem.
See comment at beginning of decls.h:
Your patch would break the ordering by ascending dependency?
Ohh, my… You're right. I just did a test and that didn't works with my patch. I understand now the problem with circular dependencies.
What do you think about this new patch ? It's store on a temporary namelist every class/package at the beginning of the push function. I made some test and I didn't saw any problem.
Thanks for providing the new patch. I applied it on git master in commit 6c1284c.
I worked today about the second part (adding "class Classe1 {};"). Please find enclosed a patch that found circular dependencies. Modifications in generate_code_cpp are only to show (and check) the loops.
Actually my problem is that I found loop as name of the class but not as node (so for each node, it's missing the name of the file and the complet name (with namespace)). Do you have an idea to solve that problem or to help me with the patch ?
An example. It detects only 2 of the 3 loops but it looks like it's always detect the biggest loop. So, it's okay.