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

  1 martin 1.12 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.13 //
  3 martin 1.12 // 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.13 //
 10 martin 1.12 // 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.13 //
 17 martin 1.12 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.13 //
 20 martin 1.12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.13 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.12 // 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.13 //
 28 martin 1.12 //////////////////////////////////////////////////////////////////////////
 29 chuck  1.2  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #ifndef Pegasus_CQLPredicate_h
 33             #define Pegasus_CQLPredicate_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/CQLSimplePredicate.h>
 39                    #include <Pegasus/Common/ArrayInternal.h>
 40                    
 41                    PEGASUS_NAMESPACE_BEGIN
 42                    
 43 david.dillard 1.7  enum BooleanOpType { AND, OR };
 44 chuck         1.2  
 45                    /*
 46                    #ifndef PEGASUS_ARRAY_T
 47                    #define PEGASUS_ARRAY_T BooleanOpType
 48                    #include <Pegasus/Common/ArrayInter.h>
 49                    #undef PEGASUS_ARRAY_T
 50                    #endif
 51                    */
 52                    
 53 mike          1.10 class CQLPredicateRep;
 54                    class CQLFactory;
 55                    class QueryContext;
 56 chuck         1.2  
 57 david.dillard 1.7  /**
 58 humberto      1.4      The CQLPredicate class contains an expression that produces a boolean
 59                        result.
 60 david.dillard 1.7  
 61 humberto      1.4      <PRE>
 62                        The CQLPredicate is non-simple if it contains only CQLPredicate objects.
 63                        Example: a CQLPredicate representing (a=1 OR b=2) would contain
 64                        two CQLPredicates, one representing (a=1), and the other
 65 david.dillard 1.7      representing (b=2).  These CQLPredicates would in turn be simple.
 66 humberto      1.4  
 67                        The CQLPredicate is simple if it contains a single CQLSimplePredicate,
 68                        representing an arithmetic or string expression.
 69                        Examples:  a = 2
 70                                   (a-b)/ 3 = c
 71                                   a || b = 'abc'
 72                        </PRE>
 73                    */
 74 chuck         1.2  class PEGASUS_CQL_LINKAGE CQLPredicate
 75                    {
 76                      public:
 77 humberto      1.3      /**
 78                            Default constructor
 79                    
 80                            @param  -  None.
 81                            @return - None.
 82                            @throws - None.
 83                            <I><B>Experimental Interface</B></I><BR>
 84                        */
 85 chuck         1.2      CQLPredicate();
 86 humberto      1.3  
 87                        /**
 88                            Constructor. Using this constructor sets isSimple() to true.
 89 david.dillard 1.7  
 90 humberto      1.3          @param  -  inSimplePredicate.
 91 david.dillard 1.7          @param  -  inVerted. Defaults to false.  This is a logical NOT of
 92                                       this predicate
 93 humberto      1.3          @return - None.
 94                            @throws - None.
 95                            <I><B>Experimental Interface</B></I><BR>
 96 david.dillard 1.7      */
 97 karl          1.11     CQLPredicate(const CQLSimplePredicate & inSimplePredicate,
 98                                Boolean inVerted = false);
 99 chuck         1.2  
100 humberto      1.3      /**
101                            Constructor. Using this constructor sets isSimple() to false.
102 david.dillard 1.7  
103 humberto      1.3          @param  -  inPredicate.
104 karl          1.11         @param  -  inVerted. Defaults to false.  This is a logical NOT of
105                                       this predicate
106 humberto      1.3          @return - None.
107                            @throws - None.
108                            <I><B>Experimental Interface</B></I><BR>
109                        */
110 chuck         1.2      CQLPredicate(const CQLPredicate & inPredicate, Boolean inVerted = false);
111                    
112 humberto      1.3      /**
113                            Destructor
114 david.dillard 1.7  
115 humberto      1.3          @param  - None.
116                            @return - None.
117                            @throws - None.
118                            <I><B>Experimental Interface</B></I><BR>
119                        */
120 chuck         1.2     ~CQLPredicate();
121 humberto      1.4  
122 david.dillard 1.7      /**
123 humberto      1.4           Evaluates this predicate, using a CIMInstance as a property source.
124                    
125                             <PRE>
126 karl          1.11          The CQLPredicate is non-simple if it contains only CQLPredicate
127                             objects.
128 humberto      1.4           A non-simple CQLPredicate is evaluated by in turn evaluating the
129                             contained CQLPredicates and boolean operator.
130                    
131 chuck         1.2           For the evaluate method on each CQLPredicate. the CQLPredicate is
132 humberto      1.4           evaluated to TRUE/FALSE and the result of the evaluation is then
133 david.dillard 1.7           applied to the appropriate boolean operator.
134                    
135 humberto      1.4           The result of the evaluation is then inverted if the _invert member
136                             variable is set to TRUE and then returned to the caller.
137                    
138 karl          1.11          The CQLPredicate is simple if it contains only a single
139                             CQLSimplePredicate.
140 david.dillard 1.7           A simple CQLPredicate is evaluated by calling evaluate on
141 humberto      1.4           the CQLSimplePredicate.
142                             </PRE>
143                    
144                             @param  - CI. Instance to evaluate query against.
145                             @param  - QueryCtx. Query Context
146                             @return - Boolean.
147                             @throws - None.
148 david.dillard 1.7           <I><B>Experimental Interface</B></I><BR>
149 humberto      1.4         */
150 chuck         1.2      Boolean evaluate(CIMInstance CI, QueryContext& QueryCtx);
151                    
152 humberto      1.3      /**
153 david.dillard 1.7          Returns true if this predicate has been inverted (NOT), false otherwise
154 humberto      1.3  
155                            @param  - None.
156                            @return - Boolean.
157                            @throws - None.
158                            <I><B>Experimental Interface</B></I><BR>
159                        */
160 chuck         1.2      Boolean getInverted()const;
161                    
162 humberto      1.3      /**
163                            Sets the inverted flag.  Logically NOTting this predicate.
164 david.dillard 1.7  
165 humberto      1.3          @param  - None.
166                            @return - None.
167                            @throws - None.
168                            <I><B>Experimental Interface</B></I><BR>
169                        */
170 humberto      1.5      void setInverted(Boolean invert);
171 chuck         1.2  
172 humberto      1.3      /**
173 david.dillard 1.7          Appends a predicate to the predicate array. This method should only
174 humberto      1.3          be called by Bison.
175                    
176                            @param  - inPredicate.
177                            @return - None.
178                            @throws - None.
179                            <I><B>Experimental Interface</B></I><BR>
180                        */
181                        void appendPredicate(const CQLPredicate& inPredicate);
182 chuck         1.2  
183 humberto      1.3      /**
184                            Appends a predicate to the predicate array. This method should only
185                            be called by Bison.
186 humberto      1.4  
187 humberto      1.3          @param  - inPredicate.
188                            @param  - inBooleanOperator
189                            @return - None.
190                            @throws - None.
191                            <I><B>Experimental Interface</B></I><BR>
192                        */
193 karl          1.11     void appendPredicate(const CQLPredicate& inPredicate,
194                                BooleanOpType inBooleanOperator);
195 david.dillard 1.7  
196 humberto      1.3      /**
197                            Gets the CQLPredicates contained within this CQLPredicate.
198 humberto      1.4  
199 humberto      1.3          @param  - None.
200 david.dillard 1.7          @return - Array<CQLPredicate>.
201 humberto      1.3          @throws - None.
202                            <I><B>Experimental Interface</B></I><BR>
203                        */
204 chuck         1.2      Array<CQLPredicate> getPredicates()const;
205 david.dillard 1.7  
206 humberto      1.3       /**
207 karl          1.11         Gets the CQLSimplePredicate contained within this CQLPredicate.
208                            Only valid if this isSimple() = true.
209 humberto      1.4  
210 humberto      1.3          @param  - None.
211                            @return - CQLSimplePredicate.
212                            @throws - None.
213                            <I><B>Experimental Interface</B></I><BR>
214                        */
215 chuck         1.2      CQLSimplePredicate getSimplePredicate()const;
216 david.dillard 1.7  
217 humberto      1.3       /**
218                            Gets the Operators for this CQLPredicate.
219                            Given P1 AND P2 OR P3, this would return [AND][OR]
220 david.dillard 1.7  
221 humberto      1.3          @param  - None.
222                            @return - Array<BooleanOpType>.
223                            @throws - None.
224                            <I><B>Experimental Interface</B></I><BR>
225                        */
226 chuck         1.2      Array<BooleanOpType> getOperators()const;
227 david.dillard 1.7  
228 humberto      1.3       /**
229 karl          1.11         This method normalizes the CQLChainedIdentifier so that properties
230                            that require scoping are scoped.
231 humberto      1.4  
232 humberto      1.3          @param  - queryContext.
233                            @return - None.
234                            @throws - None.
235                            <I><B>Experimental Interface</B></I><BR>
236                        */
237 vijay.eli     1.8      void applyContext(const QueryContext& queryContext);
238 chuck         1.2  
239 humberto      1.3       /**
240 humberto      1.4          Returns true if this CQLPredicate contains no CQLPredicates,
241                            ie. only has one CQLSimplePredicate.
242                    
243 humberto      1.3          @param  - None.
244                            @return - Boolean.
245                            @throws - None.
246                            <I><B>Experimental Interface</B></I><BR>
247                        */
248 chuck         1.2      Boolean isSimple()const;
249                    
250 humberto      1.3       /**
251 humberto      1.4          Returns true if this CQLPredicate is simple and the contained
252                            CQLSimplePredicate is a simple value (isSimpleValue( ) returns
253                            true).
254 david.dillard 1.7  
255 humberto      1.3          @param  - None.
256                            @return - Boolean.
257                            @throws - None.
258                            <I><B>Experimental Interface</B></I><BR>
259                        */
260 chuck         1.2      Boolean isSimpleValue()const;
261                    
262 humberto      1.4      /**
263                           Returns this predicate in string form.
264 david.dillard 1.7  
265 humberto      1.4          @param  - None.
266                            @return - string form of predicate.
267                            @throws - None.
268                            <I><B>Experimental Interface</B></I><BR>
269                        */
270 chuck         1.2      String toString()const;
271                    
272 humberto      1.3       /**
273                            Operator=
274 humberto      1.4  
275 humberto      1.3          @param  - rhs. Right hand side of assignment operator.
276                            @return - CQLPredicate&.
277                            @throws - None.
278                            <I><B>Experimental Interface</B></I><BR>
279                        */
280 chuck         1.2      CQLPredicate& operator=(const CQLPredicate& rhs);
281                    
282                        friend class CQLFactory;
283                      private:
284 david.dillard 1.7          CQLPredicateRep* _rep;
285 chuck         1.2  
286                    };
287                    
288                    /*
289                    #ifndef PEGASUS_ARRAY_T
290                    #define PEGASUS_ARRAY_T CQLPredicate
291                    #include <Pegasus/Common/ArrayInter.h>
292                    #undef PEGASUS_ARRAY_T
293                    #endif
294                    */
295                    
296                    PEGASUS_NAMESPACE_END
297                    #endif
298 david.dillard 1.7  #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2