1 martin 1.13 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.14 //
|
3 martin 1.13 // 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.14 //
|
10 martin 1.13 // 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.14 //
|
17 martin 1.13 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.14 //
|
20 martin 1.13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.14 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.13 // 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.14 //
|
28 martin 1.13 //////////////////////////////////////////////////////////////////////////
|
29 chuck 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_CQLExpression_h
33 #define Pegasus_CQLExpression_h
34
|
35 david.dillard 1.7 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
36
37 #include <Pegasus/CQL/Linkage.h>
|
38 chuck 1.2 #include <Pegasus/CQL/CQLValue.h>
39 #include <Pegasus/Common/ArrayInternal.h>
40 #include <Pegasus/CQL/CQLTerm.h>
41
42 PEGASUS_NAMESPACE_BEGIN
43
|
44 mike 1.10 class CQLFactory;
45 class CQLExpressionRep;
46 class QueryContext;
|
47 chuck 1.2
|
48 david.dillard 1.7 /**
|
49 chuck 1.2 The enum is private, but the definition is public.
50 */
|
51 humberto 1.5 enum TermOpType {TERM_ADD,TERM_SUBTRACT};
|
52 chuck 1.2
53 /*
54 #ifndef PEGASUS_ARRAY_T
55 #define PEGASUS_ARRAY_T TermOpType
56 #include <Pegasus/Common/ArrayInter.h>
57 #undef PEGASUS_ARRAY_T
58 #endif
59 */
60
61 /**
62 The CQLExpression class encapsulates a generic CQL expression to make it
|
63 david.dillard 1.7 easier to break into components and process the expression.
|
64 chuck 1.2 */
65
66 class PEGASUS_CQL_LINKAGE CQLExpression
67 {
68 public:
|
69 david.dillard 1.7
70 /**
|
71 chuck 1.2 Contructs CQLExpression default object.
|
72 david.dillard 1.7
|
73 chuck 1.2 @param - None.
74 @return - None.
75 @throw - None.
76 <I><B>Experimental Interface</B></I><BR>
77 */
78 CQLExpression();
79
|
80 david.dillard 1.7 /**
|
81 chuck 1.2 Contructs CQLExpression with a CQLTerm.
|
82 david.dillard 1.7
|
83 chuck 1.2 @param - theTerm - A CQLTerm used to create CQLExpression.
84 @return - None.
85 @throw - None.
86 <I><B>Experimental Interface</B></I><BR>
87 */
88 CQLExpression(const CQLTerm& theTerm);
|
89 david.dillard 1.7
90 /**
|
91 chuck 1.2 Contructs CQLExpression with a CQLExpression object. (copy-constructor)
|
92 david.dillard 1.7
|
93 chuck 1.2 @param - inExpress - Object to be copied.
94 @return - None.
95 @throw - None.
96 <I><B>Experimental Interface</B></I><BR>
97 */
98 CQLExpression(const CQLExpression& inExpress);
|
99 david.dillard 1.7
100 /**
|
101 chuck 1.2 Destructs the CQLExpression object.
|
102 david.dillard 1.7
|
103 chuck 1.2 @param - None.
104 @return - None.
105 @throw - None.
106 <I><B>Experimental Interface</B></I><BR>
107 */
108 ~CQLExpression();
109
110 /** the resolveValue method evaluates the expression and returns the value.
111 Any property that need to be resolved into a value is taken from the
112 CIMInstance.
|
113 david.dillard 1.7
|
114 chuck 1.2 @param - CI - the CIMInstance to be evaluated.
115 @param - QueryCtx - The QueryContext used to access the repository.
116 @return - The resolved CQLValue.
117 @throw - CQLSyntaxErrorException.
118 <I><B>Experimental Interface</B></I><BR>
119 */
120 CQLValue resolveValue(const CIMInstance& CI, const QueryContext& QueryCtx);
|
121 david.dillard 1.7
|
122 chuck 1.2 /** The appendOperation is used by Bison.
123 It is invoked 0 or more times for the CQLExpression, and
124 when invoked will always pass in an integer that is the Term operation
125 type and a CQLTerm object.
|
126 david.dillard 1.7
|
127 chuck 1.2 @param - theTermOpType - the type of operation being appended.
128 @param - theTerm - the term to be operated on.
129 @return - None.
130 @throw - None.
131 <I><B>Experimental Interface</B></I><BR>
132 */
133 void appendOperation(const TermOpType theTermOpType, const CQLTerm& theTerm);
|
134 david.dillard 1.7
135 /**
|
136 chuck 1.2 Returns a string representation of the object.
|
137 david.dillard 1.7
|
138 chuck 1.2 @param - None.
139 @return - A string
140 @throw - None.
141 <I><B>Experimental Interface</B></I><BR>
142 */
143 String toString()const;
|
144 david.dillard 1.7
145 /**
|
146 chuck 1.2 Will return true if the object has only one CQLTerm object within it.
|
147 david.dillard 1.7
|
148 chuck 1.2 @param - None.
149 @return - true or false
150 @throw - None.
151 <I><B>Experimental Interface</B></I><BR>
152 */
153 Boolean isSimple()const;
|
154 david.dillard 1.7
155 /**
|
156 chuck 1.2 Will return true if the CQLExpression resolves to a simple value.
|
157 david.dillard 1.7
|
158 chuck 1.2 @param - None.
159 @return - None.
160 @throw - None.
161 <I><B>Experimental Interface</B></I><BR>
162 */
163 Boolean isSimpleValue()const;
|
164 david.dillard 1.7
165 /**
|
166 chuck 1.2 Retrieve an array of all the CQLTerms for this expression.
|
167 david.dillard 1.7
|
168 chuck 1.2 @param - None.
169 @return - An array of CQLTerm.
170 @throw - None.
171 <I><B>Experimental Interface</B></I><BR>
172 */
173 Array<CQLTerm> getTerms()const;
|
174 david.dillard 1.7
175 /**
|
176 chuck 1.2 Retrieve an array of all the TermOpType for this expression.
|
177 david.dillard 1.7
|
178 chuck 1.2 @param - None.
179 @return - None.
180 @throw - None.
181 <I><B>Experimental Interface</B></I><BR>
182 */
183 Array<TermOpType> getOperators()const;
|
184 david.dillard 1.7
185 /**
|
186 chuck 1.2 Calling applyContext function for every internal object. This
|
187 karl 1.11 will fully qualify the Chained Identifiers within all the CQLValueobjects.
|
188 david.dillard 1.7
|
189 chuck 1.2 @param - inContext - Query Context used to access the repository.
|
190 karl 1.11 @param - inCid - Chained Identifier used for standalone symbolic
191 constants.
|
192 chuck 1.2 @return - None.
193 @throw - None.
194 <I><B>Experimental Interface</B></I><BR>
195 */
|
196 vijay.eli 1.8 void applyContext(const QueryContext& inContext,
|
197 s.kodali 1.12 const CQLChainedIdentifier& inCid = CQLChainedIdentifier());
|
198 david.dillard 1.7
199 /**
|
200 chuck 1.2 Assignment operation.
|
201 david.dillard 1.7
|
202 chuck 1.2 @param - rhs - CQLExpression to be assigned.
203 @return - Assigned value.
204 @throw - None.
205 <I><B>Experimental Interface</B></I><BR>
206 */
207 CQLExpression& operator=(const CQLExpression& rhs);
|
208 david.dillard 1.7
209 /**
|
210 chuck 1.2 Compare to CQLExpressions for equality
|
211 david.dillard 1.7
|
212 chuck 1.2 @param - expr - rightside value of operation
213 @return - true or false.
214 @throw - None.
215 <I><B>Experimental Interface</B></I><BR>
216 */
|
217 humberto 1.4 /*
|
218 chuck 1.2 Boolean operator==(const CQLExpression& expr)const;
|
219 humberto 1.4 */
|
220 david.dillard 1.7 /**
|
221 chuck 1.2 Compare to CQLExpressions for non-equality
|
222 david.dillard 1.7
|
223 chuck 1.2 @param - expr - rightside value of operation
224 @return - true or false.
225 @throw - None.
226 <I><B>Experimental Interface</B></I><BR>
227 */
|
228 humberto 1.4 /*
|
229 chuck 1.2 Boolean operator!=(const CQLExpression& expr)const;
|
230 humberto 1.4 */
|
231 chuck 1.2 friend class CQLFactory;
|
232 david.dillard 1.7
|
233 chuck 1.2 private:
|
234 david.dillard 1.7
235 CQLExpressionRep *_rep;
|
236 chuck 1.2 };
237
238 /*
239 #ifndef PEGASUS_ARRAY_T
240 #define PEGASUS_ARRAY_T CQLExpression
241 #include <Pegasus/Common/ArrayInter.h>
242 #undef PEGASUS_ARRAY_T
243 #endif
244 */
245
246 PEGASUS_NAMESPACE_END
247
|
248 david.dillard 1.7 #endif
249 #endif
|