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
43 PEGASUS_NAMESPACE_BEGIN
44 /*
45 #define PEGASUS_ARRAY_T CQLFactorRep
46 #include <Pegasus/Common/ArrayImpl.h>
47 #undef PEGASUS_ARRAY_T
48 */
|
49 humberto 1.3.2.3 CQLFactorRep::CQLFactorRep(const CQLFactorRep* rep)
|
50 humberto 1.1 {
|
51 humberto 1.3.2.3 _CQLVal = rep->_CQLVal;
52 _CQLFunct = rep->_CQLFunct;
53 _CQLExp = rep->_CQLExp;
54 _invert = rep->_invert;
55 _simpleValue = rep->_simpleValue;
|
56 chuck 1.3.2.5 _containedType = rep->_containedType;
|
57 humberto 1.1 }
58
|
59 humberto 1.3.2.4 CQLFactorRep::CQLFactorRep(const CQLValue& inCQLVal)
|
60 humberto 1.1 {
61 _CQLVal = inCQLVal;
62 _simpleValue = true;
|
63 chuck 1.3.2.5 _containedType = VALUE;
|
64 humberto 1.1 }
65
|
66 humberto 1.3.2.10 CQLFactorRep::CQLFactorRep(const CQLExpression& inCQLExp)
|
67 humberto 1.1 {
68 _CQLExp = inCQLExp;
69 _simpleValue = false;
|
70 chuck 1.3.2.5 _containedType = EXPRESSION;
|
71 humberto 1.1 }
72
|
73 humberto 1.3.2.10 CQLFactorRep::CQLFactorRep(const CQLFunction& inCQLFunc)
|
74 humberto 1.1 {
75 _CQLFunct = inCQLFunc;
76 _simpleValue = false;
|
77 chuck 1.3.2.5 _containedType = FUNCTION;
|
78 humberto 1.1 }
79
|
80 humberto 1.3.2.10 CQLValue CQLFactorRep::getValue()const
|
81 humberto 1.1 {
82 return _CQLVal;
83 }
84
|
85 david 1.3.2.11 CQLValue CQLFactorRep::resolveValue(const CIMInstance& CI, const QueryContext& QueryCtx)
|
86 humberto 1.1 {
87
|
88 chuck 1.3.2.5 if(_containedType == EXPRESSION)
|
89 humberto 1.1 {
90 return _CQLExp.resolveValue(CI,QueryCtx);
91 }
|
92 chuck 1.3.2.5 else if (_containedType == FUNCTION)
|
93 humberto 1.1 {
94 return _CQLFunct.resolveValue(CI,QueryCtx);
95 }
96 else
97 {
98 _CQLVal.resolve(CI,QueryCtx);
99 return _CQLVal;
100 }
101 }
102
|
103 humberto 1.3.2.10 Boolean CQLFactorRep::isSimple()const
|
104 humberto 1.3.2.2 {
105 return _simpleValue;
106 }
107
|
108 humberto 1.3.2.10 Boolean CQLFactorRep::isSimpleValue()const
|
109 humberto 1.1 {
110 return _simpleValue;
111 }
112
|
113 humberto 1.3.2.10 CQLFunction CQLFactorRep::getCQLFunction()const
|
114 humberto 1.1 {
115 return _CQLFunct;
116 }
117
|
118 humberto 1.3.2.10 CQLExpression CQLFactorRep::getCQLExpression()const
|
119 humberto 1.1 {
120 return _CQLExp;
121 }
122
|
123 humberto 1.3.2.10 String CQLFactorRep::toString()const
|
124 humberto 1.1 {
|
125 chuck 1.3.2.5 if(_containedType == VALUE){
126 return _CQLVal.toString();
127 }
128
129 if(_containedType == FUNCTION)
|
130 humberto 1.1 {
131 return _CQLFunct.toString();
|
132 humberto 1.3.2.4 }else
|
133 humberto 1.1 {
134 return _CQLExp.toString();
135 }
136 }
137
|
138 david 1.3.2.8 void CQLFactorRep::applyContext(QueryContext& inContext,
139 CQLChainedIdentifier& inCid)
|
140 humberto 1.1 {
141
|
142 chuck 1.3.2.5 if(_containedType == FUNCTION)
|
143 humberto 1.1 {
|
144 chuck 1.3.2.6 _CQLFunct.applyContext(inContext);
|
145 humberto 1.1 }
|
146 chuck 1.3.2.5 else if(_containedType == EXPRESSION)
|
147 humberto 1.1 {
|
148 chuck 1.3.2.6 _CQLExp.applyContext(inContext);
|
149 humberto 1.1 }
150 else
151 {
|
152 david 1.3.2.8 _CQLVal.applyContext(inContext,inCid);
|
153 humberto 1.1 }
154 return;
155 }
156
|
157 humberto 1.3.2.10 Boolean CQLFactorRep::operator==(const CQLFactorRep& rep)const{
|
158 humberto 1.3.2.1 return true;
|
159 humberto 1.1 }
|
160 humberto 1.3.2.10 Boolean CQLFactorRep::operator!=(const CQLFactorRep& rep)const{
|
161 chuck 1.3.2.5 return (!operator==(rep));
|
162 humberto 1.1 }
163 PEGASUS_NAMESPACE_END
|