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

  1 mike  1.9 //%/////////////////////////////////////////////////////////////////////////////
  2           //
  3           // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  4           //
  5           // Permission is hereby granted, free of charge, to any person obtaining a copy
  6           // of this software and associated documentation files (the "Software"), to 
  7           // deal in the Software without restriction, including without limitation the 
  8           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
  9           // sell copies of the Software, and to permit persons to whom the Software is
 10           // furnished to do so, subject to the following conditions:
 11           // 
 12           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 13           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 14           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 15           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 16           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 17           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 18           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 19           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 20           //
 21           //==============================================================================
 22 mike  1.9 //
 23           // Author: Mike Brasher (mbrasher@bmc.com)
 24           //
 25           // Modified By:
 26 ramnath 1.13 //         Ramnath Ravindran (Ramnath.Ravindran@compaq.com)
 27 mike    1.9  //
 28              //%/////////////////////////////////////////////////////////////////////////////
 29              
 30              /*
 31               CIMType.h - This file defines the CIMType enumeration which introduces
 32              symbolic constants for the CIM data types.
 33              */
 34              
 35              #ifndef Pegasus_Type_h
 36              #define Pegasus_Type_h
 37              
 38              #include <Pegasus/Common/Config.h>
 39              
 40              PEGASUS_NAMESPACE_BEGIN
 41              
 42              /**
 43                  The CIMType Class defines the CIMType enumeration which introduces
 44                  symbolic constants for the CIM data types.
 45              
 46                  The table below shows each CIM type, its symbolic constant, and its
 47                  representation type.
 48 mike    1.9  
 49                  <pre>
 50 mike    1.10 	    CIM CIMType	Constant	        C++ CIMType
 51 mike    1.9  	    -------------------------------------------------------
 52              	    boolean	CIMType::BOOLEAN	Boolean
 53              	    uint8	CIMType::UINT8		Uint8
 54              	    sint8	CIMType::SINT8		Sint8
 55              	    uint16	CIMType::UINT16		Uint16
 56              	    sint16	CIMType::SINT16		Sint16
 57              	    uint32	CIMType::UINT32		Uint32
 58              	    sint32	CIMType::SINT32		Sint32
 59              	    uint64	CIMType::UINT64		Sint64
 60              	    sint64	CIMType::SINT64		Sint64
 61              	    real32	CIMType::REAL32		Real32
 62              	    real64	CIMType::REAL64		Real64
 63              	    char16	CIMType::CHAR16		Char16
 64              	    string	CIMType::STRING		String
 65              	    datetime	CIMType::DATETIME	CIMDateTime
 66              	    reference	CIMType::REFERENCE	CIMReference
 67              
 68                  </pre>
 69              */
 70              class PEGASUS_COMMON_LINKAGE CIMType
 71              {
 72 mike    1.9  public:
 73              
 74                  enum Tag
 75                  {
 76              	NONE,
 77              	BOOLEAN,
 78              	UINT8,
 79              	SINT8,
 80              	UINT16,
 81              	SINT16,
 82              	UINT32,
 83              	SINT32,
 84              	UINT64,
 85              	SINT64,
 86              	REAL32,
 87              	REAL64,
 88              	CHAR16,
 89              	STRING,
 90              	DATETIME,
 91              	REFERENCE
 92                  };
 93 mike    1.9  
 94 karl    1.12     /// Constructor
 95 mike    1.9      CIMType() : _tag(NONE) { }
 96              
 97 karl    1.12     ///  Constructor
 98 mike    1.9      CIMType(Tag tag) : _tag(tag) { }
 99              
100 karl    1.12     /// Constructor
101 mike    1.9      PEGASUS_EXPLICIT CIMType(Uint32 tag) : _tag(Tag(tag)) { }
102              
103 karl    1.12     ///  Constructor
104 mike    1.9      CIMType(const CIMType& x) : _tag(x._tag) { }
105              
106 karl    1.12     /// operator =
107 mike    1.9      CIMType& operator=(Tag tag) { _tag = tag; return *this; }
108              
109 karl    1.12     /// 
110 mike    1.9      operator Tag() const { return _tag; }
111              
112 karl    1.12     ///
113 mike    1.9      Boolean equal(const CIMType& x) const { return x._tag == _tag; }
114              
115              private:
116              
117                  Tag _tag;
118              };
119              
120              inline Boolean operator==(CIMType x, CIMType y)
121              {
122                  return CIMType::Tag(x) == CIMType::Tag(y);
123              }
124              
125              inline Boolean operator!=(CIMType x, CIMType y)
126              {
127                  return !operator==(x, y);
128              }
129              
130              // ATTN: this doesn't seem necessary!
131              
132              inline Boolean operator==(CIMType x, CIMType::Tag y)
133              {
134 mike    1.9      return x.equal(y);
135              }
136              
137              inline Boolean operator==(CIMType::Tag x, CIMType y)
138              {
139                  return y.equal(x);
140              }
141              
142              inline Boolean operator!=(CIMType x, CIMType::Tag y)
143              {
144                  return !operator==(x, y);
145              }
146              
147              inline Boolean operator!=(CIMType::Tag x, CIMType y)
148              {
149                  return !operator==(x, y);
150              }
151              
152 sage    1.11 inline Boolean operator==(CIMType::Tag x, CIMType::Tag y)
153              {
154 ramnath 1.13 	//not supported on Tru64
155 sage    1.11 	return x == y;
156 ramnath 1.13 
157              #ifdef PEGASUS_PLATFORM_TRU64_ALPHA_DECCXX
158              	return operator==(x, y);
159              #endif
160 sage    1.11 }
161              
162 mike    1.9  // Returns a string representation of the given type. The string
163              // is the same as the "CIM CIMType" column in the table above.
164              
165              PEGASUS_COMMON_LINKAGE const char* TypeToString(CIMType type);
166              
167              PEGASUS_NAMESPACE_END
168              
169              #endif /* Pegasus_Type_h */
170              

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2