1 martin 1.6 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.7 //
|
3 martin 1.6 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.7 //
|
10 martin 1.6 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.7 //
|
17 martin 1.6 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.7 //
|
20 martin 1.6 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.7 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.6 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.7 //
|
28 martin 1.6 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include "WQLInstancePropertySource.h"
33 #include <Pegasus/Common/CIMName.h>
34 #include <Pegasus/Common/CIMInstance.h>
35
36 PEGASUS_NAMESPACE_BEGIN
37
38 Boolean WQLInstancePropertySource::getValue(
|
39 karl 1.5 const CIMName& propertyName,
40 WQLOperand& value) const
|
41 schuur 1.1 {
42 unsigned int pos=ci.findProperty(propertyName);
43 if (pos==PEG_NOT_FOUND) return false;
44
45 CIMValue val=ci.getProperty(pos).getValue();
46 CIMType type=val.getType();
47
|
48 karl 1.5 if (val.isNull())
49 {
|
50 schuur 1.1 value=WQLOperand();
51 return true;
52 }
53 if (val.isArray()) return false;
54
|
55 karl 1.5 switch (type)
56 {
57 case CIMTYPE_UINT8:
58 Uint8 propertyValueUint8;
59 val.get(propertyValueUint8);
60 value=WQLOperand(propertyValueUint8,WQL_INTEGER_VALUE_TAG);
61 break;
62
63 case CIMTYPE_UINT16:
64 Uint16 propertyValueUint16;
65 val.get(propertyValueUint16);
66 value=WQLOperand(propertyValueUint16, WQL_INTEGER_VALUE_TAG);
67 break;
68
69 case CIMTYPE_UINT32:
70 Uint32 propertyValueUint32;
71 val.get(propertyValueUint32);
72 value=WQLOperand(propertyValueUint32, WQL_INTEGER_VALUE_TAG);
73 break;
74
75 case CIMTYPE_UINT64:
76 karl 1.5 Uint64 propertyValueUint64;
77 val.get(propertyValueUint64);
78 value=WQLOperand(propertyValueUint64, WQL_INTEGER_VALUE_TAG);
79 break;
80
81 case CIMTYPE_SINT8:
82 Sint8 propertyValueSint8;
83 val.get(propertyValueSint8);
84 value=WQLOperand(propertyValueSint8, WQL_INTEGER_VALUE_TAG);
85 break;
86
87 case CIMTYPE_SINT16:
88 Sint16 propertyValueSint16;
89 val.get(propertyValueSint16);
90 value=WQLOperand(propertyValueSint16, WQL_INTEGER_VALUE_TAG);
91 break;
92
93 case CIMTYPE_SINT32:
94 Sint32 propertyValueSint32;
95 val.get(propertyValueSint32);
96 value=WQLOperand(propertyValueSint32, WQL_INTEGER_VALUE_TAG);
97 karl 1.5 break;
98
99 case CIMTYPE_SINT64:
100 Sint64 propertyValueSint64;
101 val.get(propertyValueSint64);
102 value=WQLOperand(propertyValueSint64, WQL_INTEGER_VALUE_TAG);
103 break;
104
105 case CIMTYPE_REAL32:
106 Real32 propertyValueReal32;
107 val.get(propertyValueReal32);
108 value=WQLOperand(propertyValueReal32, WQL_DOUBLE_VALUE_TAG);
109 break;
110
111 case CIMTYPE_REAL64:
112 Real64 propertyValueReal64;
113 val.get(propertyValueReal64);
114 value=WQLOperand(propertyValueReal64, WQL_DOUBLE_VALUE_TAG);
115 break;
116
117 case CIMTYPE_BOOLEAN :
118 karl 1.5 Boolean booleanValue;
119 val.get(booleanValue);
120 value=WQLOperand(booleanValue, WQL_BOOLEAN_VALUE_TAG);
121 break;
122
123 case CIMTYPE_CHAR16:
124 case CIMTYPE_DATETIME :
125 case CIMTYPE_STRING :
126 {
127 String strValue;
128 val.get(strValue);
129 value=WQLOperand(strValue,WQL_STRING_VALUE_TAG);
130 break;
131 }
132 default: return false;
|
133 schuur 1.1 }
134 return true;
|
135 karl 1.5 }
|
136 schuur 1.1
137 PEGASUS_NAMESPACE_END
|