[Doxygen-users] class hierarchies with templates and doxygen 1.2.10
Brought to you by:
dimitri
From: Kris T. <kri...@cs...> - 2001-08-29 12:36:56
|
Hi, this is just to report experiences with templated class hierarchies with the latest doxygen. Sorry to keep banging on about this, but my class hierarchies are becoming ever more complicated and doxygen doesn't seem to keep up :-) First of all, when HAVE_DOT=YES, the inheritance diagrams seem to be much better now. Great ! The class hierarchies page is still incomplete. This might be by design though (see one of my previous emails on the difficulty in starting from base-level with templated hiearchies). Unfortunately, it looks like the non-dot inheritance diagrams reflect the situation of the 'class hierarchies page', instead of the dot-generated hierarchies. I don't see any particular reason for this, but as I have dot now, I'll live with it (I would put it in the doxygen doc somewhere though Dimitri). First, an illustration of 'incompleteness' of the class hierarchy: //! Base class Base {}; //! B template <class A> class B {}; //! B2 class B2 : public B<Base> {}; The class hierarchy (and non-dot inheritance graph) does not show that B2 is derived from B. Unfortunately, even the dot-generated inheritance diagrams can have problems. I spotted the following 2 remaining problems: problem 1: ---------- doxygen can get confused when the name of the template parameter is the same as the name of a class. Example: //! Base class Base {}; //! E template <class BASE> class E: public BASE{}; //! F class F : public E<Base> {}; //! EE template <class Base> class EE: public Base{}; //! FF class FF : public EE<Base> {}; As far as C++ goes, E,F and EE,FF are exactly the same. Doxygen's output differs in 3 ways though: - in the class hierarchies page, FF is show as derived from EE<Base> (but not from Base), while F is not shown to be derived from E<Base>. - in F's inheritance diagram, there is an orange arrow splitting off from E<Base> to E<BASE>. This isn't there in FF's diagram - in Base's inheritance diagram, E<Base>,F appear, but EE<Base>,FF not. problem 2: ---------- a problem with default template parameters Example: //! Base class Base {}; //! E template <class BASE> class E: public BASE{}; //! Base2 class Base2{}; //! WithDefault template <class X,class A=E<X> > class WithDefault : public A {}; //!UseDefault class UseDefault:public WithDefault<Base2> {}; //!NoDefault class NoDefault:public WithDefault<Base2,E<Base> > {}; As far as C++ goes, UseDefault and NoDefault are again the same. However, doyxgen infers only for NoDefault the correct hierarchy. For UseDefault, the dot graph shows it's derived from E<X> (which is derived from X). That is, it failed to fill in the X template parameter. Hopefully these 2 are not too difficult to fix... Many thanks Dimitri for all your work! Kris |