(file) Return to CIMClassRep.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/CIMClassRep.cpp between version 1.57 and 1.71.4.1

version 1.57, 2003/07/31 14:24:33 version 1.71.4.1, 2006/01/10 18:34:04
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 27 
Line 33 
 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 //              Carol Ann Krug Graves, Hewlett-Packard Company //              Carol Ann Krug Graves, Hewlett-Packard Company
 //                (carolann_graves@hp.com) //                (carolann_graves@hp.com)
   //              David Dillard, VERITAS Software Corp.
   //                  (david.dillard@veritas.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 41 
Line 49 
 #include "MofWriter.h" #include "MofWriter.h"
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
 #include <Pegasus/Common/MessageLoader.h> //l10n #include <Pegasus/Common/MessageLoader.h> //l10n
   #include "CIMNameUnchecked.h"
   #include "StrLit.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
 PEGASUS_USING_STD; PEGASUS_USING_STD;
Line 92 
Line 102 
     value.get(flag);     value.get(flag);
     return flag;     return flag;
 } }
   
 void CIMClassRep::setSuperClassName(const CIMName& superClassName) void CIMClassRep::setSuperClassName(const CIMName& superClassName)
 { {
     _superClassName = superClassName;     _superClassName = superClassName;
Line 116 
Line 125 
  
     }     }
  
     // Set the class origin:      // Reject addition of a reference property without a referenceClassName
     // ATTN: put this check in other places:  
  
     if (x.getClassOrigin().isNull())      if ((x.getType() == CIMTYPE_REFERENCE) &&
         CIMProperty(x).setClassOrigin(_reference.getClassName());          (x.getReferenceClassName().isNull()))
       {
           throw TypeMismatchException();
       }
  
     // Add the property:     // Add the property:
  
Line 248 
Line 259 
                                                 MessageLoaderParms("Common.CIMClassRep.NON_ASSOCIATION_CLASS_CONTAINS_REFERENCE_PROPERTY",                                                 MessageLoaderParms("Common.CIMClassRep.NON_ASSOCIATION_CLASS_CONTAINS_REFERENCE_PROPERTY",
                                                                                    "Non-assocation class contains reference property"));                                                                                    "Non-assocation class contains reference property"));
  
   
                         }                         }
  
   
                         Uint32 index = superClass.findProperty(property.getName());                         Uint32 index = superClass.findProperty(property.getName());
  
                         if (index == PEG_NOT_FOUND)                         if (index == PEG_NOT_FOUND)
                         {                         {
                             Resolver::resolveProperty (property, context,                             Resolver::resolveProperty (property, context,
                                 nameSpace, false, true);                                 nameSpace, false, true);
                               if (property.getClassOrigin().isNull())
                               {
                                   property.setClassOrigin(getClassName());
                               }
                               property.setPropagated(false);
                         }                         }
                         else                         else
                         {                         {
Line 263 
Line 281 
                                 superClass.getProperty(index);                                 superClass.getProperty(index);
                             Resolver::resolveProperty (property, context,                             Resolver::resolveProperty (property, context,
                                 nameSpace, false, superClassProperty, true);                                 nameSpace, false, superClassProperty, true);
                               if (property.getClassOrigin().isNull())
                               {
                                   property.setClassOrigin(
                                       superClassProperty.getClassOrigin());
                               }
                         }                         }
                 }                 }
  
Line 441 
Line 464 
                 //cout << "KSTEST Class Resolve, No Super class " << getClassName() << endl;                 //cout << "KSTEST Class Resolve, No Super class " << getClassName() << endl;
  
                 for (Uint32 i = 0, n = _properties.size(); i < n; i++)                 for (Uint32 i = 0, n = _properties.size(); i < n; i++)
                   {
                     Resolver::resolveProperty (_properties[i], context,                     Resolver::resolveProperty (_properties[i], context,
                         nameSpace, false, true);                         nameSpace, false, true);
                       _properties[i].setClassOrigin(getClassName());
                       _properties[i].setPropagated(false);
                   }
  
                 //----------------------------------------------------------------------                 //----------------------------------------------------------------------
                 // Resolve each method:                 // Resolve each method:
Line 469 
Line 496 
     // _resolved = true;     // _resolved = true;
 } }
  
 void CIMClassRep::toXml(Array<Sint8>& out) const  CIMInstance CIMClassRep::buildInstance(Boolean includeQualifiers,
       Boolean includeClassOrigin,
       const CIMPropertyList& propertyList) const
   {
   
       // Create the new instance
       CIMInstance newInstance(_reference.getClassName());
   
       // Copy qualifiers if required
       if (includeQualifiers)
       {
           for (Uint32 i = 0 ; i < getQualifierCount() ; i++)
           {
               newInstance.addQualifier(getQualifier(i).clone());
           }
       }
   
       // Copy Properties
       Array<CIMName> propListNames = propertyList.getPropertyNameArray();
       for (Uint32 i = 0, n = _properties.size() ; i < n; ++i)
       {
           CIMConstProperty classProp = getProperty(i);
           CIMName name = classProp.getName();
           if (propertyList.isNull() || Contains(propListNames, name))
           {
               CIMProperty p(classProp.getName(),
                   CIMValue(classProp.getType(), classProp.isArray()));
               Uint32 qualifierCount = classProp.getQualifierCount();
               if(includeQualifiers && qualifierCount > 0)
               {
                   for(Uint32 j = 0; j < qualifierCount; ++j)
                   {
                       p.addQualifier(classProp.getQualifier(j).clone());
                   }
               }
               if (includeClassOrigin)
               {
                   p.setClassOrigin(classProp.getClassOrigin());
               }
               newInstance.addProperty(p);
   
               // Delete class origin attribute if required
           }
       }
   
       return(newInstance);
   }
   
   void CIMClassRep::toXml(Buffer& out) const
 { {
     // Class opening element:     // Class opening element:
  
     out << "<CLASS ";      out << STRLIT("<CLASS ");
     out << " NAME=\"" << _reference.getClassName() << "\" ";      out << STRLIT(" NAME=\"") << _reference.getClassName() << STRLIT("\" ");
  
     if (!_superClassName.isNull())     if (!_superClassName.isNull())
         out << " SUPERCLASS=\"" << _superClassName << "\" ";          out << STRLIT(" SUPERCLASS=\"") << _superClassName << STRLIT("\" ");
  
     out << ">\n";      out << STRLIT(">\n");
  
     // Qualifiers:     // Qualifiers:
  
Line 497 
Line 572 
  
     // Class closing element:     // Class closing element:
  
     out << "</CLASS>\n";      out << STRLIT("</CLASS>\n");
 } }
 /** toMof prepares an 8-bit string with the MOF for the class. /** toMof prepares an 8-bit string with the MOF for the class.
     The BNF for this is:     The BNF for this is:
Line 512 
Line 587 
  
 */ */
  
 void CIMClassRep::toMof(Array<Sint8>& out) const  void CIMClassRep::toMof(Buffer& out) const
 { {
     // Get and format the class qualifiers     // Get and format the class qualifiers
     out << "\n//    Class " << _reference.getClassName();      out << STRLIT("\n//    Class ") << _reference.getClassName();
     if (_qualifiers.getCount())     if (_qualifiers.getCount())
         out << "\n";          out.append('\n');
     out << "\n";      out.append('\n');
     _qualifiers.toMof(out);     _qualifiers.toMof(out);
  
     // Separate qualifiers from Class Name     // Separate qualifiers from Class Name
     out << "\n";      out.append('\n');
  
     // output class statement     // output class statement
     out << "class " << _reference.getClassName();      out << STRLIT("class ") << _reference.getClassName();
  
     if (!_superClassName.isNull())     if (!_superClassName.isNull())
         out << " : " << _superClassName;          out << STRLIT(" : ") << _superClassName;
  
     out << "\n{";      out << STRLIT("\n{");
  
     // format the Properties:     // format the Properties:
     for (Uint32 i = 0, n = _properties.size(); i < n; i++)     for (Uint32 i = 0, n = _properties.size(); i < n; i++)
Line 551 
Line 626 
     }     }
  
     // Class closing element:     // Class closing element:
     out << "\n};\n";      out << STRLIT("\n};\n");
 } }
  
  
Line 620 
Line 695 
         CIMConstProperty property = getProperty(i);         CIMConstProperty property = getProperty(i);
  
         Uint32 index;         Uint32 index;
         if ((index = property.findQualifier (CIMName ("key"))) != PEG_NOT_FOUND)          if ((index = property.findQualifier(
               CIMNameUnchecked("key"))) != PEG_NOT_FOUND)
         {         {
             CIMValue value;             CIMValue value;
             value = property.getQualifier (index).getValue ();             value = property.getQualifier (index).getValue ();
Line 642 
Line 718 
         CIMConstProperty property = getProperty(i);         CIMConstProperty property = getProperty(i);
  
         Uint32 index;         Uint32 index;
         if ((index = property.findQualifier (CIMName ("key"))) != PEG_NOT_FOUND)          if ((index = property.findQualifier(
               CIMNameUnchecked("key"))) != PEG_NOT_FOUND)
         {         {
             CIMValue value;             CIMValue value;
             value = property.getQualifier (index).getValue ();             value = property.getQualifier (index).getValue ();


Legend:
Removed from v.1.57  
changed lines
  Added in v.1.71.4.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2