#include "TBranchProxyDescriptor.h"
#include "TClonesArray.h"
#include "TError.h"
#include "TROOT.h"
#include "TTreeFormula.h"
#include "TFormLeafInfo.h"
#include <ctype.h>
ClassImp(ROOT::TBranchProxyDescriptor);
namespace ROOT {
   TBranchProxyDescriptor::TBranchProxyDescriptor(const char *dataname, 
                                                  const char *type, 
                                                  const char *branchname, 
                                                  Bool_t split,
                                                  Bool_t skipped) :
      TNamed(dataname,type),fBranchName(branchname),fIsSplit(split),fBranchIsSkipped(skipped) 
   {
      
      fDataName = GetName();
      if (fDataName.Length() && fDataName[fDataName.Length()-1]=='.') fDataName.Remove(fDataName.Length()-1);
      fDataName.ReplaceAll(".","_");
      fDataName.ReplaceAll("<","_");
      fDataName.ReplaceAll(">","_");
      if (!isalpha(fDataName[0])) fDataName.Insert(0,"_");
      fDataName.ReplaceAll(" ","");
      fDataName.ReplaceAll("*","st");
      fDataName.ReplaceAll("&","rf");
   }
   
   const char *TBranchProxyDescriptor::GetDataName() 
   { 
      
      return fDataName; 
   }
   const char *TBranchProxyDescriptor::GetTypeName() 
   { 
      
      return GetTitle(); 
   }
   
   const char *TBranchProxyDescriptor::GetBranchName() 
   { 
      
      return fBranchName.Data(); 
   }
   Bool_t TBranchProxyDescriptor::IsEquivalent(const TBranchProxyDescriptor *other,
                                               Bool_t inClass) 
   {
      
      if ( !other ) return false;
      if ( other == this ) return true;
      if ( inClass ) {
         
         
      } else {
         if ( fBranchName != other->fBranchName ) return false;
      }
      if ( fIsSplit != other->fIsSplit ) return false;
      if ( fBranchIsSkipped != other->fBranchIsSkipped) return false;
      if ( strcmp(GetName(),other->GetName()) ) return false;
      if ( strcmp(GetTitle(),other->GetTitle()) ) return false;
      return true;
   }
   Bool_t TBranchProxyDescriptor::IsSplit() const 
   { 
      
      return fIsSplit; 
   }
   void TBranchProxyDescriptor::OutputDecl(FILE *hf, int offset, UInt_t maxVarname)
   {
      
      fprintf(hf,"%-*s%-*s %s;\n",  offset," ",  maxVarname, GetTypeName(), GetDataName()); 
   }
   void TBranchProxyDescriptor::OutputInit(FILE *hf, int offset, 
                                           UInt_t maxVarname,
                                           const char *prefix) 
   {
      
      if (fIsSplit) {
         const char *subbranchname = GetBranchName();
         const char *above = "";
         if (strncmp(prefix,subbranchname,strlen(prefix))==0
             && strcmp(prefix,subbranchname)!=0)  {
            subbranchname += strlen(prefix)+1; 
            above = "ffPrefix, ";
         }
         if (fBranchIsSkipped) {
           fprintf(hf,"\n%-*s      %-*s(director, obj.GetProxy(), \"%s\", %s\"%s\")",
                   offset," ", maxVarname, GetDataName(), GetDataName(), above, subbranchname);
         } else {
            fprintf(hf,"\n%-*s      %-*s(director, %s\"%s\")",
                    offset," ", maxVarname, GetDataName(), above, subbranchname);
         }
      } else {
         fprintf(hf,"\n%-*s      %-*s(director, obj.GetProxy(), \"%s\")",
                 offset," ", maxVarname, GetDataName(), GetBranchName() );
         
         
      }
   }
}
Last update: Thu Jan 17 08:43:02 2008
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.