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

Diff for /pegasus/src/Pegasus/Common/CIMValue.h between version 1.17 and 1.31

version 1.17, 2002/03/24 13:33:07 version 1.31, 2002/08/26 16:26:10
Line 1 
Line 1 
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
   // The Open Group, Tivoli Systems
 // //
 // 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 24 
Line 25 
 // //
 // Modified By: Karl schopmeyer (k.schopmeyer@opengroup.org) // Modified By: Karl schopmeyer (k.schopmeyer@opengroup.org)
 //              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
   //                (carolann_graves@hp.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 33 
Line 36 
 #include <Pegasus/Common/String.h> #include <Pegasus/Common/String.h>
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/CIMType.h> #include <Pegasus/Common/CIMType.h>
   #include <Pegasus/Common/CIMObjectPath.h>
 #include <Pegasus/Common/CIMDateTime.h> #include <Pegasus/Common/CIMDateTime.h>
 #include <Pegasus/Common/Union.h>  #include <Pegasus/Common/Exception.h>
 #include <Pegasus/Common/Array.h> #include <Pegasus/Common/Array.h>
   #include <Pegasus/Common/Linkage.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   class CIMValueRep;
   
 /** /**
     The CIMValue class represents a value of any of the CIM data types     The CIMValue class represents a value of any of the CIM data types
     (see CIMType.h for a list of valid CIM data types). This class     (see CIMType.h for a list of valid CIM data types). This class
Line 58 
Line 65 
     */     */
     CIMValue(CIMType type, Boolean isArray, Uint32 arraySize = 0);     CIMValue(CIMType type, Boolean isArray, Uint32 arraySize = 0);
  
     /** Constructor with the Value constructor and a value.  This constructs a      // ATTN This needs an example
         CIMValue object with the type defined by the value constructor and the value      /** Constructor with the Value constructor and a value.
           This constructs a
           CIMValue object with the type defined by the value constructor
           and the value
         installed         installed
         <pre>  
         ATTN: Add example  
         </pre>  
     */     */
     CIMValue(Boolean x) { _init(); set(x); }      CIMValue(Boolean x);
   
     /// Constructor  
     CIMValue(Uint8 x) { _init(); set(x); }  
  
     /// Constructor     /// Constructor
     CIMValue(Sint8 x) { _init(); set(x); }      CIMValue(Uint8 x);
  
     /// Constructor     /// Constructor
     CIMValue(Uint16 x) { _init(); set(x); }      CIMValue(Sint8 x);
  
     /// Constructor     /// Constructor
     CIMValue(Sint16 x) { _init(); set(x); }      CIMValue(Uint16 x);
  
     /// Constructor     /// Constructor
     CIMValue(Uint32 x) { _init(); set(x); }      CIMValue(Sint16 x);
  
     /// Constructor     /// Constructor
     CIMValue(Sint32 x) { _init(); set(x); }      CIMValue(Uint32 x);
  
     /// Constructor     /// Constructor
     CIMValue(Uint64 x) { _init(); set(x); }      CIMValue(Sint32 x);
  
     /// Constructor     /// Constructor
     CIMValue(Sint64 x) { _init(); set(x); }      CIMValue(Uint64 x);
  
     /// Constructor     /// Constructor
     CIMValue(Real32 x) { _init(); set(x); }      CIMValue(Sint64 x);
  
     /// Constructor     /// Constructor
     CIMValue(Real64 x) { _init(); set(x); }      CIMValue(Real32 x);
  
     /// Constructor     /// Constructor
     CIMValue(const Char16& x) { _init(); set(x); }      CIMValue(Real64 x);
  
     /// Constructor     /// Constructor
     CIMValue(const String& x) { _init(); set(x); }      CIMValue(const Char16& x);
  
     /// Constructor     /// Constructor
     CIMValue(const char* x) { _init(); set(x); }      CIMValue(const String& x);
  
     /// Constructor     /// Constructor
     CIMValue(const CIMDateTime& x) { _init(); set(x); }      CIMValue(const CIMDateTime& x);
  
     /// Constructor     /// Constructor
     CIMValue(const CIMReference& x) { _init(); set(x); }      CIMValue(const CIMObjectPath& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Boolean>& x) { _init(); set(x); }      CIMValue(const Array<Boolean>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Uint8>& x) { _init(); set(x); }      CIMValue(const Array<Uint8>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Sint8>& x) { _init(); set(x); }      CIMValue(const Array<Sint8>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Uint16>& x) { _init(); set(x); }      CIMValue(const Array<Uint16>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Sint16>& x) { _init(); set(x); }      CIMValue(const Array<Sint16>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Uint32>& x) { _init(); set(x); }      CIMValue(const Array<Uint32>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Sint32>& x) { _init(); set(x); }      CIMValue(const Array<Sint32>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Uint64>& x) { _init(); set(x); }      CIMValue(const Array<Uint64>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Sint64>& x) { _init(); set(x); }      CIMValue(const Array<Sint64>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Real32>& x) { _init(); set(x); }      CIMValue(const Array<Real32>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Real64>& x) { _init(); set(x); }      CIMValue(const Array<Real64>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<Char16>& x) { _init(); set(x); }      CIMValue(const Array<Char16>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<String>& x) { _init(); set(x); }      CIMValue(const Array<String>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<CIMDateTime>& x) { _init(); set(x); }      CIMValue(const Array<CIMDateTime>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const Array<CIMReference>& x) { _init(); set(x); }      CIMValue(const Array<CIMObjectPath>& x);
  
     /// Constructor     /// Constructor
     CIMValue(const CIMValue& x);     CIMValue(const CIMValue& x);
Line 164 
Line 168 
     ~CIMValue();     ~CIMValue();
  
     /// Operator =     /// Operator =
     CIMValue& operator=(const CIMValue& x)      CIMValue& operator=(const CIMValue& x);
     {  
         assign(x); return *this;  
     }  
  
     /** assign - The method to assign one CIMValue object to another CIMValue     /** assign - The method to assign one CIMValue object to another CIMValue
     object.     object.
   
     */     */
     void assign(const CIMValue& x);     void assign(const CIMValue& x);
  
     /** clear - Clears the attributes and value of the CIMValue object.     /** clear - Clears the attributes and value of the CIMValue object.
     <pre>  
     ATTNDOC:  
     </pre>  
     */     */
     void clear();     void clear();
  
     /** typeCompatible - Compares the types of two CIMvalues. This      /** typeCompatible - Compares the types of two CIMValues. This
         compares the type field and the array indicators.         compares the type field and the array indicators.
         @return true if both are of the same type and both are either arrays         @return true if both are of the same type and both are either arrays
         or not. Else returns false.         or not. Else returns false.
Line 193 
Line 190 
                 ...                 ...
         </pre>         </pre>
     */     */
     Boolean typeCompatible(const CIMValue& x) const      Boolean typeCompatible(const CIMValue& x) const;
     {  
         return _type == x._type && _isArray == x._isArray;  
     }  
  
     /** isArray - Determines if the value is an array     /** isArray - Determines if the value is an array
         @return TRUE if the value is an array         @return TRUE if the value is an array
     */     */
     Boolean isArray() const { return _isArray; }      Boolean isArray() const;
  
     /** Returns whether the CIMvalue object is Null.     /** Returns whether the CIMvalue object is Null.
         Null is the specific condition where no value has         Null is the specific condition where no value has
Line 210 
Line 204 
         will create an exception.         will create an exception.
         @return Returns True if the CIMValue object is Null         @return Returns True if the CIMValue object is Null
     */     */
     Boolean isNull() const { return _isNull; }      Boolean isNull() const;
  
     /** getArraySize = Returns the size of an Array CIMValue     /** getArraySize = Returns the size of an Array CIMValue
         @return The number of entries in the array         @return The number of entries in the array
Line 218 
Line 212 
     Uint32 getArraySize() const;     Uint32 getArraySize() const;
  
     /** getType - Gets the CIMType attribute for the CIMValue.     /** getType - Gets the CIMType attribute for the CIMValue.
         The CIMType is defined in ATTN:          @return the CIMType value
         @return Returns the CIMType value  
     */     */
     CIMType getType() const      CIMType getType() const;
     {  
         return CIMType(_type);  
     }  
  
     /** setNullvalue - Sets the CIMType, the Array indicator and if it is      /** setNullValue - Sets the CIMType, the Array indicator and if it is
         the arraytype, the Arraysize of a CIMValue and sets the isNull         the arraytype, the Arraysize of a CIMValue and sets the isNull
         Attribute.  This function is used to set up CIMValues an NULL but         Attribute.  This function is used to set up CIMValues an NULL but
         with valid CIMType and array characteristics (ex. when update from         with valid CIMType and array characteristics (ex. when update from
Line 243 
Line 233 
     */     */
     void setNullValue(CIMType type, Boolean isArray, Uint32 arraySize = 0);     void setNullValue(CIMType type, Boolean isArray, Uint32 arraySize = 0);
  
       //  All of the CIMTypes defined in ATTN: and the Array types defined in
       //  ATTN: may be set.
     /** set - Sets the type, Array attribute and puts the value provided     /** set - Sets the type, Array attribute and puts the value provided
         into the value of the target CIMValue. This function sets the         into the value of the target CIMValue. This function sets the
         CIMValue to nonNull also. The result is a complete CIMValue object         CIMValue to nonNull also. The result is a complete CIMValue object
         All of the CIMTypes defined in ATTN: and the Array types defined in  
         ATTN: may be set.  
         @param x Typed value (ex. Boolean(true).         @param x Typed value (ex. Boolean(true).
         @return void         @return void
         <pre>         <pre>
Line 282 
Line 272 
     ///     ///
     void set(const String& x);     void set(const String& x);
     ///     ///
     void set(const char* x);  
     ///  
     void set(const CIMDateTime& x);     void set(const CIMDateTime& x);
     ///     ///
     void set(const CIMReference& x);      void set(const CIMObjectPath& x);
     ///     ///
     void set(const Array<Boolean>& x);     void set(const Array<Boolean>& x);
     ///     ///
Line 316 
Line 304 
     ///     ///
     void set(const Array<CIMDateTime>& x);     void set(const Array<CIMDateTime>& x);
     ///     ///
     void set(const Array<CIMReference>& x);      void set(const Array<CIMObjectPath>& x);
  
     /** get - Gets the value of a CIMValue     /** get - Gets the value of a CIMValue
         @param Variable in which we return the value:  
         @return void          Note: Before using get, the caller should use getType () and isNull ()
           to ensure that the value is not null, and is of the correct type.
           If the CIMValue is null, the output parameter is not updated.
   
           @param Variable in which we return the value
   
           @exception TypeMismatchException If the CIMValue type is not compatible
                      with the type of the output parameter
                 <pre>                 <pre>
                 Uint32 v;                 Uint32 v;
                 CIMValue value(CIMValue::UINT32, UINT32(99));                 CIMValue value(CIMValue::UINT32, UINT32(99));
                 value.get(v);                 value.get(v);
                 </pre>                 </pre>
   
           <pre>
           Uint32 v;
           CIMValue value = property.getValue ();
           if ((value.getType () == CIMTYPE_UINT32) && (!value.isNull ()))
               value.get (v);
           </pre>
     */     */
     void get(Boolean& x) const;     void get(Boolean& x) const;
     ///     ///
Line 355 
Line 357 
     ///     ///
     void get(CIMDateTime& x) const;     void get(CIMDateTime& x) const;
     ///     ///
     void get(CIMReference& x) const;      void get(CIMObjectPath& x) const;
     ///     ///
     void get(Array<Boolean>& x) const;     void get(Array<Boolean>& x) const;
     ///     ///
Line 385 
Line 387 
     ///     ///
     void get(Array<CIMDateTime>& x) const;     void get(Array<CIMDateTime>& x) const;
     ///     ///
     void get(Array<CIMReference>& x) const;      void get(Array<CIMObjectPath>& x) const;
  
     /** toXML - Converts a CIMValue object to XML. The XML is appended      /** Compare with another CIMValue object for equality.
         to the Array provided with the call.  Returns the result as an          @param x - CIMValue to compare with
         XML element wrapped in the <VALUE>, <VALUE.ARRAY>, <VALUE.REFERENCE>,          @return True if they are identical in type, attribute and value.
         or <VALUE.REFARRAY> tags. If the CIMValue is Null, no element is  
         returned.  
         @param out Sint8 Array to hold the XML representation  
         @param forceTag Boolean parameter that if set forces the XML tags to  
         be output even if the CIMValue is NULL.  
         @return Returns the XML representation of the CIMValue  
         object in the input parameter out.  
     */  
     void toXml(Array<Sint8>& out, Boolean forceTag) const;  
   
     /** toXML - Converts a CIMValue object to XML. There is no input  
         parameter and the result is returned as a String rather  
         than appended to an 8-bit array as above.  Returns the  
         element as value wrapped in the <VALUE>, <VALUE.ARRAY>,  
         <VALUE.REFERENCE>, or <VALUE.REFARRAY> tags. If the  
         CIMValue is Null, no element is returned.  
         @param forceTag Boolean parameter that if set forces the XML tags to  
         be output even if the CIMValue is NULL.  
         @return Returns the XML representation of the CIMValue  
         object in String form.  
     */  
     String toXml(Boolean forceTag) const;  
   
     /** CIMMethod print - Format and print the Value as XML to std output  
         stream  
         @param forceTag Boolean parameter that if set forces the XML tags to  
         be output even if the CIMValue is NULL.  
         @param o Stream to output to. Defaults to cout.  
         @return None  
         <PRE>  
         Example:  
             CIMValue value(Boolean(true));  
             value.print(true);    // Prints "true"  
         </PRE>  
     */  
     void print(Boolean forceTag, PEGASUS_STD(ostream) &o=PEGASUS_STD(cout)) const;  
   
     /** toMof - Converts a CIMValueObject to Mof.  
         @out Sint8 Array to hold the Mof representation  
         @return Returns the Mof representation of the CIMValue  
         object in the input parameter out.  
     */     */
     void toMof(Array<Sint8>& out) const;      Boolean equal(const CIMValue& x) const;
  
     /** toString - Converts the CIMvalue to a string.  Should only be     /** toString - Converts the CIMvalue to a string.  Should only be
             used for output purposes.  To get an actual String value, use             used for output purposes.  To get an actual String value, use
             get(String &).             get(String &).
         @return - String output for CIMValue.         @return - String output for CIMValue.
         @exception - Throws exception CIMValueInvalidType if the CIMValue          @exception - Throws CIMValueInvalidTypeException if the CIMValue
             has an invalid type. Normally this is a Pegasus internal error.             has an invalid type. Normally this is a Pegasus internal error.
         <PRE>         <PRE>
         Example:         Example:
Line 451 
Line 412 
  
 private: private:
  
     void _init();      // ATTN-RK-P2-20020719: For debugging only; remove before API release.
       // Use CIMValue(const String&) instead.
       PEGASUS_EXPLICIT CIMValue(const char* x) {}
  
     CIMType _type;      CIMValueRep* _rep;
     Boolean _isArray;  
     Boolean _isNull;  
     Union _u;  
  
     friend class CIMMethodRep;     friend class CIMMethodRep;
     friend class CIMParameterRep;     friend class CIMParameterRep;
     friend class CIMPropertyRep;     friend class CIMPropertyRep;
     friend class CIMQualifierRep;     friend class CIMQualifierRep;
     friend class CIMQualifierDeclRep;     friend class CIMQualifierDeclRep;
     PEGASUS_COMMON_LINKAGE friend Boolean operator==(  
         const CIMValue& x,  
         const CIMValue& y);  
 }; };
   
 /** operator == compares two CIMValue objects for equality. /** operator == compares two CIMValue objects for equality.
         @param x - First CIMvalue to compare          @param x - First CIMValue to compare
         @parm y - Second CIMValue to compare          @param y - Second CIMValue to compare
         @return True if they are identical in type, attribute and value.         @return True if they are identical in type, attribute and value.
 */ */
 PEGASUS_COMMON_LINKAGE Boolean operator==(const CIMValue& x, const CIMValue& y); PEGASUS_COMMON_LINKAGE Boolean operator==(const CIMValue& x, const CIMValue& y);
  
 /** operator != compares two CIMValue objects for nonequality  /** operator != compares two CIMValue objects for inequality
 */ */
 inline Boolean operator!=(const CIMValue& x, const CIMValue& y)  PEGASUS_COMMON_LINKAGE Boolean operator!=(const CIMValue& x, const CIMValue& y);
 {  
     return !operator==(x, y);  
 }  
  
 #define PEGASUS_ARRAY_T CIMValue #define PEGASUS_ARRAY_T CIMValue
 # include "ArrayInter.h"  # include <Pegasus/Common/ArrayInter.h>
 #undef PEGASUS_ARRAY_T #undef PEGASUS_ARRAY_T
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.17  
changed lines
  Added in v.1.31

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2