(file) Return to CQLExpression.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / CQL

  1 chuck 1.2 //%2003////////////////////////////////////////////////////////////////////////
  2           //
  3           // 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           // IBM Corp.; EMC Corporation, The Open Group.
  7           //
  8           // Permission is hereby granted, free of charge, to any person obtaining a copy
  9           // of this software and associated documentation files (the "Software"), to
 10           // deal in the Software without restriction, including without limitation the
 11           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 12           // sell copies of the Software, and to permit persons to whom the Software is
 13           // furnished to do so, subject to the following conditions:
 14           // 
 15           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 16           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 17           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 18           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 19           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 20           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 21           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 22 chuck 1.2 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 23           //
 24           //==============================================================================
 25           //
 26           // Authors: David Rosckes (rosckes@us.ibm.com)
 27           //          Bert Rivero (hurivero@us.ibm.com)
 28           //          Chuck Carmack (carmack@us.ibm.com)
 29           //          Brian Lucier (lucier@us.ibm.com)
 30           //
 31           // Modified By: 
 32           //
 33           //%/////////////////////////////////////////////////////////////////////////////
 34           
 35           #ifndef Pegasus_CQLExpression_h
 36           #define Pegasus_CQLExpression_h
 37           
 38           #include <Pegasus/Common/Config.h>
 39           #include <Pegasus/CQL/CQLValue.h>
 40           #include <Pegasus/CQL/Linkage.h>
 41           #include <Pegasus/Common/ArrayInternal.h>
 42           #include <Pegasus/CQL/CQLTerm.h>
 43 chuck 1.2 
 44           #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
 45           
 46           PEGASUS_NAMESPACE_BEGIN
 47           
 48           class PEGASUS_CQL_LINKAGE CQLFactory;
 49           class PEGASUS_CQL_LINKAGE CQLExpressionRep;
 50           class PEGASUS_QUERYCOMMON_LINKAGE QueryContext;
 51           
 52           /**  
 53               The enum is private, but the definition is public.
 54           */
 55 chuck 1.3 enum TermOpType {TERM_ADD,TERM_SUBTRACT};
 56 chuck 1.2 
 57           /*
 58           #ifndef PEGASUS_ARRAY_T
 59           #define PEGASUS_ARRAY_T TermOpType
 60           #include <Pegasus/Common/ArrayInter.h>
 61           #undef PEGASUS_ARRAY_T
 62           #endif
 63           */
 64           
 65           /**
 66               The CQLExpression class encapsulates a generic CQL expression to make it
 67               easier to break into components and process the expression.  
 68           */
 69           
 70           class PEGASUS_CQL_LINKAGE CQLExpression
 71           {
 72            public:
 73             
 74             /** 
 75                 Contructs CQLExpression default object.
 76                 
 77 chuck 1.2       @param  - None.
 78                 @return - None.
 79                 @throw  - None.
 80                 <I><B>Experimental Interface</B></I><BR>
 81             */
 82             CQLExpression();
 83           
 84             /** 
 85                 Contructs CQLExpression with a CQLTerm.
 86                 
 87                 @param  - theTerm - A CQLTerm used to create CQLExpression.
 88                 @return - None.
 89                 @throw  - None.
 90                 <I><B>Experimental Interface</B></I><BR>
 91             */
 92             CQLExpression(const CQLTerm& theTerm);
 93             
 94             /** 
 95                 Contructs CQLExpression with a CQLExpression object. (copy-constructor)
 96                 
 97                 @param  - inExpress - Object to be copied.
 98 chuck 1.2       @return - None.
 99                 @throw  - None.
100                 <I><B>Experimental Interface</B></I><BR>
101             */
102             CQLExpression(const CQLExpression& inExpress);
103             
104             /** 
105                 Destructs the CQLExpression object.
106                 
107                 @param  - None.
108                 @return - None.
109                 @throw  - None.
110                 <I><B>Experimental Interface</B></I><BR>
111             */
112             ~CQLExpression();
113           
114             /** the resolveValue method evaluates the expression and returns the value.
115                 Any property that need to be resolved into a value is taken from the
116                 CIMInstance.
117                 
118                 @param  - CI - the CIMInstance to be evaluated.
119 chuck 1.2       @param  - QueryCtx - The QueryContext used to access the repository.
120                 @return - The resolved CQLValue.
121                 @throw  - CQLSyntaxErrorException.
122                 <I><B>Experimental Interface</B></I><BR>
123             */
124             CQLValue resolveValue(const CIMInstance& CI, const QueryContext& QueryCtx);
125             
126             /** The appendOperation is used by Bison.
127                 It is invoked 0 or more times for the CQLExpression, and
128                 when invoked will always pass in an integer that is the Term operation
129                 type and a CQLTerm object.
130                 
131                 @param  - theTermOpType - the type of operation being appended.
132                 @param  - theTerm - the term to be operated on.
133                 @return - None.
134                 @throw  - None.
135                 <I><B>Experimental Interface</B></I><BR>
136             */
137             void appendOperation(const TermOpType theTermOpType, const CQLTerm& theTerm);
138             
139             /** 
140 chuck 1.2       Returns a string representation of the object.
141                 
142                 @param  - None.
143                 @return - A string
144                 @throw  - None.
145                 <I><B>Experimental Interface</B></I><BR>
146             */
147             String toString()const;
148             
149             /** 
150                 Will return true if the object has only one CQLTerm object within it.
151                 
152                 @param  - None.
153                 @return - true or false
154                 @throw  - None.
155                 <I><B>Experimental Interface</B></I><BR>
156             */
157             Boolean isSimple()const;
158             
159             /** 
160                 Will return true if the CQLExpression resolves to a simple value.
161 chuck 1.2       
162                 @param  - None.
163                 @return - None.
164                 @throw  - None.
165                 <I><B>Experimental Interface</B></I><BR>
166             */
167             Boolean isSimpleValue()const;
168             
169             /** 
170                 Retrieve an array of all the CQLTerms for this expression.
171                 
172                 @param  - None.
173                 @return - An array of CQLTerm.
174                 @throw  - None.
175                 <I><B>Experimental Interface</B></I><BR>
176             */
177             Array<CQLTerm> getTerms()const;
178             
179             /** 
180                 Retrieve an array of all the TermOpType for this expression.
181                       
182 chuck 1.2       @param  - None.
183                 @return - None.
184                 @throw  - None.
185                 <I><B>Experimental Interface</B></I><BR>
186             */
187             Array<TermOpType> getOperators()const;
188             
189             /** 
190                 Calling applyContext function for every internal object.  This
191                 will fully qualify the Chained Identifiers within all the CQLValue objects.
192                     
193                 @param  - inContext - Query Context used to access the repository.
194                 @param  - inCid - Chained Identifier used for standalone symbolic constants.  
195                 @return - None.
196                 @throw  - None.
197                 <I><B>Experimental Interface</B></I><BR>
198             */
199             void applyContext(QueryContext& inContext, 
200           		    CQLChainedIdentifier inCid = CQLChainedIdentifier());
201             
202             /** 
203 chuck 1.2       Assignment operation.
204                 
205                 @param  - rhs - CQLExpression to be assigned.
206                 @return - Assigned value.
207                 @throw  - None.
208                 <I><B>Experimental Interface</B></I><BR>
209             */
210             CQLExpression& operator=(const CQLExpression& rhs);
211             
212             /** 
213                 Compare to CQLExpressions for equality
214                 
215                 @param  - expr - rightside value of operation
216                 @return - true or false.
217                 @throw  - None.
218                 <I><B>Experimental Interface</B></I><BR>
219             */
220             Boolean operator==(const CQLExpression& expr)const;
221              
222             /** 
223                 Compare to CQLExpressions for non-equality
224 chuck 1.2       
225                 @param  - expr - rightside value of operation
226                 @return - true or false.
227                 @throw  - None.
228                 <I><B>Experimental Interface</B></I><BR>
229             */
230             Boolean operator!=(const CQLExpression& expr)const;
231             
232             friend class CQLFactory;
233             
234            private:
235             
236             CQLExpressionRep *_rep;   
237           };
238           
239           /*
240           #ifndef PEGASUS_ARRAY_T
241           #define PEGASUS_ARRAY_T CQLExpression
242           #include <Pegasus/Common/ArrayInter.h>
243           #undef PEGASUS_ARRAY_T
244           #endif
245 chuck 1.2 */
246           
247           PEGASUS_NAMESPACE_END
248           
249           #endif 
250           #endif 

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2