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

  1 chuck 1.1.2.7 //%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.1.2.7 // 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 humberto 1.1.2.1 #ifndef Pegasus_CQLPredicateRep_h
 36                  #define Pegasus_CQLPredicateRep_h
 37                  
 38                  #include <Pegasus/Common/Config.h>
 39                  #include <Pegasus/CQL/CQLSimplePredicate.h>
 40                  #include <Pegasus/CQL/CQLScope.h>
 41                  #include <Pegasus/CQL/Linkage.h>
 42                  
 43                  
 44                  PEGASUS_NAMESPACE_BEGIN
 45                  
 46                  class PEGASUS_CQL_LINKAGE QueryContext;
 47                  class PEGASUS_CQL_LINKAGE CQLFactory;
 48                  
 49                  /** 
 50                     This object is populated by Bison.
 51                  
 52                     Valid operations for each type of CQLValue are in accordance with the DMTF
 53                  CQL Specification.
 54                     
 55                     The CQLPredicate is considered "terminal" if it does not contain any
 56 humberto 1.1.2.1 CQLPredicate objects.
 57                      A 'terminal' predicate can be evaluated to TRUE/FALSE by examining the
 58                  CQLExpressions and operator.
 59                      Valid operators are:
 60                              <, >, =, <=, >=, <>, IS NULL, IS NOT NULL, ISA, LIKE
 61                  
 62                     CQLExpressions: 
 63                        For an expression, CQLExpression::getValue is called and will return a
 64                  CQLValue.
 65                        The appropriate operator is then invoked on CQLValue and that operator
 66                  function will
 67                        enforce the type restrictions as documented in the DMTF CQL
 68                  Specification.
 69                        That operator then determines whether the predicate is TRUE / FALSE.
 70                  
 71                  
 72                     CQLPredicates: 
 73                        The CQLPredicate is non-terminal if it contains only CQLPredicate
 74                  objects.
 75                        A non-terminal CQLPredicate is evaluated by in turn evaluating the
 76                  contained CQLPredicates and
 77 humberto 1.1.2.1       boolean operator.
 78                       Valid operators are:
 79                                AND, OR
 80                  
 81                      For the evaluate method on each CQLPredicate. the CQLPredicate is evaluated
 82                  to TRUE/FALSE and 
 83                       the result of the evaluation is then applied to the appropriate boolean
 84                  operator. 
 85                  
 86                      The result of the evaluation is and then inverted if the _invert member
 87                  variable is set to TRUE
 88                      and then returned to the caller.
 89                  
 90                     */
 91                  class PEGASUS_CQL_LINKAGE CQLPredicateRep
 92                  {
 93                    public:
 94                      CQLPredicateRep(){}
 95                      
 96                      CQLPredicateRep(const CQLSimplePredicate & inSimplePredicate, Boolean inVerted = false);
 97                  
 98 humberto 1.1.2.1     CQLPredicateRep(const CQLPredicate & inPredicate, Boolean inVerted = false);
 99                  
100 humberto 1.1.2.3     CQLPredicateRep(const CQLPredicateRep* rep);
101 humberto 1.1.2.1 
102                     ~CQLPredicateRep(){}
103                      /**  
104                        CQLExpressions: 
105                            For an expression, CQLExpression::getValue is called and will return a
106                      CQLValue.
107                            The appropriate operator is then invoked on CQLValue and that operator
108                      function will
109                            enforce the type restrictions as documented in the DMTF CQL
110                      Specification.
111                            That operator then determines whether the predicate is TRUE / FALSE.
112                      
113                      
114                         CQLPredicates: 
115                            The CQLPredicate is non-terminal if it contains only CQLPredicate
116                      objects.
117                            A non-terminal CQLPredicate is evaluated by in turn evaluating the
118                      contained CQLPredicates and
119                            boolean operator.
120                           Valid operators are:
121                                    AND, OR
122 humberto 1.1.2.1     
123                           For the evaluate method on each CQLPredicate. the CQLPredicate is
124                      evaluated to TRUE/FALSE and 
125                           the result of the evaluation is then applied to the appropriate boolean
126                      operator. 
127                      
128                          The result of the evaluation is and then inverted if the _invert member
129                      variable is set to TRUE
130                          and then returned to the caller.
131                      
132                        */
133                      Boolean evaluate(CIMInstance CI, QueryContext& QueryCtx);
134                  
135                      Boolean isTerminal();
136                  
137                      Boolean getInverted();
138                  
139                      void setInverted();
140                  
141                      /** Appends a predicate to the predicate array. This method should only
142                              be called by Bison.
143 humberto 1.1.2.1         */
144 humberto 1.1.2.6     void appendPredicate(const CQLPredicate& inPredicate, BooleanOpType inBooleanOperator);
145 humberto 1.1.2.1 
146                      void appendPredicate(CQLSimplePredicate inSimplePredicate, BooleanOpType inBooleanOperator);
147                    
148                      Array<CQLPredicate> getPredicates();
149                    
150                      CQLSimplePredicate getSimplePredicate();
151                  
152                      Array<BooleanOpType> getOperators();
153                  
154 chuck    1.1.2.5     void applyContext(QueryContext& queryContext);
155 humberto 1.1.2.1 
156                      Boolean isSimple();
157                  
158 humberto 1.1.2.2     Boolean isSimpleValue();
159 humberto 1.1.2.1     String toString();
160 humberto 1.1.2.6     void appendPredicate(const CQLPredicate& inPredicate);
161 humberto 1.1.2.1     friend class CQLFactory;
162                    private:
163                      
164                      
165                     BooleanOpType _booleanOpType;
166                  
167                     Array<CQLPredicate> _predicates;
168                     CQLSimplePredicate _simplePredicate;
169                     Array<BooleanOpType> _operators;
170                  
171                      Boolean _invert;
172                  
173                      /**  If set to TRUE, then the CQLPredicate contains no other CQLPredicates.
174                            If set to FALSE, then the CQLPredicate only contains other CQLPredicates
175                      that need tobe evaluated.
176                        */
177                      Boolean _terminal;
178 humberto 1.1.2.4     Boolean _isSimple;
179 humberto 1.1.2.1 
180                  };
181                  
182                  PEGASUS_NAMESPACE_END
183                  
184                  #endif 

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2