(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.3 and 1.13

version 1.3, 2001/03/04 21:57:34 version 1.13, 2002/02/18 13:59:48
Line 1 
Line 1 
 //BEGIN_LICENSE  //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a  // Permission is hereby granted, free of charge, to any person obtaining a copy
 // copy of this software and associated documentation files (the "Software"),  // of this software and associated documentation files (the "Software"), to
 // to deal in the Software without restriction, including without limitation  // deal in the Software without restriction, including without limitation the
 // the rights to use, copy, modify, merge, publish, distribute, sublicense,  // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // and/or sell copies of the Software, and to permit persons to whom the  // sell copies of the Software, and to permit persons to whom the Software is
 // Software is furnished to do so, subject to the following conditions:  // furnished to do so, subject to the following conditions:
 // //
 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL  // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 // DEALINGS IN THE SOFTWARE.  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // //
 //END_LICENSE  //==============================================================================
 //BEGIN_HISTORY  
 // //
 // Author:  // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // $Log$  // Modified By: Karl schopmeyer (k.schopmeyer@opengroup.org)
 // Revision 1.3  2001/03/04 21:57:34  bob  
 // Changed print methods to take a stream instead of hardcoded cout  
 // //
 // Revision 1.2  2001/02/20 05:16:57  mike  //%/////////////////////////////////////////////////////////////////////////////
 // Implemented CIMInstance::getInstanceName()  
 //  
 // Revision 1.1  2001/02/18 18:39:06  mike  
 // new  
 //  
 // Revision 1.2  2001/02/18 02:49:00  mike  
 // Removed ugly workarounds for MSVC++ 5.0 (using SP3 now)  
 //  
 // Revision 1.1  2001/02/16 02:07:06  mike  
 // Renamed many classes and headers (using new CIM prefixes).  
 //  
 // Revision 1.3  2001/01/30 08:00:43  karl  
 // DOC++ Documentation update for header files  
 //  
 // Revision 1.2  2001/01/29 08:03:12  karl  
 // DOC++ Documentation  
 //  
 // Revision 1.1.1.1  2001/01/14 19:53:21  mike  
 // Pegasus import  
 //  
 //  
 //END_HISTORY  
  
 #ifndef Pegasus_Value_h #ifndef Pegasus_Value_h
 #define Pegasus_Value_h #define Pegasus_Value_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/String.h>  
 #include <Pegasus/Common/CIMDateTime.h> #include <Pegasus/Common/CIMDateTime.h>
 #include <Pegasus/Common/Union.h> #include <Pegasus/Common/Union.h>
 #include <Pegasus/Common/Array.h> #include <Pegasus/Common/Array.h>
Line 176 
Line 152 
         assign(x); return *this;         assign(x); return *this;
     }     }
  
     /// CIMMethod assign      /** assign - The method to assign one CIMValue object to another CIMValue
       object.
   
       */
     void assign(const CIMValue& x);     void assign(const CIMValue& x);
  
     /// CIMMethod clear      /** clear - Clears the attributes and value of the CIMValue object.
       <pre>
       ATTNDOC:
       </pre>
       */
     void clear();     void clear();
  
     /** CIMMethod typeCompatible - Compares the types of two values.      /** typeCompatible - Compares the types of two CIMvalues. This
         @return true if compatible.          compares the type field and the array indicators.
           @return true if both are of the same type and both are either arrays
           or not. Else returns false.
           <pre>
               CIMValue a(Boolean(true);
               CIMValue b = a;
               if b.typeCompatible(a)
                   ...
           </pre>
     */     */
     Boolean typeCompatible(const CIMValue& x) const     Boolean typeCompatible(const CIMValue& x) const
     {     {
         return _type == x._type && _isArray == x._isArray;         return _type == x._type && _isArray == x._isArray;
     }     }
  
     /** CIMMethod 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 { return _isArray; }
  
     /** CIMMethod getArraySize      /** Returns whether the CIMvalue object is Null.
           Null is the specific condition where no value has
           yet been set into the value.
           If a CIMValue object is Null, any get on that object
           will create an exception.
           @return Returns True if the CIMValue object is Null
       */
       Boolean isNull() const { return _isNull; }
   
       /** getArraySize = Returns the size of an Array CIMValue
         @return The number of entries in the array         @return The number of entries in the array
     */     */
     Uint32 getArraySize() const;     Uint32 getArraySize() const;
  
       /** getType - Gets the CIMType attribute for the CIMValue.
           The CIMType is defined in ATTN:
           @return Returns the CIMType value
       */
     CIMType getType() const     CIMType getType() const
     {     {
         return CIMType(_type);         return CIMType(_type);
     }     }
  
     /// method setNullvalue - ATTN:      /** setNullvalue - Sets the CIMType, the Array indicator and if it is
           the arraytype, the Arraysize of a CIMValue and sets the isNull
           Attribute.  This function is used to set up CIMValues an NULL but
           with valid CIMType and array characteristics (ex. when update from
           XML)
           @param type - The CIMType for this CIMValue
           @paramisArray - Boolean indicating whether this is an array CIMValue
           @param arraySize (optional)  Uint32parameter indicating the array
           size
           @return void
       */
     void setNullValue(CIMType type, Boolean isArray, Uint32 arraySize = 0);     void setNullValue(CIMType type, Boolean isArray, Uint32 arraySize = 0);
  
     /// method set - ATTN:      /** set - Sets the type, Array attribute and puts the value provided
           into the value of the target CIMValue. This function sets the
           CIMValue to nonNull also.
           All of the CIMTypes defined in ATTN: and the Array types defined in
           ATTN: may be set.
           @param x Typed value (ex. Boolean(true).
           @return void
           <pre>
               CIMValue x;
               x.set(Uint16(9));
           </pre>
       */
     void set(Boolean x);     void set(Boolean x);
  
     /// CIMMethod Set      /// Set
     void set(Uint8 x);     void set(Uint8 x);
       ///
     void set(Sint8 x);     void set(Sint8 x);
       ///
     void set(Uint16 x);     void set(Uint16 x);
       ///
     void set(Sint16 x);     void set(Sint16 x);
       ///
     void set(Uint32 x);     void set(Uint32 x);
       ///
     void set(Sint32 x);     void set(Sint32 x);
       ///
     void set(Uint64 x);     void set(Uint64 x);
       ///
     void set(Sint64 x);     void set(Sint64 x);
       ///
     void set(Real32 x);     void set(Real32 x);
       ///
     void set(Real64 x);     void set(Real64 x);
       ///
     void set(const Char16& x);     void set(const Char16& x);
       ///
     void set(const String& x);     void set(const String& x);
       ///
     void set(const char* x);     void set(const char* x);
       ///
     void set(const CIMDateTime& x);     void set(const CIMDateTime& x);
       ///
     void set(const CIMReference& x);     void set(const CIMReference& x);
       ///
     void set(const Array<Boolean>& x);     void set(const Array<Boolean>& x);
       ///
     void set(const Array<Uint8>& x);     void set(const Array<Uint8>& x);
       ///
     void set(const Array<Sint8>& x);     void set(const Array<Sint8>& x);
       ///
     void set(const Array<Uint16>& x);     void set(const Array<Uint16>& x);
       ///
     void set(const Array<Sint16>& x);     void set(const Array<Sint16>& x);
       ///
     void set(const Array<Uint32>& x);     void set(const Array<Uint32>& x);
       ///
     void set(const Array<Sint32>& x);     void set(const Array<Sint32>& x);
       ///
     void set(const Array<Uint64>& x);     void set(const Array<Uint64>& x);
       ///
     void set(const Array<Sint64>& x);     void set(const Array<Sint64>& x);
       ///
     void set(const Array<Real32>& x);     void set(const Array<Real32>& x);
       ///
     void set(const Array<Real64>& x);     void set(const Array<Real64>& x);
       ///
     void set(const Array<Char16>& x);     void set(const Array<Char16>& x);
       ///
     void set(const Array<String>& x);     void set(const Array<String>& x);
       ///
     void set(const Array<CIMDateTime>& x);     void set(const Array<CIMDateTime>& x);
  
     /// CIMMethod get - ATTN      /** get - Gets the value of a CIMValue
           @param ATTNDOC:
           @return ATTNDOC:
       */
     void get(Boolean& x) const;     void get(Boolean& x) const;
       ///
     void get(Uint8& x) const;     void get(Uint8& x) const;
       ///
     void get(Sint8& x) const;     void get(Sint8& x) const;
       ///
     void get(Uint16& x) const;     void get(Uint16& x) const;
       ///
     void get(Sint16& x) const;     void get(Sint16& x) const;
       ///
     void get(Uint32& x) const;     void get(Uint32& x) const;
       ///
     void get(Sint32& x) const;     void get(Sint32& x) const;
       ///
     void get(Uint64& x) const;     void get(Uint64& x) const;
       ///
     void get(Sint64& x) const;     void get(Sint64& x) const;
       ///
     void get(Real32& x) const;     void get(Real32& x) const;
       ///
     void get(Real64& x) const;     void get(Real64& x) const;
       ///
     void get(Char16& x) const;     void get(Char16& x) const;
       ///
     void get(String& x) const;     void get(String& x) const;
       ///
     void get(CIMDateTime& x) const;     void get(CIMDateTime& x) const;
       ///
     void get(CIMReference& x) const;     void get(CIMReference& x) const;
       ///
     void get(Array<Boolean>& x) const;     void get(Array<Boolean>& x) const;
       ///
     void get(Array<Uint8>& x) const;     void get(Array<Uint8>& x) const;
       //////
     void get(Array<Sint8>& x) const;     void get(Array<Sint8>& x) const;
       ///
     void get(Array<Uint16>& x) const;     void get(Array<Uint16>& x) const;
       ///
     void get(Array<Sint16>& x) const;     void get(Array<Sint16>& x) const;
       ///
     void get(Array<Uint32>& x) const;     void get(Array<Uint32>& x) const;
       ///
     void get(Array<Sint32>& x) const;     void get(Array<Sint32>& x) const;
       ///
     void get(Array<Uint64>& x) const;     void get(Array<Uint64>& x) const;
       ///
     void get(Array<Sint64>& x) const;     void get(Array<Sint64>& x) const;
       ///
     void get(Array<Real32>& x) const;     void get(Array<Real32>& x) const;
       ///
     void get(Array<Real64>& x) const;     void get(Array<Real64>& x) const;
       ///
     void get(Array<Char16>& x) const;     void get(Array<Char16>& x) const;
       ///
     void get(Array<String>& x) const;     void get(Array<String>& x) const;
       ///
     void get(Array<CIMDateTime>& x) const;     void get(Array<CIMDateTime>& x) const;
  
     /// CIMMethod toXML  - ATTN      /** toXML - Converts a CIMValue object to XML. The XML is appended
           to the Array provided with the call.Returns the result as an
           XML elemet wrapped in the <VALUE> or <ARRAYVALUE> tags. If the
           CIMValue is Null, no element is returned.
           @paramout Sint8 Array to hold the XML representation
           @return Returns the XML representation of the CIMValue
           object in the input parameter out.
       */
     void toXml(Array<Sint8>& out) const;     void toXml(Array<Sint8>& out) const;
  
     /// CIMMethod print - ATTN      /** toXML - Converts a CIMValue object to XML. There is no input
     void print(std::ostream &o=std::cout) const;          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> or ARRAYVALUE tags. If the
           CIMValue is Null, no element is returned.
           @return Returns the XML representation of the CIMValue
           object in String form.
       */
       String toXml() const;
   
       /** CIMMethod print - Format and print the Value as XML to std output
           stream
           @return None
           <PRE>
           Example:
               CIMValue value(Boolean(true));
               value.print();        // Prints "true"
           </PRE>
       */
       void print(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;
  
     /// CIMMethod toString      - ATTN      /** toString - Converts the CIMvalue to a string.  Should only be
               used for output purposes.  To get an actual String value, use
               get(String &).
           @return - String output for CIMValue.
           @exception - Throws exception CIMValueInvalidType if the CIMValue
               has an invalid type. Normally this is a Pegasus internal error.
           <PRE>
           Example:
               String test;
               CIMValue value(Boolean(true));
               test = value.toString();      // puts "TRUE" into test
           </PRE>
           */
     String toString() const;     String toString() const;
  
 private: private:
Line 344 
Line 416 
  
     CIMType _type;     CIMType _type;
     Boolean _isArray;     Boolean _isArray;
       Boolean _isNull;
     Union _u;     Union _u;
  
     friend class CIMMethodRep;     friend class CIMMethodRep;
Line 363 
Line 436 
     return !operator==(x, y);     return !operator==(x, y);
 } }
  
   #define PEGASUS_ARRAY_T CIMValue
   # include "ArrayInter.h"
   #undef PEGASUS_ARRAY_T
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
 #endif /* Pegasus_Value_h */ #endif /* Pegasus_Value_h */


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.13

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2