1 karl 1.5 //%2005////////////////////////////////////////////////////////////////////////
|
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 chuck 1.2 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
13 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
|
18 david.dillard 1.7 //
|
19 chuck 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Authors: David Rosckes (rosckes@us.ibm.com)
31 // Bert Rivero (hurivero@us.ibm.com)
32 // Chuck Carmack (carmack@us.ibm.com)
|
33 david.dillard 1.7 // Brian Lucier (lucier@us.ibm.com)
|
34 chuck 1.2 //
35 // Modified By:
36 //
37 //%/////////////////////////////////////////////////////////////////////////////
38
|
39 david.dillard 1.7 #ifndef Pegasus_CQLSimplePredicate_h
|
40 chuck 1.2 #define Pegasus_CQLSimplePredicate_h
41
42 #include <Pegasus/CQL/Linkage.h>
43 #include <Pegasus/Common/CIMInstance.h>
44 #include <Pegasus/Query/QueryCommon/QueryContext.h>
45
46 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
47
48 PEGASUS_NAMESPACE_BEGIN
49
50 class PEGASUS_CQL_LINKAGE CQLExpression;
51 class PEGASUS_CQL_LINKAGE CQLFactory;
52 class PEGASUS_CQL_LINKAGE CQLSimplePredicateRep;
53
|
54 humberto 1.4 enum ExpressionOpType { LT, GT, EQ, LE, GE, NE, IS_NULL, IS_NOT_NULL, ISA, LIKE, NOOP };
|
55 chuck 1.2
|
56 david.dillard 1.7
57 /**
|
58 humberto 1.3 The CQLSimplePredicate class contains an arithmetic or string
59 expression that produces a boolean result.
|
60 david.dillard 1.7
|
61 humberto 1.3 <PRE>
62 The CQLSimplePredicate is non-simple if it contains a
63 left-side and right-side CQLExpression.
64 Example: a CQLSimplePredicate representing a < b would contain
65 a left-side CQLExpression representing (a), a < operator,
|
66 david.dillard 1.7 and a right-side CQLExpression representing (b).
|
67 humberto 1.3
68 The CQLSimplePredicate is simple if it contains just a left-side
69 CQLExpression and an operator.
70 Example: a IS NULL
71 </PRE>
72 */
|
73 konrad.r 1.6 class PEGASUS_CQL_LINKAGE CQLSimplePredicate
|
74 chuck 1.2 {
75 public:
|
76 humberto 1.3 /**
77 Default constructor
78
79 @param - None.
80 @return - None.
81 @throws - None.
82 <I><B>Experimental Interface</B></I><BR>
83 */
|
84 chuck 1.2 CQLSimplePredicate();
85
|
86 humberto 1.3 /**
87 Constructor. Using this constructor sets isSimple() to true.
|
88 david.dillard 1.7
|
89 humberto 1.3 @param - inExpression.
90 @return - None.
91 @throws - None.
92 <I><B>Experimental Interface</B></I><BR>
|
93 david.dillard 1.7 */
|
94 chuck 1.2 CQLSimplePredicate(const CQLExpression& inExpression);
95
|
96 humberto 1.3 /**
97 Constructor. Using this constructor sets isSimple() to true.
|
98 david.dillard 1.7
|
99 humberto 1.3 @param - inExpression.
100 @param - inOperator The unary operator.
101 @return - None.
102 @throws - None.
103 <I><B>Experimental Interface</B></I><BR>
|
104 david.dillard 1.7 */
105 CQLSimplePredicate(const CQLExpression& inExpression,
106 ExpressionOpType inOperator);
|
107 chuck 1.2
|
108 humberto 1.3 /**
|
109 david.dillard 1.7 Constructor.
110
|
111 humberto 1.3 @param - leftSideExpression.
112 @param - rightSideExpression.
113 @param - inOperator The binary operator.
114 @return - None.
115 @throws - None.
116 <I><B>Experimental Interface</B></I><BR>
|
117 david.dillard 1.7 */
118 CQLSimplePredicate(const CQLExpression& leftSideExpression,
119 const CQLExpression& rightSideExpression,
120 ExpressionOpType inOperator);
|
121 chuck 1.2
|
122 humberto 1.3 /**
|
123 david.dillard 1.7 Copy Constructor.
124
|
125 humberto 1.3 @param - inSimplePredicate. Object to copy.
126 @return - None.
127 @throws - None.
128 <I><B>Experimental Interface</B></I><BR>
|
129 david.dillard 1.7 */
|
130 chuck 1.2 CQLSimplePredicate(const CQLSimplePredicate& inSimplePredicate);
131
|
132 humberto 1.3 /**
|
133 david.dillard 1.7 Destructor.
134
|
135 humberto 1.3 <I><B>Experimental Interface</B></I><BR>
|
136 david.dillard 1.7 */
|
137 chuck 1.2 ~CQLSimplePredicate();
138
|
139 david.dillard 1.7 /**
|
140 humberto 1.3 Evaluates this predicate, using a CIMInstance as a property source.
141
142 <PRE>
143 The CQLSimplePredicate is non-simple if it contains left and
144 right side expressions. A non-simple CQLSimplePredicate is evaluated
145 by in turn evaluating the contained CQLExpressions and then applying
146 the operator.
147
148 For the evaluate method on each CQLExpression, the CQLExpression is
|
149 david.dillard 1.7 resolved to a CQLValue and the value is then applied to the operator.
150
|
151 humberto 1.3 The CQLSimplePredicate is simple if it contains only a left-side CQLExpression.
|
152 david.dillard 1.7 A simple CQLSimplePredicate is evaluated by resolving the CQLExpression into
|
153 humberto 1.3 a CQLValue and then applying the operator.
154 </PRE>
155
156 @param - CI. Instance to evaluate query against.
157 @param - QueryCtx. Query Context
158 @return - Boolean.
159 @throws - None.
|
160 david.dillard 1.7 <I><B>Experimental Interface</B></I><BR>
|
161 humberto 1.3 */
|
162 chuck 1.2 Boolean evaluate(CIMInstance CI, QueryContext& QueryCtx);
163
|
164 humberto 1.3 /**
|
165 david.dillard 1.7 Returns the left-side expression.
166
|
167 humberto 1.3 @return - left-side expresson
168 @throws - None.
169 <I><B>Experimental Interface</B></I><BR>
|
170 david.dillard 1.7 */
|
171 chuck 1.2 CQLExpression getLeftExpression()const;
172
|
173 humberto 1.3 /**
|
174 david.dillard 1.7 Returns the right-side expression.
175
|
176 humberto 1.3 @return - right-side expresson
177 @throws - None.
178 <I><B>Experimental Interface</B></I><BR>
|
179 david.dillard 1.7 */
|
180 chuck 1.2 CQLExpression getRightExpression()const;
181
|
182 humberto 1.3 /**
|
183 david.dillard 1.7 Returns the operator.
184
|
185 humberto 1.3 @return - operator for the expressions
186 @throws - None.
187 <I><B>Experimental Interface</B></I><BR>
|
188 david.dillard 1.7 */
189 ExpressionOpType getOperation()const;
|
190 chuck 1.2
|
191 humberto 1.3 /**
|
192 david.dillard 1.7 Sets the operator.
193
|
194 humberto 1.3 @param - op The operator to set.
195 @return - None
196 @throws - None.
197 <I><B>Experimental Interface</B></I><BR>
|
198 david.dillard 1.7 */
|
199 humberto 1.3 void setOperation(ExpressionOpType op);
200
201 /**
202 This method normalizes the CQLChainedIdentifier so that properties that require
203 scoping are scoped.
204
205 @param - queryContext.
206 @return - None.
207 @throws - None.
208 <I><B>Experimental Interface</B></I><BR>
209 */
|
210 chuck 1.2 void applyContext(QueryContext& queryContext);
211
|
212 humberto 1.3 /**
213 Returns this predicate in string form.
|
214 david.dillard 1.7
|
215 humberto 1.3 @param - None.
216 @return - string form of predicate.
217 @throws - None.
218 <I><B>Experimental Interface</B></I><BR>
219 */
|
220 chuck 1.2 String toString()const;
221
|
222 humberto 1.3 /**
223 Returns true if this CQLSimplePredicate only has a left-side CQLExpression.
224
225 @param - None.
226 @return - Boolean.
227 @throws - None.
228 I><B>Experimental Interface</B></I><BR>
229 */
|
230 chuck 1.2 Boolean isSimple()const;
231
|
232 humberto 1.3 /**
233 Returns true if this CQLSimplePredicate is simple, and
234 the left-side CQLExpression only contains a CQLValue.
|
235 david.dillard 1.7
|
236 humberto 1.3 @param - None.
237 return - Boolean.
238 @throws - None.
239 <I><B>Experimental Interface</B></I><BR>
240 */
|
241 chuck 1.2 Boolean isSimpleValue()const;
242
|
243 humberto 1.3 /**
244 Assignment operator.
|
245 david.dillard 1.7
|
246 humberto 1.3 @param - rhs. Object to assign to this object.
247 return - This object after assignment.
248 @throws - None.
249 <I><B>Experimental Interface</B></I><BR>
250 */
|
251 chuck 1.2 CQLSimplePredicate& operator=(const CQLSimplePredicate& rhs);
252
253 friend class CQLFactory;
254 private:
255 CQLSimplePredicateRep *_rep;
256
257 };
258 PEGASUS_NAMESPACE_END
259 #endif
|
260 david.dillard 1.7 #endif
|