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