// Author: Rene Brun   05/02/97
// Modified for use in VEGA by D. Buskulic 21/03/03

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// This class is a special version of VSelector for user interpreted    //
// classes.                                                             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TROOT.h"
#include "VVirtualFrameChannel.h"
#include "THashList.h"
#include "VSelectorCint.h"
#include "Api.h"
#include "TError.h"

ClassImp(VSelectorCint)

//______________________________________________________________________________
VSelectorCint::VSelectorCint() : VSelector()
{
   // Default constructor for a Selector.

   mFuncInit    = 0;
   mFuncBegin   = 0;
   mFuncTerm    = 0;
   mFuncCut     = 0;
   mFuncFrame   = 0;
   mFuncVect    = 0;
   mFuncOption  = 0;
   mFuncObj     = 0;
//   mFuncInp     = 0;
//   mFuncOut     = 0;
   mIntSelector = 0;

}

//______________________________________________________________________________
VSelectorCint::~VSelectorCint()
{
   // destructor for a Selector.

   delete mFuncInit;
   delete mFuncBegin;
   delete mFuncTerm;
   delete mFuncCut;
   delete mFuncFrame;
   delete mFuncVect;
   delete mFuncOption;
   delete mFuncObj;
//   delete mFuncInp;
//   delete mFuncOut;
   delete mIntSelector;
}


//______________________________________________________________________________
 void VSelectorCint::SetFuncProto(G__CallFunc *cf, G__ClassInfo* cl, const char* fname, const char* argtype)
{
   Long_t offset = 0;

   cf->SetFuncProto(cl,fname,argtype,&offset);

   if ( gDebug > 2 )
      Info("SetFuncProto","Set %s(%s)  offset = %ld",fname,argtype,offset);

   if ( !cf->IsValid() )
      Error("SetFuncProto","Cannot Set %s(%s)",fname,argtype);
}


//______________________________________________________________________________
 void VSelectorCint::Build(VSelector *iselector, G__ClassInfo *cl)
{
   // Initialize the CallFunc objects when selector is interpreted
   Assert(cl);

   // The G__MethodInfo created by SetFuncProto will remember the address 
   // of cl, so we need to keep it around.
   mClass       = new G__ClassInfo(*cl);
   printf("%sn",mClass->Name());

   mIntSelector = iselector;
   mFuncInit    = new G__CallFunc();
   mFuncBegin   = new G__CallFunc();
   mFuncTerm    = new G__CallFunc();
   mFuncCut     = new G__CallFunc();
   mFuncFrame   = new G__CallFunc();
   mFuncVect    = new G__CallFunc();
   mFuncOption  = new G__CallFunc();
   mFuncObj     = new G__CallFunc();
//   mFuncInp     = new G__CallFunc();
//   mFuncOut     = new G__CallFunc();

   SetFuncProto(mFuncInit,mClass,"Init","VVirtualFrameChannel*");
   SetFuncProto(mFuncBegin,mClass,"Begin","VVirtualFrameChannel*");
   SetFuncProto(mFuncTerm,mClass,"Terminate","");
   SetFuncProto(mFuncCut,mClass,"ProcessCut","FrameH*");
   SetFuncProto(mFuncFrame,mClass,"ProcessFrame","FrameH*");
   SetFuncProto(mFuncVect,mClass,"ProcessVect","int,FrVect**,FrVect*");
   SetFuncProto(mFuncOption,mClass,"SetOption","const char*");
   SetFuncProto(mFuncObj,mClass,"SetObject","TObject*");
//   SetFuncProto(mFuncInp,mClass,"SetInputList","TList*");
//   SetFuncProto(mFuncOut,mClass,"GetOutputList","");
}


//______________________________________________________________________________
 void VSelectorCint::Init(VVirtualFrameChannel *fc)
{
   // Invoke the Init function via the interpreter

   if ( gDebug > 2 )
      Info("Init","Call Init frame channel = %p", fc);

   mFuncInit->ResetArg();
   mFuncInit->SetArg((Long_t)fc);
   mFuncInit->Exec(mIntSelector);
}


//______________________________________________________________________________
 void VSelectorCint::Begin(VVirtualFrameChannel *fc)
{
   // Invoke the Begin function via the interpreter
   if ( gDebug > 2 )
      Info("Begin","Call Begin frame channel = %p", fc);
   mFuncBegin->ResetArg();
   mFuncBegin->SetArg((Long_t)fc);
   mFuncBegin->Exec(mIntSelector);
}


//______________________________________________________________________________
 Bool_t VSelectorCint::ProcessCut(FrameH* frame)
{
   // Invoke the ProcessCut function via the interpreter
   if ( gDebug > 3 )
      Info("ProcessCut","Call ProcessCut frame = %p", frame);
   mFuncCut->ResetArg();
   mFuncCut->SetArg((Long_t)frame);
   Int_t sel = mFuncCut->ExecInt(mIntSelector);
   return (Bool_t)sel;
}


//______________________________________________________________________________
 Bool_t VSelectorCint::ProcessFrame(FrameH* frame)
{
   // Invoke the ProcessFrame function via the interpreter
   if ( gDebug > 3 )
      Info("ProcessFrame","Call ProcessFrame frame = %p", frame);
   mFuncFrame->ResetArg();
   mFuncFrame->SetArg((Long_t)frame);
   Int_t sel = mFuncFrame->ExecInt(mIntSelector);
   return (Bool_t)sel;
}


//______________________________________________________________________________
 Bool_t VSelectorCint::ProcessVect(int nbvect, FrVect** invect, FrVect* outvect)
{
   // Invoke the ProcessVect function via the interpreter
   if ( gDebug > 3 )
      Info("Process","Call ProcessVect vector = %p", invect[0]);
   mFuncVect->ResetArg();
   mFuncVect->SetArg((Long_t)nbvect);
   mFuncVect->SetArg((Long_t)invect);
   mFuncVect->SetArg((Long_t)outvect);
   Int_t sel = mFuncVect->ExecInt(mIntSelector);
   return (Bool_t)sel;
}


//______________________________________________________________________________
 void VSelectorCint::SetOption(const char *option)
{
   // Set the selector option
   if ( gDebug > 2 )
      Info("SetOption","Option = %s", option);
   mFuncOption->ResetArg();
   mFuncOption->SetArg((Long_t)option);
   mFuncOption->Exec(mIntSelector);
}


//______________________________________________________________________________
 void VSelectorCint::SetObject(TObject *obj)
{
   // Set the current object
   if ( gDebug > 3 )
      Info("SetObject","Object = %p", obj);
   mFuncObj->ResetArg();
   mFuncObj->SetArg((Long_t)obj);
   mFuncObj->Exec(mIntSelector);
}


// //______________________________________________________________________________
// void VSelectorCint::SetInputList(TList *input)
// {
//    // Set the selector list of input objects
//    if ( gDebug > 2 )
//       Info("SetInputList","Object = %p", input);
//    fFuncInp->ResetArg();
//    fFuncInp->SetArg((Long_t)input);
//    fFuncInp->Exec(fIntSelector);
// }
// 
// 
// //______________________________________________________________________________
// TList *VSelectorCint::GetOutputList() const
// {
//    // Return the list of output object
// 
//    TList *out = (TList *) fFuncOut->ExecInt(fIntSelector);
// 
//    if ( gDebug > 2 )
//       Info("GetOutputList","List = %p", out);
// 
//    return out;
// }
// 

//______________________________________________________________________________
 void VSelectorCint::Terminate()
{
   // Invoke the Terminate function via the interpreter
   if ( gDebug > 2 )
      Info("Terminate","Call Terminate");
   mFuncTerm->Exec(mIntSelector);
}


- ROOT page - VEGA page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to , or contact with any questions or problems regarding ROOT or VEGA.