[aspectc-user] Using puma to print out class member names

Sunder, Shyam (MSTG - NY) s_sunder at ml.com
Thu Dec 30 19:13:44 CET 2004


Ok,

Here's the other problem. Consider this:

class A
{
public:
    int a;

private:
    int b;

protected:
    int c;
};

template<typename T>
class C : T
{
};

template<>
class C<A> : A
{
};

class E : C<A>
{
};
 

Other than the fact the T is not reported as a base-class of C, C<A> is
not reported as the base-class of E. It is reported as:
    class : E   [base classes: C]  
    namespace : %C<A>    [instance scope] [builtin] [anonymous] 

Also, class E is reported to have an attribute '%anon15'.

My only requirement is the correctly report all the base class and
attribute names and types correctly. Any help in this area would be
greatly appreciated.

Thanks
Shyam

-----Original Message-----
From: Olaf Spinczyk [mailto:Olaf.Spinczyk at informatik.uni-erlangen.de] 
Sent: Thursday, December 30, 2004 11:49 AM
To: Sunder, Shyam (MSTG - NY)
Cc: aspectc-user at aspectc.org
Subject: Re: [aspectc-user] Using puma to print out class member names

Hi,

Sunder, Shyam (MSTG - NY) wrote:
> Olaf,
> 
> Thanks for all the help. Now that I have a way to parse a class, I
need
> print out all its base classes. Here is my loop:
> 
>     int numClasses = classdb.ClassInfos();
>     for ( int i =0; i < numClasses; i++ )
>     {
>         CClassInfo* classInfo = classdb.ClassInfo(i);
>         std::cout << "Class Name: " << classInfo->Name();
> 
>         int numBaseClasses = classInfo->BaseClasses();
>         for ( int j = 0; j < numBaseClasses; j++ )
>         {
>             CBaseClassInfo* baseClassInfo = classInfo->BaseClass(j);
>             std::cout << "[" << baseClassInfo->Name() << "] ";
>         }
>         std::cout << std::endl;
>     }
> 
> However, baseClassInfo->Name() returns a null. How do I get to the
name
> of the base classes? What if they are template parameters?
> 
> -Shyam 

(1) you have to use baseClassInfo->Class ()->Name ()
(2) looking at the output of ccparsers it seems to me that base classes,
     which are template parameters of a class template are not listed as
     base classes. We have to look into this ...

BTW, you could copy & paste from CClassDatabase::Dump* (see 
Puma/src/infos/CClassDatabase.cc).

Olaf
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------




More information about the aspectc-user mailing list