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