예제 #1
0
void KVClassFactory::AddAllBaseConstructors()
{
    // Add constructors with the same signature as all base class constructors
    // (apart from the default ctor or any copy constructors, which are a special case)
    // By default, all constructors are 'public'.

    if(!fBaseClass) return;

    KVHashList clist;
    clist.AddAll(fBaseClass->GetListOfMethods());
    KVSeqCollection* constructors = clist.GetSubListWithName(fBaseClassName);
    TIter next_ctor(constructors);
    TMethod* method;
    while( (method = (TMethod*)next_ctor()) )
    {
        if(!method->GetNargs()) continue; // ignore default ctor
        TList* args = method->GetListOfMethodArgs();
        TMethodArg* arg = (TMethodArg*)args->First();
        TString typenam=arg->GetFullTypeName();
        if(typenam.Contains(fBaseClassName)) continue; // ignore copy ctor
        KVClassMethod* ctor;
        if(arg->GetDefault()) ctor = AddConstructor( typenam, arg->GetName(), arg->GetDefault() );
        else ctor = AddConstructor(typenam, arg->GetName());
        for(int i=1; i<method->GetNargs(); i++){
            arg = (TMethodArg*)args->At(i);
            if(arg->GetDefault()) ctor->AddArgument( arg->GetFullTypeName(), arg->GetName(), arg->GetDefault() );
            else ctor->AddArgument(arg->GetFullTypeName(), arg->GetName());
        }
    }

    delete constructors;
}
예제 #2
0
void runCintexReflexOrder() {
   gSystem->Setenv("LINES","-1");
   gSystem->Load("libCintex");
   gSystem->Load("libReflexDict");
   ROOT::Cintex::Cintex::Enable();
   TClass* cl = TClass::GetClass("Reflex::Scope");
   TMethod* m = (TMethod*) cl->GetListOfMethods()->FindObject("AddMemberTemplate");
   TMethodArg* arg = (TMethodArg*) m->GetListOfMethodArgs()->First();
   cout << "AddMemberTemplate() arg0: " << arg->GetFullTypeName() << endl;
}