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

  1 chuck 1.3.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.3.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     #include "CQLFactorRep.h"
 36                  #include <Pegasus/CQL/CQLExpression.h>
 37                  #include <Pegasus/CQL/CQLFunction.h>
 38                  #include <Pegasus/CQL/CQLFactory.h>
 39                  #include <Pegasus/CQL/CQLValue.h>
 40                  #include <Pegasus/CQL/CQLScope.h>
 41                  #include <Pegasus/CQL/QueryContext.h>
 42 david    1.3.2.12 #include <Pegasus/Common/Tracer.h>
 43 humberto 1.1       
 44                   PEGASUS_NAMESPACE_BEGIN
 45 david    1.3.2.12 
 46 humberto 1.3.2.3  CQLFactorRep::CQLFactorRep(const CQLFactorRep* rep)
 47 humberto 1.1      {
 48 david    1.3.2.12   PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::CQLFactorRep()");
 49                   
 50                     _CQLVal = rep->_CQLVal;
 51                     _CQLFunct = rep->_CQLFunct;
 52                     _CQLExp = rep->_CQLExp;
 53                     _invert = rep->_invert;
 54                     _simpleValue = rep->_simpleValue;
 55                     _containedType = rep->_containedType;
 56                   
 57                     PEG_METHOD_EXIT();
 58 humberto 1.1      }
 59                   
 60 humberto 1.3.2.4  CQLFactorRep::CQLFactorRep(const CQLValue& inCQLVal)
 61 humberto 1.1      {
 62 david    1.3.2.12   PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::CQLFactorRep()");
 63                   
 64                     _CQLVal = inCQLVal;
 65                     _simpleValue = true;
 66                     _containedType = VALUE;
 67                     
 68                     PEG_METHOD_EXIT();
 69 humberto 1.1      }
 70                   
 71 humberto 1.3.2.10 CQLFactorRep::CQLFactorRep(const CQLExpression& inCQLExp)
 72 humberto 1.1      {
 73 david    1.3.2.12   PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::CQLFactorRep()");
 74                   
 75                     _CQLExp = inCQLExp;
 76                     _simpleValue = false;
 77                     _containedType = EXPRESSION;
 78                   
 79                     PEG_METHOD_EXIT();
 80 humberto 1.1      }
 81                   
 82 humberto 1.3.2.10 CQLFactorRep::CQLFactorRep(const CQLFunction& inCQLFunc)
 83 humberto 1.1      {
 84 david    1.3.2.12   PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::CQLFactorRep()");
 85                   
 86                     _CQLFunct = inCQLFunc;
 87                     _simpleValue = false;
 88                     _containedType = FUNCTION;
 89                   
 90                     PEG_METHOD_EXIT();
 91 humberto 1.1      }
 92                   
 93 humberto 1.3.2.10 CQLValue CQLFactorRep::getValue()const
 94 humberto 1.1      {
 95                      return _CQLVal;
 96                   }
 97                   
 98 david    1.3.2.11 CQLValue CQLFactorRep::resolveValue(const CIMInstance& CI, const QueryContext& QueryCtx)
 99 humberto 1.1      {
100 david    1.3.2.12   PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::resolveValue()");
101 humberto 1.1      
102 david    1.3.2.12   if(_containedType == EXPRESSION)
103                       {
104                         PEG_METHOD_EXIT();
105 humberto 1.1            return _CQLExp.resolveValue(CI,QueryCtx);
106 david    1.3.2.12     }
107                     else if (_containedType == FUNCTION)
108                       {
109                         PEG_METHOD_EXIT();
110 humberto 1.1            return _CQLFunct.resolveValue(CI,QueryCtx);
111 david    1.3.2.12     }
112                     else
113                       {
114 humberto 1.1            _CQLVal.resolve(CI,QueryCtx);
115 david    1.3.2.12       PEG_METHOD_EXIT();
116 humberto 1.1            return _CQLVal;
117 david    1.3.2.12     }
118 humberto 1.1      }
119                   
120 humberto 1.3.2.10 Boolean CQLFactorRep::isSimple()const
121 humberto 1.3.2.2  {
122                      return _simpleValue;
123                   }
124                   
125 humberto 1.3.2.10 Boolean CQLFactorRep::isSimpleValue()const
126 humberto 1.1      {
127                      return _simpleValue;
128                   }
129                   
130 humberto 1.3.2.10 CQLFunction CQLFactorRep::getCQLFunction()const
131 humberto 1.1      {
132                      return _CQLFunct;
133                   }
134                   
135 humberto 1.3.2.10 CQLExpression CQLFactorRep::getCQLExpression()const
136 humberto 1.1      {
137                      return _CQLExp;
138                   }
139                   
140 humberto 1.3.2.10 String CQLFactorRep::toString()const
141 humberto 1.1      {
142 david    1.3.2.12   PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::toString()");
143 chuck    1.3.2.5  
144 david    1.3.2.12   if(_containedType == VALUE)
145                       {
146                         PEG_METHOD_EXIT();
147                         return _CQLVal.toString();
148                       }
149                     
150 chuck    1.3.2.5    if(_containedType == FUNCTION)
151 david    1.3.2.12     {
152                         PEG_METHOD_EXIT();
153 humberto 1.1            return _CQLFunct.toString();
154 david    1.3.2.12     }
155                     else
156                       {
157                         PEG_METHOD_EXIT();
158 humberto 1.1            return _CQLExp.toString();
159 david    1.3.2.12     }
160 humberto 1.1      }
161                   
162 david    1.3.2.8  void CQLFactorRep::applyContext(QueryContext& inContext,
163                                                   CQLChainedIdentifier& inCid)
164 humberto 1.1      {
165 david    1.3.2.12   PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::applyContext()");
166                     
167                     if(_containedType == FUNCTION)
168                       {
169                         _CQLFunct.applyContext(inContext);
170                       }
171                     else if(_containedType == EXPRESSION)
172                       {
173                         _CQLExp.applyContext(inContext);
174                       }
175                     else 
176                       {
177                         _CQLVal.applyContext(inContext,inCid);
178                       }
179                   
180                     PEG_METHOD_EXIT();
181                     return;
182                   }
183                   
184                   Boolean CQLFactorRep::operator==(const CQLFactorRep& rep)const
185                   {
186 david    1.3.2.12   PEG_METHOD_ENTER(TRC_CQL,"CQLFactorRep::operator==()");
187                     
188                     if(_CQLExp != rep._CQLExp)
189                       {
190                         PEG_METHOD_EXIT();
191                         return false;
192                       }
193                     if(CQLValue(_CQLVal) != rep._CQLVal) // Why?
194                       {
195                         PEG_METHOD_EXIT();
196                         return false;
197                       }
198                     if(_CQLFunct != rep._CQLFunct)
199                       {
200                         PEG_METHOD_EXIT();
201                         return false;
202                       }
203                     if(_invert != rep._invert)
204                       {
205                         PEG_METHOD_EXIT();
206                         return false;
207 david    1.3.2.12     }
208                     if(_simpleValue != rep._simpleValue)
209                       {
210                         PEG_METHOD_EXIT();
211                         return false;
212                       }
213                     if(_containedType != rep._containedType)
214                       {
215                         PEG_METHOD_EXIT();
216                         return false;
217                       }
218                     
219                     PEG_METHOD_EXIT();
220                     return true;
221 humberto 1.1      }
222                   
223 david    1.3.2.12 Boolean CQLFactorRep::operator!=(const CQLFactorRep& rep)const
224                   {
225                     return (!operator==(rep));
226 humberto 1.1      }
227                   PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2