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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2