1 karl 1.9 //%2006////////////////////////////////////////////////////////////////////////
|
2 chuck 1.2 //
|
3 karl 1.6 // 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.6 // 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 //%/////////////////////////////////////////////////////////////////////////////
33
34 #ifndef Pegasus_CQLPredicate_h
35 #define Pegasus_CQLPredicate_h
36
|
37 david.dillard 1.7 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
38
39 #include <Pegasus/CQL/Linkage.h>
|
40 chuck 1.2 #include <Pegasus/CQL/CQLSimplePredicate.h>
41 #include <Pegasus/Common/ArrayInternal.h>
42
43 PEGASUS_NAMESPACE_BEGIN
44
|
45 david.dillard 1.7 enum BooleanOpType { AND, OR };
|
46 chuck 1.2
47 /*
48 #ifndef PEGASUS_ARRAY_T
49 #define PEGASUS_ARRAY_T BooleanOpType
50 #include <Pegasus/Common/ArrayInter.h>
51 #undef PEGASUS_ARRAY_T
52 #endif
53 */
54
|
55 mike 1.10 class CQLPredicateRep;
56 class CQLFactory;
57 class QueryContext;
|
58 chuck 1.2
|
59 david.dillard 1.7 /**
|
60 humberto 1.4 The CQLPredicate class contains an expression that produces a boolean
61 result.
|
62 david.dillard 1.7
|
63 humberto 1.4 <PRE>
64 The CQLPredicate is non-simple if it contains only CQLPredicate objects.
65 Example: a CQLPredicate representing (a=1 OR b=2) would contain
66 two CQLPredicates, one representing (a=1), and the other
|
67 david.dillard 1.7 representing (b=2). These CQLPredicates would in turn be simple.
|
68 humberto 1.4
69 The CQLPredicate is simple if it contains a single CQLSimplePredicate,
70 representing an arithmetic or string expression.
71 Examples: a = 2
72 (a-b)/ 3 = c
73 a || b = 'abc'
74 </PRE>
75 */
|
76 chuck 1.2 class PEGASUS_CQL_LINKAGE CQLPredicate
77 {
78 public:
|
79 humberto 1.3 /**
80 Default constructor
81
82 @param - None.
83 @return - None.
84 @throws - None.
85 <I><B>Experimental Interface</B></I><BR>
86 */
|
87 chuck 1.2 CQLPredicate();
|
88 humberto 1.3
89 /**
90 Constructor. Using this constructor sets isSimple() to true.
|
91 david.dillard 1.7
|
92 humberto 1.3 @param - inSimplePredicate.
|
93 david.dillard 1.7 @param - inVerted. Defaults to false. This is a logical NOT of
94 this predicate
|
95 humberto 1.3 @return - None.
96 @throws - None.
97 <I><B>Experimental Interface</B></I><BR>
|
98 david.dillard 1.7 */
|
99 karl 1.11 CQLPredicate(const CQLSimplePredicate & inSimplePredicate,
100 Boolean inVerted = false);
|
101 chuck 1.2
|
102 humberto 1.3 /**
103 Constructor. Using this constructor sets isSimple() to false.
|
104 david.dillard 1.7
|
105 humberto 1.3 @param - inPredicate.
|
106 karl 1.11 @param - inVerted. Defaults to false. This is a logical NOT of
107 this predicate
|
108 humberto 1.3 @return - None.
109 @throws - None.
110 <I><B>Experimental Interface</B></I><BR>
111 */
|
112 chuck 1.2 CQLPredicate(const CQLPredicate & inPredicate, Boolean inVerted = false);
113
|
114 humberto 1.3 /**
115 Destructor
|
116 david.dillard 1.7
|
117 humberto 1.3 @param - None.
118 @return - None.
119 @throws - None.
120 <I><B>Experimental Interface</B></I><BR>
121 */
|
122 chuck 1.2 ~CQLPredicate();
|
123 humberto 1.4
|
124 david.dillard 1.7 /**
|
125 humberto 1.4 Evaluates this predicate, using a CIMInstance as a property source.
126
127 <PRE>
|
128 karl 1.11 The CQLPredicate is non-simple if it contains only CQLPredicate
129 objects.
|
130 humberto 1.4 A non-simple CQLPredicate is evaluated by in turn evaluating the
131 contained CQLPredicates and boolean operator.
132
|
133 chuck 1.2 For the evaluate method on each CQLPredicate. the CQLPredicate is
|
134 humberto 1.4 evaluated to TRUE/FALSE and the result of the evaluation is then
|
135 david.dillard 1.7 applied to the appropriate boolean operator.
136
|
137 humberto 1.4 The result of the evaluation is then inverted if the _invert member
138 variable is set to TRUE and then returned to the caller.
139
|
140 karl 1.11 The CQLPredicate is simple if it contains only a single
141 CQLSimplePredicate.
|
142 david.dillard 1.7 A simple CQLPredicate is evaluated by calling evaluate on
|
143 humberto 1.4 the CQLSimplePredicate.
144 </PRE>
145
146 @param - CI. Instance to evaluate query against.
147 @param - QueryCtx. Query Context
148 @return - Boolean.
149 @throws - None.
|
150 david.dillard 1.7 <I><B>Experimental Interface</B></I><BR>
|
151 humberto 1.4 */
|
152 chuck 1.2 Boolean evaluate(CIMInstance CI, QueryContext& QueryCtx);
153
|
154 humberto 1.3 /**
|
155 david.dillard 1.7 Returns true if this predicate has been inverted (NOT), false otherwise
|
156 humberto 1.3
157 @param - None.
158 @return - Boolean.
159 @throws - None.
160 <I><B>Experimental Interface</B></I><BR>
161 */
|
162 chuck 1.2 Boolean getInverted()const;
163
|
164 humberto 1.3 /**
165 Sets the inverted flag. Logically NOTting this predicate.
|
166 david.dillard 1.7
|
167 humberto 1.3 @param - None.
168 @return - None.
169 @throws - None.
170 <I><B>Experimental Interface</B></I><BR>
171 */
|
172 humberto 1.5 void setInverted(Boolean invert);
|
173 chuck 1.2
|
174 humberto 1.3 /**
|
175 david.dillard 1.7 Appends a predicate to the predicate array. This method should only
|
176 humberto 1.3 be called by Bison.
177
178 @param - inPredicate.
179 @return - None.
180 @throws - None.
181 <I><B>Experimental Interface</B></I><BR>
182 */
183 void appendPredicate(const CQLPredicate& inPredicate);
|
184 chuck 1.2
|
185 humberto 1.3 /**
186 Appends a predicate to the predicate array. This method should only
187 be called by Bison.
|
188 humberto 1.4
|
189 humberto 1.3 @param - inPredicate.
190 @param - inBooleanOperator
191 @return - None.
192 @throws - None.
193 <I><B>Experimental Interface</B></I><BR>
194 */
|
195 karl 1.11 void appendPredicate(const CQLPredicate& inPredicate,
196 BooleanOpType inBooleanOperator);
|
197 david.dillard 1.7
|
198 humberto 1.3 /**
199 Gets the CQLPredicates contained within this CQLPredicate.
|
200 humberto 1.4
|
201 humberto 1.3 @param - None.
|
202 david.dillard 1.7 @return - Array<CQLPredicate>.
|
203 humberto 1.3 @throws - None.
204 <I><B>Experimental Interface</B></I><BR>
205 */
|
206 chuck 1.2 Array<CQLPredicate> getPredicates()const;
|
207 david.dillard 1.7
|
208 humberto 1.3 /**
|
209 karl 1.11 Gets the CQLSimplePredicate contained within this CQLPredicate.
210 Only valid if this isSimple() = true.
|
211 humberto 1.4
|
212 humberto 1.3 @param - None.
213 @return - CQLSimplePredicate.
214 @throws - None.
215 <I><B>Experimental Interface</B></I><BR>
216 */
|
217 chuck 1.2 CQLSimplePredicate getSimplePredicate()const;
|
218 david.dillard 1.7
|
219 humberto 1.3 /**
220 Gets the Operators for this CQLPredicate.
221 Given P1 AND P2 OR P3, this would return [AND][OR]
|
222 david.dillard 1.7
|
223 humberto 1.3 @param - None.
224 @return - Array<BooleanOpType>.
225 @throws - None.
226 <I><B>Experimental Interface</B></I><BR>
227 */
|
228 chuck 1.2 Array<BooleanOpType> getOperators()const;
|
229 david.dillard 1.7
|
230 humberto 1.3 /**
|
231 karl 1.11 This method normalizes the CQLChainedIdentifier so that properties
232 that require scoping are scoped.
|
233 humberto 1.4
|
234 humberto 1.3 @param - queryContext.
235 @return - None.
236 @throws - None.
237 <I><B>Experimental Interface</B></I><BR>
238 */
|
239 vijay.eli 1.8 void applyContext(const QueryContext& queryContext);
|
240 chuck 1.2
|
241 humberto 1.3 /**
|
242 humberto 1.4 Returns true if this CQLPredicate contains no CQLPredicates,
243 ie. only has one CQLSimplePredicate.
244
|
245 humberto 1.3 @param - None.
246 @return - Boolean.
247 @throws - None.
248 <I><B>Experimental Interface</B></I><BR>
249 */
|
250 chuck 1.2 Boolean isSimple()const;
251
|
252 humberto 1.3 /**
|
253 humberto 1.4 Returns true if this CQLPredicate is simple and the contained
254 CQLSimplePredicate is a simple value (isSimpleValue( ) returns
255 true).
|
256 david.dillard 1.7
|
257 humberto 1.3 @param - None.
258 @return - Boolean.
259 @throws - None.
260 <I><B>Experimental Interface</B></I><BR>
261 */
|
262 chuck 1.2 Boolean isSimpleValue()const;
263
|
264 humberto 1.4 /**
265 Returns this predicate in string form.
|
266 david.dillard 1.7
|
267 humberto 1.4 @param - None.
268 @return - string form of predicate.
269 @throws - None.
270 <I><B>Experimental Interface</B></I><BR>
271 */
|
272 chuck 1.2 String toString()const;
273
|
274 humberto 1.3 /**
275 Operator=
|
276 humberto 1.4
|
277 humberto 1.3 @param - rhs. Right hand side of assignment operator.
278 @return - CQLPredicate&.
279 @throws - None.
280 <I><B>Experimental Interface</B></I><BR>
281 */
|
282 chuck 1.2 CQLPredicate& operator=(const CQLPredicate& rhs);
283
284 friend class CQLFactory;
285 private:
|
286 david.dillard 1.7 CQLPredicateRep* _rep;
|
287 chuck 1.2
288 };
289
290 /*
291 #ifndef PEGASUS_ARRAY_T
292 #define PEGASUS_ARRAY_T CQLPredicate
293 #include <Pegasus/Common/ArrayInter.h>
294 #undef PEGASUS_ARRAY_T
295 #endif
296 */
297
298 PEGASUS_NAMESPACE_END
299 #endif
|
300 david.dillard 1.7 #endif
|