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


C++ TClass::GetMissingDictionaries方法代码示例

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


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

示例1: runGetMissingDictionaries

int runGetMissingDictionaries()
{
   // Method to assert the dictionaries.

   TClass* myClass = TClass::GetClass("TestClass");
   if (myClass->HasDictionary())
      Error("TClass::HasDictionary", "The class %s does not have a dictionary.", "TestClass");

   THashTable expectedResult;
   // Hard coded expected results.
   expectedResult.Add(TClass::GetClass("NoDictClass"));
   expectedResult.Add(TClass::GetClass("TestClass"));
   expectedResult.Add(TClass::GetClass("MemberHidden"));
   expectedResult.Add(TClass::GetClass("Tmplt<Tmplt<NoDictClass*> >"));
   expectedResult.Add(TClass::GetClass("Tmplt<int>"));
   expectedResult.Add(TClass::GetClass("Member"));
   expectedResult.Add(TClass::GetClass("Tmplt<Member>"));
   expectedResult.Add(TClass::GetClass("Tmplt<Base>"));
   expectedResult.Add(TClass::GetClass("Outer<Double32_t>"));
   expectedResult.Add(TClass::GetClass("Tmplt<TmpParam>"));
   expectedResult.Add(TClass::GetClass("Tmplt<Tmplt<TmpTmpParam> >"));
   expectedResult.Add(TClass::GetClass("Tmplt<Tmplt<Tmplt<ExtraTmp> > >"));
   expectedResult.Add(TClass::GetClass("ParamList<ParamL1,ParamL2>"));
   expectedResult.Add(TClass::GetClass("TypedefExample"));
   expectedResult.Add(TClass::GetClass("BasicTests::TestAll"));

   cerr<<"No recursion:"<<endl; // Write on the same stream of the errors below
   THashTable missingDictClassesNoRecursion;
   // Assert GetMissingDictionaries without recursion.
   myClass->GetMissingDictionaries(missingDictClassesNoRecursion, false);
   //missingDictClassesNoRecursion.Print();
   if (!missingDictClassesNoRecursion.IsEmpty()) {
      if (missingDictClassesNoRecursion.GetEntries() != expectedResult.GetEntries()) {
         Error("TClass::GetMissingClassDictionaries", "The set of classes with missing dictionaries does not contain the correct number of elements (expected: %d got %d).",expectedResult.GetEntries(),missingDictClassesNoRecursion.GetEntries());
      }
      TIterator* it = missingDictClassesNoRecursion.MakeIterator();
      TClass* cl = 0;
      while ((cl = (TClass*)it->Next())) {
         if (!expectedResult.FindObject(cl)) {
            Error("TCling::GetMissingDictionaries", "Class %s is not in the expected set.", cl->GetName());
         }
      }
      it = expectedResult.MakeIterator();
      while ((cl = (TClass*)it->Next())) {
         if (!missingDictClassesNoRecursion.FindObject(cl)) {
            Error("TCling::GetMissingDictionaries", "Class %s with no dictionaries is not in the set.", cl->GetName());
         }
      }
   } else {
      Error("TClass::GetMissingClassDictionaries", "The set of missing classes is not created");
   }


   // Assert GetMissingDictionaries with recursion.
   // Hard code expected results with recursion.
   expectedResult.Add(TClass::GetClass("ArrayTry"));
   expectedResult.Add(TClass::GetClass("NoA"));
   expectedResult.Add(TClass::GetClass("vector<Tmplt<NoDictClass*> >"));
   expectedResult.Add(TClass::GetClass("Tmplt<NoDictClass*>"));
   expectedResult.Add(TClass::GetClass("vector<Member>"));
   expectedResult.Add(TClass::GetClass("Base"));
   expectedResult.Add(TClass::GetClass("vector<Base>"));
   expectedResult.Add(TClass::GetClass("Inner<Double32_t>"));
   expectedResult.Add(TClass::GetClass("TmpParam"));
   expectedResult.Add(TClass::GetClass("TmpTmpParam"));
   expectedResult.Add(TClass::GetClass("Tmplt<TmpTmpParam>"));
   expectedResult.Add(TClass::GetClass("ExtraTmp"));
   expectedResult.Add(TClass::GetClass("Tmplt<ExtraTmp>"));
   expectedResult.Add(TClass::GetClass("Tmplt<Tmplt<ExtraTmp> >"));
   expectedResult.Add(TClass::GetClass("vector<Tmplt<Tmplt<ExtraTmp> > >"));
   expectedResult.Add(TClass::GetClass("vector<NoDictClass*> "));
   expectedResult.Add(TClass::GetClass("vector<TmpTmpParam>"));
   expectedResult.Add(TClass::GetClass("vector<Tmplt<ExtraTmp> >"));
   expectedResult.Add(TClass::GetClass("vector<ExtraTmp> "));
   expectedResult.Add(TClass::GetClass("vector<Tmplt<TmpTmpParam> >"));
   expectedResult.Add(TClass::GetClass("vector<TmpParam>"));
   expectedResult.Add(TClass::GetClass("vector<Double32_t>"));
   expectedResult.Add(TClass::GetClass("ParamL1"));
   expectedResult.Add(TClass::GetClass("ParamL2"));
   expectedResult.Add(TClass::GetClass("vector<ParamL2*>"));
   expectedResult.Add(TClass::GetClass("BasicTests::NoDictTypdefs"));
   expectedResult.Add(TClass::GetClass("BasicTests::NoDict"));
   expectedResult.Add(TClass::GetClass("BasicTests::HasVecDoubleTD32"));
   expectedResult.Add(TClass::GetClass("BasicTests::HasVecDouble32"));
   expectedResult.Add(TClass::GetClass("map<unsigned short,Double32_t>"));

   cerr<<"With recursion:"<<endl; // Write on the same stream of the errors below
   THashTable missingDictClassesRecursion;
   myClass->GetMissingDictionaries(missingDictClassesRecursion, true);
   //missingDictClassesRecursion.Print();
   if (!missingDictClassesRecursion.IsEmpty()) {
      if (missingDictClassesRecursion.GetEntries() != expectedResult.GetEntries()) {
         Error("TClass::GetMissingClassDictionaries", "The set of classes with missing dictionaries does not contain the correct number of elements (expected: %d got %d).",expectedResult.GetEntries(),missingDictClassesRecursion.GetEntries());
//         expectedResult.ls();
//         missingDictClassesRecursion.ls();
      }
      TIterator* it = missingDictClassesRecursion.MakeIterator();
      TClass* cl = 0;
      while ((cl = (TClass*)it->Next())) {
         if (!expectedResult.FindObject(cl)) {
//.........这里部分代码省略.........
开发者ID:bbannier,项目名称:roottest,代码行数:101,代码来源:runGetMissingDictionaries.C


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