(file) Return to MetaRepository.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Repository / Attic

Diff for /pegasus/src/Pegasus/Repository/Attic/MetaRepository.cpp between version 1.1.2.2 and 1.1.2.3

version 1.1.2.2, 2007/10/02 14:28:38 version 1.1.2.3, 2007/10/02 15:40:30
Line 142 
Line 142 
 { {
     for (size_t i = 0; ns->classes[i]; i++)     for (size_t i = 0; ns->classes[i]; i++)
     {     {
         const MetaClass* sc = ns->classes[i];          const MetaClass* mc = ns->classes[i];
  
         if (_eqi(sc->name, name))          if (_eqi(mc->name, name))
             return sc;              return mc;
     }     }
  
     // Not found!     // Not found!
Line 605 
Line 605 
  
 struct FeatureInfo struct FeatureInfo
 { {
     const MetaFeature* sf;      const MetaFeature* mf;
     const MetaClass* sc;      const MetaClass* mc;
 }; };
  
 static int _mergeFeatures( static int _mergeFeatures(
     const MetaClass* sc,      const MetaClass* mc,
       bool localOnly,
     FeatureInfo features[_MAX_FEATURES],     FeatureInfo features[_MAX_FEATURES],
     size_t& numFeatures)     size_t& numFeatures)
 { {
     if (sc->super)      if (!localOnly && mc->super)
     {     {
         if (_mergeFeatures(sc->super, features, numFeatures) != 0)          if (_mergeFeatures(mc->super, localOnly, features, numFeatures) != 0)
         {         {
             printf("T[%u]\n", __LINE__);             printf("T[%u]\n", __LINE__);
             return -1;             return -1;
Line 625 
Line 626 
  
     // Process all features of this class:     // Process all features of this class:
  
     for (size_t i = 0; sc->features[i]; i++)      for (size_t i = 0; mc->features[i]; i++)
     {     {
         const MetaFeature* sf = sc->features[i];          const MetaFeature* mf = mc->features[i];
  
         // Override feature if defined by ancestor class:         // Override feature if defined by ancestor class:
  
Line 635 
Line 636 
  
         for (size_t j = 0; j < numFeatures; j++)         for (size_t j = 0; j < numFeatures; j++)
         {         {
             const MetaFeature* tmp = features[j].sf;              const MetaFeature* tmp = features[j].mf;
  
             if (_eqi(sf->name, tmp->name))              if (_eqi(mf->name, tmp->name))
             {             {
                 features[j].sf = sf;                  features[j].mf = mf;
                 features[j].sc = sc;                  features[j].mc = mc;
                 found = true;                 found = true;
                 break;                 break;
             }             }
Line 656 
Line 657 
                 return -1;                 return -1;
             }             }
  
             features[numFeatures].sf = sf;              features[numFeatures].mf = mf;
             features[numFeatures].sc = sc;              features[numFeatures].mc = mc;
             numFeatures++;             numFeatures++;
         }         }
     }     }
Line 668 
Line 669 
 struct QualifierInfo struct QualifierInfo
 { {
     const char* qualifier;     const char* qualifier;
     const MetaClass* sc;      const MetaClass* mc;
 }; };
  
 static const MetaFeature* _findFeature( static const MetaFeature* _findFeature(
     const MetaClass* sc,      const MetaClass* mc,
     const char* name)     const char* name)
 { {
     for (size_t i = 0; sc->features[i]; i++)      for (size_t i = 0; mc->features[i]; i++)
     {     {
         const MetaFeature* sf = sc->features[i];          const MetaFeature* mf = mc->features[i];
  
         if (_eqi(sf->name, name))          if (_eqi(mf->name, name))
             return sf;              return mf;
     }     }
  
     // Not found!     // Not found!
Line 688 
Line 689 
 } }
  
 static const MetaFeature* _findParameter( static const MetaFeature* _findParameter(
     const MetaMethod* sm,      const MetaMethod* mm,
     const char* name)     const char* name)
 { {
     for (size_t i = 0; sm->parameters[i]; i++)      for (size_t i = 0; mm->parameters[i]; i++)
     {     {
         const MetaFeature* sf = sm->parameters[i];          const MetaFeature* mf = mm->parameters[i];
  
         if (_eqi(sm->name, name))          if (_eqi(mm->name, name))
             return sf;              return mf;
     }     }
  
     // Not found!     // Not found!
Line 705 
Line 706 
  
 static int _mergeQualifiers( static int _mergeQualifiers(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     const MetaClass* sc,      const MetaClass* mc,
     const char* featureName,     const char* featureName,
     const char* parameterName,     const char* parameterName,
     bool depth,     bool depth,
Line 714 
Line 715 
 { {
     // Merge super-class qualifiers:     // Merge super-class qualifiers:
  
     if (sc->super)      if (mc->super)
     {     {
         _mergeQualifiers(ns, sc->super, featureName, parameterName, depth + 1,          _mergeQualifiers(ns, mc->super, featureName, parameterName, depth + 1,
             qualifiers, numQualifiers);             qualifiers, numQualifiers);
     }     }
  
Line 727 
Line 728 
     if (!featureName && !parameterName)     if (!featureName && !parameterName)
     {     {
         // Case 1: get class qualifiers:         // Case 1: get class qualifiers:
         quals = sc->qualifiers;          quals = mc->qualifiers;
     }     }
     else if (featureName && !parameterName)     else if (featureName && !parameterName)
     {     {
         // Case 2: get feature qualifiers:         // Case 2: get feature qualifiers:
  
         const MetaFeature* sf = _findFeature(sc, featureName);          const MetaFeature* mf = _findFeature(mc, featureName);
  
         if (sf)          if (mf)
             quals = sf->qualifiers;              quals = mf->qualifiers;
     }     }
     else if (featureName && parameterName)     else if (featureName && parameterName)
     {     {
         // Case 3: get parameter qualifiers:         // Case 3: get parameter qualifiers:
  
         const MetaFeature* sf = _findFeature(sc, featureName);          const MetaFeature* mf = _findFeature(mc, featureName);
  
         if (sf && (sf->flags & META_FLAG_METHOD))          if (mf && (mf->flags & META_FLAG_METHOD))
         {         {
             const MetaMethod* sm = (const MetaMethod*)sf;              const MetaMethod* mm = (const MetaMethod*)mf;
             const MetaFeature* p = _findParameter(sm, parameterName);              const MetaFeature* p = _findParameter(mm, parameterName);
  
             if (p)             if (p)
                 quals = p->qualifiers;                 quals = p->qualifiers;
Line 774 
Line 775 
             if (qi[0] == qj[0])             if (qi[0] == qj[0])
             {             {
                 qualifiers[j].qualifier = qi;                 qualifiers[j].qualifier = qi;
                 qualifiers[j].sc = sc;                  qualifiers[j].mc = mc;
                 found = true;                 found = true;
                 break;                 break;
             }             }
Line 795 
Line 796 
                 }                 }
  
                 qualifiers[numQualifiers].qualifier = qi;                 qualifiers[numQualifiers].qualifier = qi;
                 qualifiers[numQualifiers].sc = sc;                  qualifiers[numQualifiers].mc = mc;
                 numQualifiers++;                 numQualifiers++;
             }             }
         }         }
Line 807 
Line 808 
 template<class C> template<class C>
 static int _addQualifiers( static int _addQualifiers(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     const MetaClass* sc,      const MetaClass* mc,
     const char* featureName,     const char* featureName,
     const char* parameterName,     const char* parameterName,
     C& c)     C& c)
Line 816 
Line 817 
     size_t numQualifiers = 0;     size_t numQualifiers = 0;
  
     if (_mergeQualifiers(     if (_mergeQualifiers(
         ns, sc, featureName, parameterName, 0, qualifiers, numQualifiers) != 0)          ns, mc, featureName, parameterName, 0, qualifiers, numQualifiers) != 0)
     {     {
         printf("T[%u]\n", __LINE__);         printf("T[%u]\n", __LINE__);
         return -1;         return -1;
Line 856 
Line 857 
  
 static int _addProperty( static int _addProperty(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     const MetaClass* sc,      const MetaClass* mc,
     const MetaProperty* sp,      const MetaProperty* mp,
     const char* classOrigin,     const char* classOrigin,
     bool propagated,     bool propagated,
       bool includeQualifiers,
       bool includeClassOrigin,
     CIMClass& cc)     CIMClass& cc)
 { {
     // Make CIMvalue:     // Make CIMvalue:
  
     CIMValue cv;     CIMValue cv;
  
     if (_makeValue(cv, sp->type, sp->subscript, sp->value) != 0)      if (_makeValue(cv, mp->type, mp->subscript, mp->value) != 0)
     {     {
         printf("T[%u]\n", __LINE__);         printf("T[%u]\n", __LINE__);
         return -1;         return -1;
Line 874 
Line 877 
  
     // Create property:     // Create property:
  
     CIMProperty cp(sp->name, cv);      CIMProperty cp(mp->name, cv);
   
       if (includeClassOrigin)
     cp.setClassOrigin(classOrigin);     cp.setClassOrigin(classOrigin);
   
     cp.setPropagated(propagated);     cp.setPropagated(propagated);
  
     // Add qualifiers:     // Add qualifiers:
  
     if (_addQualifiers(ns, sc, sp->name, 0, cp) != 0)      if (includeQualifiers)
       {
           if (_addQualifiers(ns, mc, mp->name, 0, cp) != 0)
     {     {
         printf("T[%u]\n", __LINE__);         printf("T[%u]\n", __LINE__);
         return -1;         return -1;
     }     }
       }
  
     // Add to class:     // Add to class:
  
Line 894 
Line 903 
  
 static int _addReference( static int _addReference(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     const MetaClass* sc,      const MetaClass* mc,
     const MetaReference* sr,      const MetaReference* mr,
     const char* classOrigin,     const char* classOrigin,
     bool propagated,     bool propagated,
       bool includeQualifiers,
       bool includeClassOrigin,
     CIMClass& cc)     CIMClass& cc)
 { {
     // Set isArray and arraySize:     // Set isArray and arraySize:
Line 905 
Line 916 
     Boolean isArray;     Boolean isArray;
     Uint32 arraySize;     Uint32 arraySize;
  
     if (sr->subscript == -1)      if (mr->subscript == -1)
     {     {
         isArray = false;         isArray = false;
         arraySize = 0;         arraySize = 0;
Line 913 
Line 924 
     else     else
     {     {
         isArray = true;         isArray = true;
         arraySize = sr->subscript;          arraySize = mr->subscript;
     }     }
  
     // Set referenceClassName:     // Set referenceClassName:
  
     CIMName rcn = sr->ref->name;      CIMName rcn = mr->ref->name;
  
     // Create value:     // Create value:
  
Line 926 
Line 937 
  
     // Create property:     // Create property:
  
     CIMProperty cp(sr->name, cv, arraySize, rcn, classOrigin, propagated);      CIMProperty cp(mr->name, cv, arraySize, rcn);
   
       if (includeClassOrigin)
           cp.setClassOrigin(classOrigin);
   
       cp.setPropagated(propagated);
  
     // Add qualifiers:     // Add qualifiers:
  
     if (_addQualifiers(ns, sc, sr->name, 0, cp) != 0)      if (includeQualifiers)
       {
           if (_addQualifiers(ns, mc, mr->name, 0, cp) != 0)
     {     {
         printf("T[%u]\n", __LINE__);         printf("T[%u]\n", __LINE__);
         return -1;         return -1;
     }     }
       }
  
     // Add to class:     // Add to class:
  
Line 944 
Line 963 
  
 static int _addPropertyParameter( static int _addPropertyParameter(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     const MetaClass* sc,      const MetaClass* mc,
     const MetaMethod* sm,      const MetaMethod* mm,
     const MetaProperty* sp,      const MetaProperty* mp,
       bool includeQualifiers,
     CIMMethod& cm)     CIMMethod& cm)
 { {
     // Create property:     // Create property:
Line 954 
Line 974 
     bool isArray;     bool isArray;
     Uint32 arraySize;     Uint32 arraySize;
  
     if (sp->subscript == -1)      if (mp->subscript == -1)
     {     {
         isArray = false;         isArray = false;
         arraySize = 0;         arraySize = 0;
Line 962 
Line 982 
     else     else
     {     {
         isArray = true;         isArray = true;
         arraySize = Uint32(sp->subscript);          arraySize = Uint32(mp->subscript);
     }     }
  
     CIMParameter cp(sp->name, CIMType(sp->type), isArray, arraySize);      CIMParameter cp(mp->name, CIMType(mp->type), isArray, arraySize);
  
     // Add qualifiers:     // Add qualifiers:
  
     if (_addQualifiers(ns, sc, sm->name, sp->name, cm) != 0)      if (includeQualifiers)
       {
           if (_addQualifiers(ns, mc, mm->name, mp->name, cm) != 0)
     {     {
         printf("T[%u]\n", __LINE__);         printf("T[%u]\n", __LINE__);
         return -1;         return -1;
     }     }
       }
  
     // Add to method:     // Add to method:
  
Line 983 
Line 1006 
  
 static int _addReferenceParameter( static int _addReferenceParameter(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     const MetaClass* sc,      const MetaClass* mc,
     const MetaMethod* sm,      const MetaMethod* mm,
     const MetaReference* sr,      const MetaReference* mr,
       bool includeQualifiers,
     CIMMethod& cm)     CIMMethod& cm)
 { {
     // Create property:     // Create property:
Line 993 
Line 1017 
     bool isArray;     bool isArray;
     Uint32 arraySize;     Uint32 arraySize;
  
     if (sr->subscript == -1)      if (mr->subscript == -1)
     {     {
         isArray = false;         isArray = false;
         arraySize = 0;         arraySize = 0;
Line 1001 
Line 1025 
     else     else
     {     {
         isArray = true;         isArray = true;
         arraySize = Uint32(sr->subscript);          arraySize = Uint32(mr->subscript);
     }     }
  
     CIMName rcn = sr->ref->name;      CIMName rcn = mr->ref->name;
     CIMParameter cp(sr->name, CIMTYPE_REFERENCE, isArray, arraySize, rcn);      CIMParameter cp(mr->name, CIMTYPE_REFERENCE, isArray, arraySize, rcn);
  
     // Add qualifiers:     // Add qualifiers:
  
     if (_addQualifiers(ns, sc, sm->name, sr->name, cm) != 0)      if (includeQualifiers)
       {
           if (_addQualifiers(ns, mc, mm->name, mr->name, cm) != 0)
     {     {
         printf("T[%u]\n", __LINE__);         printf("T[%u]\n", __LINE__);
         return -1;         return -1;
     }     }
       }
  
     // Add to method:     // Add to method:
  
Line 1023 
Line 1050 
  
 static int _addMethod( static int _addMethod(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     const MetaClass* sc,      const MetaClass* mc,
     const MetaMethod* sm,      const MetaMethod* mm,
     const char* classOrigin,     const char* classOrigin,
     bool propagated,     bool propagated,
       bool includeQualifiers,
       bool includeClassOrigin,
     CIMClass& cc)     CIMClass& cc)
 { {
     // Create method:     // Create method:
  
     CIMMethod cm(sm->name, CIMType(sm->type));      CIMMethod cm(mm->name, CIMType(mm->type));
   
       if (includeClassOrigin)
     cm.setClassOrigin(classOrigin);     cm.setClassOrigin(classOrigin);
   
     cm.setPropagated(propagated);     cm.setPropagated(propagated);
  
     // Add parameters:     // Add parameters:
  
     for (size_t i = 0; sm->parameters[i]; i++)      for (size_t i = 0; mm->parameters[i]; i++)
     {     {
         MetaFeature* sf = sm->parameters[i];          MetaFeature* mf = mm->parameters[i];
  
         if (sf->flags & META_FLAG_PROPERTY)          if (mf->flags & META_FLAG_PROPERTY)
         {         {
             MetaProperty* sp = (MetaProperty*)sf;              MetaProperty* mp = (MetaProperty*)mf;
             _addPropertyParameter(ns, sc, sm, sp, cm);              _addPropertyParameter(ns, mc, mm, mp, includeQualifiers, cm);
         }         }
         else if (sf->flags & META_FLAG_REFERENCE)          else if (mf->flags & META_FLAG_REFERENCE)
         {         {
             MetaReference* sr = (MetaReference*)sf;              MetaReference* mr = (MetaReference*)mf;
             _addReferenceParameter(ns, sc, sm, sr, cm);              _addReferenceParameter(ns, mc, mm, mr, includeQualifiers, cm);
         }         }
     }     }
  
     // Add qualifiers:     // Add qualifiers:
  
     if (_addQualifiers(ns, sc, sm->name, 0, cm) != 0)      if (includeQualifiers)
       {
           if (_addQualifiers(ns, mc, mm->name, 0, cm) != 0)
     {     {
         printf("T[%u]\n", __LINE__);         printf("T[%u]\n", __LINE__);
         return -1;         return -1;
     }     }
       }
  
     // Add to class:     // Add to class:
  
Line 1067 
Line 1102 
     return 0;     return 0;
 } }
  
   static bool _hasProperty(const char* const* propertyList, const char* name)
   {
       for (size_t i = 0; propertyList[i]; i++)
       {
           if (_eqi(propertyList[i], name))
               return true;
       }
   
       return false;
   }
   
 static int _addFeatures( static int _addFeatures(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     const MetaClass* sc,      const MetaClass* mc,
       bool localOnly,
       bool includeQualifiers,
       bool includeClassOrigin,
       const char* const* propertyList,
     CIMClass& cc)     CIMClass& cc)
 { {
   
     // Merge features from all inheritance levels into a single array:     // Merge features from all inheritance levels into a single array:
  
     FeatureInfo features[_MAX_FEATURES];     FeatureInfo features[_MAX_FEATURES];
     size_t numFeatures = 0;     size_t numFeatures = 0;
  
     if (_mergeFeatures(sc, features, numFeatures) != 0)      if (_mergeFeatures(mc, localOnly, features, numFeatures) != 0)
     {     {
         printf("T[%u]\n", __LINE__);         printf("T[%u]\n", __LINE__);
         return -1;         return -1;
Line 1092 
Line 1141 
  
         // Set propagated flag:         // Set propagated flag:
  
         bool propagated = fi.sc != sc;          bool propagated = fi.mc != mc;
  
         // Set classOrigin:         // Set classOrigin:
  
         const char* classOrigin = fi.sc->name;          const char* classOrigin = fi.mc->name;
  
         // Add the feature:          // Skip feature not in property list:
   
           const MetaFeature* mf = fi.mf;
  
         const MetaFeature* sf = fi.sf;          if (propertyList && !_hasProperty(propertyList, mf->name))
               continue;
  
         if (sf->flags & META_FLAG_PROPERTY)          // Add the feature:
   
           if (mf->flags & META_FLAG_PROPERTY)
         {         {
             MetaProperty* sp = (MetaProperty*)sf;              MetaProperty* mp = (MetaProperty*)mf;
  
             if (_addProperty(ns, sc, sp, classOrigin, propagated, cc) != 0)              if (_addProperty(ns, mc, mp, classOrigin, propagated,
                   includeQualifiers, includeClassOrigin, cc) != 0)
             {             {
                 printf("T[%u]\n", __LINE__);                 printf("T[%u]\n", __LINE__);
                 return -1;                 return -1;
             }             }
         }         }
         else if (sf->flags & META_FLAG_REFERENCE)          else if (mf->flags & META_FLAG_REFERENCE)
         {         {
             MetaReference* sr = (MetaReference*)sf;              MetaReference* mr = (MetaReference*)mf;
  
             if (_addReference(ns, sc, sr, classOrigin, propagated, cc) != 0)              if (_addReference(ns, mc, mr, classOrigin, propagated,
                   includeQualifiers, includeClassOrigin, cc) != 0)
             {             {
                 printf("T[%u]\n", __LINE__);                 printf("T[%u]\n", __LINE__);
                 return -1;                 return -1;
             }             }
         }         }
         else if (sf->flags & META_FLAG_METHOD)          else if (mf->flags & META_FLAG_METHOD)
         {         {
             MetaMethod* sm = (MetaMethod*)sf;              MetaMethod* mm = (MetaMethod*)mf;
  
             if (_addMethod(ns, sc, sm, classOrigin, propagated, cc) != 0)              if (_addMethod(ns, mc, mm, classOrigin, propagated,
                   includeQualifiers, includeClassOrigin, cc) != 0)
             {             {
                 printf("T[%u]\n", __LINE__);                 printf("T[%u]\n", __LINE__);
                 return -1;                 return -1;
Line 1139 
Line 1196 
  
 static int _makeClass( static int _makeClass(
     const MetaNameSpace* ns,     const MetaNameSpace* ns,
     CIMClass& cc,      const MetaClass* mc,
     const MetaClass* sc)      Boolean localOnly,
       Boolean includeQualifiers,
       Boolean includeClassOrigin,
       const char* const* propertyList,
       CIMClass& cc)
 { {
     try     try
     {     {
Line 1148 
Line 1209 
         {         {
             CIMName scn;             CIMName scn;
  
             if (sc->super)              if (mc->super)
                 scn = sc->super->name;                  scn = mc->super->name;
  
             cc = CIMClass(sc->name, scn);              cc = CIMClass(mc->name, scn);
     }     }
  
         // Add qualifiers:         // Add qualifiers:
  
         if (_addQualifiers(ns, sc, 0, 0, cc) != 0)          if (includeQualifiers)
           {
               if (_addQualifiers(ns, mc, 0, 0, cc) != 0)
         {         {
             printf("T[%u]\n", __LINE__);             printf("T[%u]\n", __LINE__);
             return -1;             return -1;
         }         }
           }
  
         // Features:         // Features:
  
         if (_addFeatures(ns, sc, cc) != 0)          if (_addFeatures(ns, mc, localOnly, includeQualifiers,
               includeClassOrigin, propertyList, cc) != 0)
         {         {
             printf("T[%u]\n", __LINE__);             printf("T[%u]\n", __LINE__);
             return -1;             return -1;
Line 1184 
Line 1249 
     return 0;     return 0;
 } }
  
   static char** _makePropertyList(const CIMPropertyList& propertyList)
   {
       if (propertyList.isNull())
           return 0;
   
       size_t size = propertyList.size();
       char** pl = (char**)malloc(sizeof(char*) * (size + 1));
   
       for (size_t i = 0; i < size; i++)
           pl[i] = strdup(*Str(propertyList[i]));
   
       pl[size] = 0;
   
       return pl;
   }
   
   static void _freePropertyList(char** pl)
   {
       if (!pl)
           return;
   
       for (size_t i = 0; pl[i]; i++)
       {
           free(pl[i]);
       }
   
       free(pl);
   }
   
   static void _printPropertyList(const char* const* pl)
   {
       if (!pl)
           return;
   
       for (size_t i = 0; pl[i]; i++)
           printf("pl[%s]\n", pl[i]);
   }
   
 //============================================================================== //==============================================================================
 // //
 // class MetaRepository // class MetaRepository
Line 1221 
Line 1324 
     Boolean includeClassOrigin,     Boolean includeClassOrigin,
     const CIMPropertyList& propertyList)     const CIMPropertyList& propertyList)
 { {
     return CIMClass();      printf("===== MetaRepository::getClass()\n");
   
       // ATTN-MEB: propertyList ignored!
   
   #if defined(TEST_META_REPOSITORY)
       _init();
   #endif
   
       // Lookup namespace:
   
       const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace));
   
       if (!ns)
           _throw(CIM_ERR_INVALID_NAMESPACE, "%s", *Str(nameSpace));
   
       // Lookup class:
   
       const MetaClass* mc = _findClass(ns, *Str(className));
   
       if (!mc)
           _throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className));
   
       // Build property list:
   
       char** pl = _makePropertyList(propertyList);
   
       // Make class:
   
       CIMClass cc;
   
       if (_makeClass(ns, mc, localOnly, includeQualifiers,
           includeQualifiers, pl, cc) != 0)
       {
           _freePropertyList(pl);
           _throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name);
       }
   
       _freePropertyList(pl);
       return cc;
 } }
  
 Array<CIMClass> MetaRepository::enumerateClasses( Array<CIMClass> MetaRepository::enumerateClasses(
Line 1232 
Line 1373 
     Boolean includeQualifiers,     Boolean includeQualifiers,
     Boolean includeClassOrigin)     Boolean includeClassOrigin)
 { {
       printf("===== MetaRepository::enumerateClasses()\n");
   
 #if defined(TEST_META_REPOSITORY) #if defined(TEST_META_REPOSITORY)
     _init();     _init();
 #endif #endif
  
     printf("MetaRepository::enumerateClasses()\n");  
   
     // Lookup namespace:     // Lookup namespace:
  
     const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace));     const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace));
Line 1263 
Line 1404 
  
     for (size_t i = 0; ns->classes[i]; i++)     for (size_t i = 0; ns->classes[i]; i++)
     {     {
         MetaClass* sc = ns->classes[i];          MetaClass* mc = ns->classes[i];
  
 // printf("CLASSNAME[%s]\n", sc->name);          bool flag = false;
  
         if (deepInheritance)         if (deepInheritance)
         {         {
             if (_isSubClass(super, sc))              if (_isSubClass(super, mc))
             {                  flag = true;
                 CIMClass cc;  
   
                 if (_makeClass(ns, cc, sc) != 0)  
                     _throw(CIM_ERR_FAILED, "conversion failed: %s", sc->name);  
                 else  
                     result.append(cc);  
             }  
         }         }
         else         else
         {         {
             if (_isDirectSubClass(super, sc))              if (_isDirectSubClass(super, mc))
                   flag = true;
           }
   
           if (flag)
             {             {
                 CIMClass cc;                 CIMClass cc;
  
                 if (_makeClass(ns, cc, sc) != 0)              if (_makeClass(ns, mc, localOnly, includeQualifiers,
                     _throw(CIM_ERR_FAILED, "conversion failed: %s", sc->name);                  includeQualifiers, 0, cc) != 0)
               {
                   _throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name);
               }
                 else                 else
                     result.append(cc);                     result.append(cc);
             }             }
         }         }
     }  
  
     return result;     return result;
 } }
Line 1301 
Line 1441 
     const CIMName& className,     const CIMName& className,
     Boolean deepInheritance)     Boolean deepInheritance)
 { {
       printf("===== MetaRepository::enumerateClassNames()\n");
   
   #if defined(TEST_META_REPOSITORY)
       _init();
   #endif
   
     // Lookup namespace:     // Lookup namespace:
  
     const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace));     const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace));
Line 1326 
Line 1472 
  
     for (size_t i = 0; ns->classes[i]; i++)     for (size_t i = 0; ns->classes[i]; i++)
     {     {
         MetaClass* sc = ns->classes[i];          MetaClass* mc = ns->classes[i];
  
         if (deepInheritance)         if (deepInheritance)
         {         {
             if (_isSubClass(super, sc))              if (_isSubClass(super, mc))
                 result.append(sc->name);                  result.append(mc->name);
         }         }
         else         else
         {         {
             if (_isDirectSubClass(super, sc))              if (_isDirectSubClass(super, mc))
                 result.append(sc->name);                  result.append(mc->name);
         }         }
     }     }
  


Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.3

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2