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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2