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

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

#include "TROOT.h"
#include "THashList.h"
#include "VViewerSelectorCint.h"
#include "Api.h"
#include "TError.h"

ClassImp(VViewerSelectorCint)

//______________________________________________________________________________
VViewerSelectorCint::VViewerSelectorCint() : VViewerSelector()
{
   // Default constructor for a Selector.

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

}

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

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


//______________________________________________________________________________
 void VViewerSelectorCint::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 VViewerSelectorCint::Build(VViewerSelector *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);

   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();

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


//______________________________________________________________________________
 void VViewerSelectorCint::Init()
{
   // Invoke the Init function via the interpreter

   if ( gDebug > 2 )
      Info("Init","Call Init");

   mFuncInit->Exec(mIntSelector);
}


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


//______________________________________________________________________________
 Bool_t VViewerSelectorCint::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 VViewerSelectorCint::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 VViewerSelectorCint::ProcessVect(int nbvect, FrVect** invect, FrVect* outvect, double* par)
{
   // 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);
   mFuncVect->SetArg((Long_t)par);
   Int_t sel = mFuncVect->ExecInt(mIntSelector);
   return (Bool_t)sel;
}


//______________________________________________________________________________
 void VViewerSelectorCint::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 VViewerSelectorCint::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 VViewerSelectorCint::Terminate()
{
   // Invoke the Terminate function via the interpreter
   if ( gDebug > 2 )
      Info("Terminate","Call Terminate");
   mFuncTerm->Exec(mIntSelector);
}

//______________________________________________________________________________
 const char* VViewerSelectorCint::GetViewerClassName()
{
// Get the class name
   return mClass->Name();
}


- 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.