当前位置: 首页>>代码示例>>C++>>正文


C++ TBranch::GetSplitLevel方法代码示例

本文整理汇总了C++中TBranch::GetSplitLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ TBranch::GetSplitLevel方法的具体用法?C++ TBranch::GetSplitLevel怎么用?C++ TBranch::GetSplitLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TBranch的用法示例。


在下文中一共展示了TBranch::GetSplitLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: verifyBranch

template <class HolderClass> bool verifyBranch(const char *testname, TTree *chain, const char *bname, int type = 0) {
   static HolderClass *gHolder = new HolderClass;
   HolderClass **add = 0;
   HolderClass *holder = 0;

   TBranch *branch = chain->GetBranch(bname);
   if (branch==0) {
      TestError("treeReading",Form("Missing branch: %s",bname));
      return false;
   }
   
   if (branch->InheritsFrom("TBranchObject")) {
      TLeafObject *tbo = dynamic_cast<TLeafObject*>(branch->GetListOfLeaves()->At(0));
      holder = (HolderClass*)(tbo->GetObject());

      if (holder==0) {
         TestError("treeReading",Form("BranchObject %s with holder == 0!",bname));
         return false;         
      }
   } else {
      add = (HolderClass**)branch->GetAddress();
      if (add==0) {
         TestError("treeReading",Form("Branch %s with add == 0!",bname));
         return false;
      }
      void **p;
      switch (type) {
         case 0: holder = *add; break;
         case 1: p = (void**) &(gHolder->fScalarPtr); *p = ((TBranchElement*)branch)->GetObject(); break;
         case 2: p = (void**) &(gHolder->fObjectPtr); *p = ((TBranchElement*)branch)->GetObject(); break;
         case 3: p = (void**) &(gHolder->fNestedPtr); *p = ((TBranchElement*)branch)->GetObject(); break;
      }
   }
   
   int splitlevel = branch->GetSplitLevel();

   switch (type) {
      case 0: return holder->Verify(chain->GetTree()->GetReadEntry(),Form("%s %s",testname,bname),splitlevel);
      case 1: return gHolder->VerifyScalarPtr(chain->GetTree()->GetReadEntry(),Form("%s %s",testname,bname),splitlevel);
      case 2: return gHolder->VerifyObjectPtr(chain->GetTree()->GetReadEntry(),Form("%s %s",testname,bname),splitlevel);
      case 3: return gHolder->VerifyNestedPtr(chain->GetTree()->GetReadEntry(),Form("%s %s",testname,bname),splitlevel);
      default: 
         TestError("treeReading",Form("Unknown type %d in verifyBranch",type));
         return false;
   }
}
开发者ID:asmagina1995,项目名称:roottest,代码行数:46,代码来源:test.C


注:本文中的TBranch::GetSplitLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。