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