/usr/src/startcom/BUILD/pegasus/src/Pegasus/Common/CIMValue.h

00001 //%LICENSE////////////////////////////////////////////////////////////////
00002 //
00003 // Licensed to The Open Group (TOG) under one or more contributor license
00004 // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
00005 // this work for additional information regarding copyright ownership.
00006 // Each contributor licenses this file to you under the OpenPegasus Open
00007 // Source License; you may not use this file except in compliance with the
00008 // License.
00009 //
00010 // Permission is hereby granted, free of charge, to any person obtaining a
00011 // copy of this software and associated documentation files (the "Software"),
00012 // to deal in the Software without restriction, including without limitation
00013 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00014 // and/or sell copies of the Software, and to permit persons to whom the
00015 // Software is furnished to do so, subject to the following conditions:
00016 //
00017 // The above copyright notice and this permission notice shall be included
00018 // in all copies or substantial portions of the Software.
00019 //
00020 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00021 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00022 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00023 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00024 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00025 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00026 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00027 //
00029 //
00030 //%/////////////////////////////////////////////////////////////////////////////
00031 
00032 #ifndef Pegasus_Value_h
00033 #define Pegasus_Value_h
00034 
00035 #include <Pegasus/Common/String.h>
00036 #include <Pegasus/Common/Config.h>
00037 #include <Pegasus/Common/CIMType.h>
00038 #include <Pegasus/Common/CIMObjectPath.h>
00039 #include <Pegasus/Common/CIMObject.h>
00040 #include <Pegasus/Common/CIMDateTime.h>
00041 #include <Pegasus/Common/Exception.h>
00042 #include <Pegasus/Common/Array.h>
00043 #include <Pegasus/Common/Linkage.h>
00044 
00045 PEGASUS_NAMESPACE_BEGIN
00046 
00047 class CIMValueRep;
00048 class CIMObject;
00049 class CIMInstance;
00050 
00056 class PEGASUS_COMMON_LINKAGE CIMValue
00057 {
00058 public:
00062     CIMValue();
00063 
00073     CIMValue(CIMType type, Boolean isArray, Uint32 arraySize = 0);
00074 
00079     CIMValue(Boolean x);
00080 
00085     CIMValue(Uint8 x);
00086 
00091     CIMValue(Sint8 x);
00092 
00097     CIMValue(Uint16 x);
00098 
00103     CIMValue(Sint16 x);
00104 
00109     CIMValue(Uint32 x);
00110 
00115     CIMValue(Sint32 x);
00116 
00121     CIMValue(Uint64 x);
00122 
00127     CIMValue(Sint64 x);
00128 
00133     CIMValue(Real32 x);
00134 
00139     CIMValue(Real64 x);
00140 
00145     CIMValue(const Char16& x);
00146 
00151     CIMValue(const String& x);
00152 
00157     CIMValue(const CIMDateTime& x);
00158 
00163     CIMValue(const CIMObjectPath& x);
00164 
00173     CIMValue(const CIMObject& x);
00174 
00183     CIMValue(const CIMInstance& x);
00184 
00189     CIMValue(const Array<Boolean>& x);
00190 
00195     CIMValue(const Array<Uint8>& x);
00196 
00201     CIMValue(const Array<Sint8>& x);
00202 
00207     CIMValue(const Array<Uint16>& x);
00208 
00213     CIMValue(const Array<Sint16>& x);
00214 
00219     CIMValue(const Array<Uint32>& x);
00220 
00225     CIMValue(const Array<Sint32>& x);
00226 
00231     CIMValue(const Array<Uint64>& x);
00232 
00237     CIMValue(const Array<Sint64>& x);
00238 
00243     CIMValue(const Array<Real32>& x);
00244 
00249     CIMValue(const Array<Real64>& x);
00250 
00255     CIMValue(const Array<Char16>& x);
00256 
00261     CIMValue(const Array<String>& x);
00262 
00267     CIMValue(const Array<CIMDateTime>& x);
00268 
00273     CIMValue(const Array<CIMObjectPath>& x);
00274 
00283     CIMValue(const Array<CIMObject>& x);
00284 
00293     CIMValue(const Array<CIMInstance>& x);
00294 
00302     CIMValue(const CIMValue& x);
00303 
00307     ~CIMValue();
00308 
00317     CIMValue& operator=(const CIMValue& x);
00318 
00326     void assign(const CIMValue& x);
00327 
00331     void clear();
00332 
00339     Boolean typeCompatible(const CIMValue& x) const;
00340 
00345     Boolean isArray() const;
00346 
00352     Boolean isNull() const;
00353 
00359     Uint32 getArraySize() const;
00360 
00365     CIMType getType() const;
00366 
00375     void setNullValue(CIMType type, Boolean isArray, Uint32 arraySize = 0);
00376 
00381     void set(Boolean x);
00382 
00387     void set(Uint8 x);
00388 
00393     void set(Sint8 x);
00394 
00399     void set(Uint16 x);
00400 
00405     void set(Sint16 x);
00406 
00411     void set(Uint32 x);
00412 
00417     void set(Sint32 x);
00418 
00423     void set(Uint64 x);
00424 
00429     void set(Sint64 x);
00430 
00435     void set(Real32 x);
00436 
00441     void set(Real64 x);
00442 
00447     void set(const Char16& x);
00448 
00453     void set(const String& x);
00454 
00459     void set(const CIMDateTime& x);
00460 
00465     void set(const CIMObjectPath& x);
00466 
00475     void set(const CIMObject& x);
00476 
00485     void set(const CIMInstance& x);
00486 
00491     void set(const Array<Boolean>& x);
00492 
00497     void set(const Array<Uint8>& x);
00498 
00503     void set(const Array<Sint8>& x);
00504 
00509     void set(const Array<Uint16>& x);
00510 
00515     void set(const Array<Sint16>& x);
00516 
00521     void set(const Array<Uint32>& x);
00522 
00527     void set(const Array<Sint32>& x);
00528 
00533     void set(const Array<Uint64>& x);
00534 
00539     void set(const Array<Sint64>& x);
00540 
00545     void set(const Array<Real32>& x);
00546 
00551     void set(const Array<Real64>& x);
00552 
00557     void set(const Array<Char16>& x);
00558 
00563     void set(const Array<String>& x);
00564 
00569     void set(const Array<CIMDateTime>& x);
00570 
00575     void set(const Array<CIMObjectPath>& x);
00576 
00585     void set(const Array<CIMObject>& x);
00586 
00595     void set(const Array<CIMInstance>& x);
00596 
00605     void get(Boolean& x) const;
00606 
00615     void get(Uint8& x) const;
00616 
00625     void get(Sint8& x) const;
00626 
00635     void get(Uint16& x) const;
00636 
00645     void get(Sint16& x) const;
00646 
00661     void get(Uint32& x) const;
00662 
00671     void get(Sint32& x) const;
00672 
00681     void get(Uint64& x) const;
00682 
00691     void get(Sint64& x) const;
00692 
00701     void get(Real32& x) const;
00702 
00711     void get(Real64& x) const;
00712 
00721     void get(Char16& x) const;
00722 
00731     void get(String& x) const;
00732 
00741     void get(CIMDateTime& x) const;
00742 
00751     void get(CIMObjectPath& x) const;
00752 
00761     void get(CIMObject& x) const;
00762 
00771     void get(CIMInstance& x) const;
00772 
00781     void get(Array<Boolean>& x) const;
00782 
00791     void get(Array<Uint8>& x) const;
00792 
00801     void get(Array<Sint8>& x) const;
00802 
00811     void get(Array<Uint16>& x) const;
00812 
00821     void get(Array<Sint16>& x) const;
00822 
00831     void get(Array<Uint32>& x) const;
00832 
00841     void get(Array<Sint32>& x) const;
00842 
00851     void get(Array<Uint64>& x) const;
00852 
00861     void get(Array<Sint64>& x) const;
00862 
00871     void get(Array<Real32>& x) const;
00872 
00881     void get(Array<Real64>& x) const;
00882 
00891     void get(Array<Char16>& x) const;
00892 
00901     void get(Array<String>& x) const;
00902 
00911     void get(Array<CIMDateTime>& x) const;
00912 
00921     void get(Array<CIMObjectPath>& x) const;
00922 
00931     void get(Array<CIMObject>& x) const;
00932 
00941     void get(Array<CIMInstance>& x) const;
00942 
00949     Boolean equal(const CIMValue& x) const;
00950 
00957     String toString() const;
00958 
00959 #ifdef PEGASUS_USE_DEPRECATED_INTERFACES
00960 
00967     CIMValue(char x);
00968 
00976     CIMValue(const Array<char>& x);
00977 
00985     void set(char x);
00986 
00994     void set(const Array<char>& x);
00995 
01005     void get(char& x) const;
01006 
01016     void get(Array<char>& x) const;
01017 #endif
01018 
01019 private:
01020 
01021     void _get(const String*& data, Uint32& size) const;
01022 
01023     CIMValueRep* _rep;
01024 
01025     friend class CIMMethodRep;
01026     friend class CIMParameterRep;
01027     friend class CIMPropertyRep;
01028     friend class CIMQualifierRep;
01029     friend class CIMQualifierDeclRep;
01030     friend class BinaryStreamer;
01031     friend class XmlWriter;
01032     friend class SCMOClass;
01033     friend class SCMOInstance;
01034 };
01035 
01043 PEGASUS_COMMON_LINKAGE Boolean operator==(const CIMValue& x, const CIMValue& y);
01044 
01052 PEGASUS_COMMON_LINKAGE Boolean operator!=(const CIMValue& x, const CIMValue& y);
01053 
01054 #define PEGASUS_ARRAY_T CIMValue
01055 # include <Pegasus/Common/ArrayInter.h>
01056 #undef PEGASUS_ARRAY_T
01057 
01058 PEGASUS_NAMESPACE_END
01059 
01060 #ifdef PEGASUS_INTERNALONLY
01061 #include <Pegasus/Common/CIMValueInline.h>
01062 #endif
01063 
01064 #endif /* Pegasus_Value_h */