1 martin 1.12 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.13 //
|
3 martin 1.12 // 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.13 //
|
10 martin 1.12 // 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.13 //
|
17 martin 1.12 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.13 //
|
20 martin 1.12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.13 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.12 // 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.13 //
|
28 martin 1.12 //////////////////////////////////////////////////////////////////////////
|
29 chuck 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
|
32 david.dillard 1.7 #ifndef Pegasus_CQLSimplePredicate_h
|
33 chuck 1.2 #define Pegasus_CQLSimplePredicate_h
34
35 #include <Pegasus/CQL/Linkage.h>
36 #include <Pegasus/Common/CIMInstance.h>
37 #include <Pegasus/Query/QueryCommon/QueryContext.h>
38
39 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
40
41 PEGASUS_NAMESPACE_BEGIN
42
|
43 mike 1.10 class CQLExpression;
44 class CQLFactory;
45 class CQLSimplePredicateRep;
|
46 chuck 1.2
|
47 kumpf 1.14 enum ExpressionOpType { LT, GT, EQ, LE, GE, NE, IS_NULL,
|
48 karl 1.11 IS_NOT_NULL, ISA, LIKE, NOOP };
|
49 chuck 1.2
|
50 david.dillard 1.7
51 /**
|
52 humberto 1.3 The CQLSimplePredicate class contains an arithmetic or string
53 expression that produces a boolean result.
|
54 david.dillard 1.7
|
55 humberto 1.3 <PRE>
56 The CQLSimplePredicate is non-simple if it contains a
57 left-side and right-side CQLExpression.
58 Example: a CQLSimplePredicate representing a < b would contain
59 a left-side CQLExpression representing (a), a < operator,
|
60 david.dillard 1.7 and a right-side CQLExpression representing (b).
|
61 humberto 1.3
62 The CQLSimplePredicate is simple if it contains just a left-side
63 CQLExpression and an operator.
64 Example: a IS NULL
65 </PRE>
66 */
|
67 karl 1.11
|
68 konrad.r 1.6 class PEGASUS_CQL_LINKAGE CQLSimplePredicate
|
69 chuck 1.2 {
70 public:
|
71 humberto 1.3 /**
72 Default constructor
73
74 @param - None.
75 @return - None.
76 @throws - None.
77 <I><B>Experimental Interface</B></I><BR>
78 */
|
79 chuck 1.2 CQLSimplePredicate();
80
|
81 humberto 1.3 /**
82 Constructor. Using this constructor sets isSimple() to true.
|
83 david.dillard 1.7
|
84 humberto 1.3 @param - inExpression.
85 @return - None.
86 @throws - None.
87 <I><B>Experimental Interface</B></I><BR>
|
88 david.dillard 1.7 */
|
89 chuck 1.2 CQLSimplePredicate(const CQLExpression& inExpression);
90
|
91 humberto 1.3 /**
92 Constructor. Using this constructor sets isSimple() to true.
|
93 david.dillard 1.7
|
94 humberto 1.3 @param - inExpression.
95 @param - inOperator The unary operator.
96 @return - None.
97 @throws - None.
98 <I><B>Experimental Interface</B></I><BR>
|
99 david.dillard 1.7 */
100 CQLSimplePredicate(const CQLExpression& inExpression,
101 ExpressionOpType inOperator);
|
102 chuck 1.2
|
103 humberto 1.3 /**
|
104 david.dillard 1.7 Constructor.
105
|
106 humberto 1.3 @param - leftSideExpression.
107 @param - rightSideExpression.
108 @param - inOperator The binary operator.
109 @return - None.
110 @throws - None.
111 <I><B>Experimental Interface</B></I><BR>
|
112 david.dillard 1.7 */
113 CQLSimplePredicate(const CQLExpression& leftSideExpression,
114 const CQLExpression& rightSideExpression,
115 ExpressionOpType inOperator);
|
116 chuck 1.2
|
117 humberto 1.3 /**
|
118 david.dillard 1.7 Copy Constructor.
119
|
120 humberto 1.3 @param - inSimplePredicate. Object to copy.
121 @return - None.
122 @throws - None.
123 <I><B>Experimental Interface</B></I><BR>
|
124 david.dillard 1.7 */
|
125 chuck 1.2 CQLSimplePredicate(const CQLSimplePredicate& inSimplePredicate);
126
|
127 humberto 1.3 /**
|
128 david.dillard 1.7 Destructor.
129
|
130 humberto 1.3 <I><B>Experimental Interface</B></I><BR>
|
131 david.dillard 1.7 */
|
132 chuck 1.2 ~CQLSimplePredicate();
133
|
134 david.dillard 1.7 /**
|
135 humberto 1.3 Evaluates this predicate, using a CIMInstance as a property source.
136
137 <PRE>
138 The CQLSimplePredicate is non-simple if it contains left and
139 right side expressions. A non-simple CQLSimplePredicate is evaluated
140 by in turn evaluating the contained CQLExpressions and then applying
141 the operator.
142
143 For the evaluate method on each CQLExpression, the CQLExpression is
|
144 david.dillard 1.7 resolved to a CQLValue and the value is then applied to the operator.
145
|
146 karl 1.11 The CQLSimplePredicate is simple if it contains only a left-side
147 CQLExpression.
148 A simple CQLSimplePredicate is evaluated by resolving the
149 CQLExpression into a CQLValue and then applying the operator.
|
150 humberto 1.3 </PRE>
151
152 @param - CI. Instance to evaluate query against.
153 @param - QueryCtx. Query Context
154 @return - Boolean.
155 @throws - None.
|
156 david.dillard 1.7 <I><B>Experimental Interface</B></I><BR>
|
157 humberto 1.3 */
|
158 chuck 1.2 Boolean evaluate(CIMInstance CI, QueryContext& QueryCtx);
159
|
160 humberto 1.3 /**
|
161 david.dillard 1.7 Returns the left-side expression.
162
|
163 humberto 1.3 @return - left-side expresson
164 @throws - None.
165 <I><B>Experimental Interface</B></I><BR>
|
166 david.dillard 1.7 */
|
167 chuck 1.2 CQLExpression getLeftExpression()const;
168
|
169 humberto 1.3 /**
|
170 david.dillard 1.7 Returns the right-side expression.
171
|
172 humberto 1.3 @return - right-side expresson
173 @throws - None.
174 <I><B>Experimental Interface</B></I><BR>
|
175 david.dillard 1.7 */
|
176 chuck 1.2 CQLExpression getRightExpression()const;
177
|
178 humberto 1.3 /**
|
179 david.dillard 1.7 Returns the operator.
180
|
181 humberto 1.3 @return - operator for the expressions
182 @throws - None.
183 <I><B>Experimental Interface</B></I><BR>
|
184 david.dillard 1.7 */
185 ExpressionOpType getOperation()const;
|
186 chuck 1.2
|
187 humberto 1.3 /**
|
188 david.dillard 1.7 Sets the operator.
189
|
190 humberto 1.3 @param - op The operator to set.
191 @return - None
192 @throws - None.
193 <I><B>Experimental Interface</B></I><BR>
|
194 david.dillard 1.7 */
|
195 humberto 1.3 void setOperation(ExpressionOpType op);
196
197 /**
|
198 karl 1.11 This method normalizes the CQLChainedIdentifier so that properties
199 that require scoping are scoped.
|
200 humberto 1.3
201 @param - queryContext.
202 @return - None.
203 @throws - None.
204 <I><B>Experimental Interface</B></I><BR>
205 */
|
206 vijay.eli 1.8 void applyContext(const QueryContext& queryContext);
|
207 chuck 1.2
|
208 humberto 1.3 /**
209 Returns this predicate in string form.
|
210 david.dillard 1.7
|
211 humberto 1.3 @param - None.
212 @return - string form of predicate.
213 @throws - None.
214 <I><B>Experimental Interface</B></I><BR>
215 */
|
216 chuck 1.2 String toString()const;
217
|
218 humberto 1.3 /**
|
219 karl 1.11 Returns true if this CQLSimplePredicate only has a left-side
220 CQLExpression.
|
221 humberto 1.3
222 @param - None.
223 @return - Boolean.
224 @throws - None.
225 I><B>Experimental Interface</B></I><BR>
226 */
|
227 chuck 1.2 Boolean isSimple()const;
228
|
229 humberto 1.3 /**
230 Returns true if this CQLSimplePredicate is simple, and
231 the left-side CQLExpression only contains a CQLValue.
|
232 david.dillard 1.7
|
233 humberto 1.3 @param - None.
234 return - Boolean.
235 @throws - None.
236 <I><B>Experimental Interface</B></I><BR>
237 */
|
238 chuck 1.2 Boolean isSimpleValue()const;
239
|
240 humberto 1.3 /**
241 Assignment operator.
|
242 david.dillard 1.7
|
243 humberto 1.3 @param - rhs. Object to assign to this object.
244 return - This object after assignment.
245 @throws - None.
246 <I><B>Experimental Interface</B></I><BR>
247 */
|
248 chuck 1.2 CQLSimplePredicate& operator=(const CQLSimplePredicate& rhs);
249
250 friend class CQLFactory;
251 private:
252 CQLSimplePredicateRep *_rep;
253
254 };
255 PEGASUS_NAMESPACE_END
256 #endif
|
257 david.dillard 1.7 #endif
|