1 karl 1.10 //%2006////////////////////////////////////////////////////////////////////////
|
2 chuck 1.4 //
|
3 karl 1.8 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 chuck 1.4 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.8 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.10 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 chuck 1.4 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 // Authors: David Rosckes (rosckes@us.ibm.com)
33 // Bert Rivero (hurivero@us.ibm.com)
34 chuck 1.4 // Chuck Carmack (carmack@us.ibm.com)
35 // Brian Lucier (lucier@us.ibm.com)
36 //
|
37 vijay.eli 1.9 // Modified By: Vijay Eli, IBM (vijayeli@in.ibm.com) bug#3590
|
38 chuck 1.4 //
39 //%/////////////////////////////////////////////////////////////////////////////
40
|
41 humberto 1.1 #include "CQLFactorRep.h"
42 #include <Pegasus/CQL/CQLExpression.h>
43 #include <Pegasus/CQL/CQLFunction.h>
44 #include <Pegasus/CQL/CQLFactory.h>
45 #include <Pegasus/CQL/CQLValue.h>
|
46 chuck 1.4 #include <Pegasus/Query/QueryCommon/QueryContext.h>
47 #include <Pegasus/Common/Tracer.h>
|
48 humberto 1.1
49 PEGASUS_NAMESPACE_BEGIN
|
50 chuck 1.4
|
51 humberto 1.7 CQLFactorRep::CQLFactorRep():
52 _CQLExp(),
53 _CQLVal(),
54 _CQLFunct(),
55 _invert(false),
56 _simpleValue(false),
57 _containedType(VALUE)
58 {
59
60 }
61
|
62 humberto 1.5 CQLFactorRep::CQLFactorRep(const CQLFactorRep* rep):
63 _CQLExp(rep->_CQLExp),
64 _CQLVal(rep->_CQLVal),
65 _CQLFunct(rep->_CQLFunct),
66 _invert(rep->_invert),
67 _simpleValue(rep->_simpleValue),
68 _containedType(rep->_containedType)
69
|
70 humberto 1.1 {
|
71 humberto 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::CQLFactorRep(const CQLFactorRep* rep)");
|
72 chuck 1.4
73 PEG_METHOD_EXIT();
|
74 humberto 1.1 }
75
|
76 humberto 1.5 CQLFactorRep::CQLFactorRep(const CQLValue& inCQLVal):
77 _CQLExp(),
78 _CQLVal(inCQLVal),
79 _CQLFunct(),
|
80 chuck 1.6 _invert(false),
|
81 humberto 1.5 _simpleValue(true),
82 _containedType(VALUE)
83
|
84 humberto 1.1 {
|
85 humberto 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::CQLFactorRep(const CQLValue& inCQLVal)");
|
86 chuck 1.4
87 PEG_METHOD_EXIT();
|
88 humberto 1.1 }
89
|
90 humberto 1.5 CQLFactorRep::CQLFactorRep(const CQLExpression& inCQLExp):
91 _CQLExp(inCQLExp),
92 _CQLVal(),
93 _CQLFunct(),
|
94 chuck 1.6 _invert(false),
|
95 humberto 1.5 _simpleValue(false),
96 _containedType(EXPRESSION)
|
97 humberto 1.1 {
|
98 humberto 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::CQLFactorRep(const CQLExpression& inCQLExp)");
|
99 chuck 1.4
100 PEG_METHOD_EXIT();
|
101 humberto 1.1 }
102
|
103 humberto 1.5 CQLFactorRep::CQLFactorRep(const CQLFunction& inCQLFunc):
104 _CQLExp(),
105 _CQLVal(),
106 _CQLFunct(inCQLFunc),
|
107 chuck 1.6 _invert(false),
|
108 humberto 1.5 _simpleValue(false),
109 _containedType(FUNCTION)
|
110 humberto 1.1 {
|
111 humberto 1.5 PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::CQLFactorRep(const CQLFunction& inCQLFunc)");
|
112 chuck 1.4
113 PEG_METHOD_EXIT();
|
114 humberto 1.1 }
115
|
116 chuck 1.4 CQLValue CQLFactorRep::getValue()const
|
117 humberto 1.1 {
118 return _CQLVal;
119 }
120
|
121 chuck 1.4 CQLValue CQLFactorRep::resolveValue(const CIMInstance& CI, const QueryContext& QueryCtx)
|
122 humberto 1.1 {
|
123 chuck 1.4 PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::resolveValue()");
|
124 humberto 1.1
|
125 chuck 1.4 if(_containedType == EXPRESSION)
126 {
127 PEG_METHOD_EXIT();
|
128 humberto 1.1 return _CQLExp.resolveValue(CI,QueryCtx);
|
129 chuck 1.4 }
130 else if (_containedType == FUNCTION)
131 {
132 PEG_METHOD_EXIT();
|
133 humberto 1.1 return _CQLFunct.resolveValue(CI,QueryCtx);
|
134 chuck 1.4 }
|
135 humberto 1.5 else if (_containedType == VALUE)
|
136 chuck 1.4 {
|
137 humberto 1.1 _CQLVal.resolve(CI,QueryCtx);
|
138 chuck 1.4 PEG_METHOD_EXIT();
|
139 humberto 1.1 return _CQLVal;
|
140 chuck 1.4 }
|
141 humberto 1.5 else
142 {
143 MessageLoaderParms msg("CQL.CQLFactorRep.FACTOR_HAS_NO_TYPE",
144 "The CQLFactor was constructed without a type.");
145 throw CQLRuntimeException(msg);
146 }
|
147 humberto 1.1 }
148
|
149 chuck 1.4 Boolean CQLFactorRep::isSimple()const
|
150 humberto 1.1 {
151 return _simpleValue;
152 }
153
|
154 chuck 1.4 Boolean CQLFactorRep::isSimpleValue()const
155 {
156 return _simpleValue;
157 }
158
159 CQLFunction CQLFactorRep::getCQLFunction()const
|
160 humberto 1.1 {
161 return _CQLFunct;
162 }
163
|
164 chuck 1.4 CQLExpression CQLFactorRep::getCQLExpression()const
|
165 humberto 1.1 {
166 return _CQLExp;
167 }
168
|
169 chuck 1.4 String CQLFactorRep::toString()const
|
170 humberto 1.1 {
|
171 chuck 1.4 PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::toString()");
172
173 if(_containedType == VALUE)
174 {
175 PEG_METHOD_EXIT();
176 return _CQLVal.toString();
177 }
178
179 if(_containedType == FUNCTION)
180 {
181 PEG_METHOD_EXIT();
|
182 humberto 1.1 return _CQLFunct.toString();
|
183 chuck 1.4 }
|
184 humberto 1.5 if (_containedType == EXPRESSION)
|
185 chuck 1.4 {
186 PEG_METHOD_EXIT();
|
187 humberto 1.1 return _CQLExp.toString();
|
188 chuck 1.4 }
|
189 humberto 1.5 return String("");
|
190 humberto 1.1 }
191
|
192 vijay.eli 1.9 void CQLFactorRep::applyContext(const QueryContext& inContext,
193 const CQLChainedIdentifier& inCid)
|
194 humberto 1.1 {
|
195 chuck 1.4 PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::applyContext()");
196
197 if(_containedType == FUNCTION)
198 {
199 _CQLFunct.applyContext(inContext);
200 }
201 else if(_containedType == EXPRESSION)
202 {
203 _CQLExp.applyContext(inContext);
204 }
|
205 humberto 1.5 else if(_containedType == VALUE)
|
206 chuck 1.4 {
207 _CQLVal.applyContext(inContext,inCid);
208 }
|
209 humberto 1.5 else
210 {
211 MessageLoaderParms msg("CQL.CQLFactorRep.FACTOR_HAS_NO_TYPE",
212 "The CQLFactor was constructed without a type.");
213 throw CQLRuntimeException(msg);
214 }
|
215 chuck 1.4
216 PEG_METHOD_EXIT();
217 return;
218 }
|
219 humberto 1.5 /*
|
220 chuck 1.4 Boolean CQLFactorRep::operator==(const CQLFactorRep& rep)const
221 {
222 PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::operator==()");
223
224 if(_CQLExp != rep._CQLExp)
225 {
226 PEG_METHOD_EXIT();
227 return false;
228 }
229 if(CQLValue(_CQLVal) != rep._CQLVal) // Why?
230 {
231 PEG_METHOD_EXIT();
232 return false;
233 }
234 if(_CQLFunct != rep._CQLFunct)
235 {
236 PEG_METHOD_EXIT();
237 return false;
238 }
239 if(_invert != rep._invert)
240 {
241 chuck 1.4 PEG_METHOD_EXIT();
242 return false;
243 }
244 if(_simpleValue != rep._simpleValue)
245 {
246 PEG_METHOD_EXIT();
247 return false;
248 }
249 if(_containedType != rep._containedType)
250 {
251 PEG_METHOD_EXIT();
252 return false;
253 }
254
255 PEG_METHOD_EXIT();
256 return true;
|
257 humberto 1.1 }
258
|
259 chuck 1.4 Boolean CQLFactorRep::operator!=(const CQLFactorRep& rep)const
260 {
261 return (!operator==(rep));
|
262 humberto 1.1 }
|
263 humberto 1.5 */
|
264 humberto 1.1 PEGASUS_NAMESPACE_END
|