1 humberto 1.1 #include "CQLFactorRep.h"
2 #include <Pegasus/CQL/CQLExpression.h>
3 #include <Pegasus/CQL/CQLFunction.h>
4 #include <Pegasus/CQL/CQLFactory.h>
5 #include <Pegasus/CQL/CQLValue.h>
6 #include <Pegasus/CQL/CQLScope.h>
7 #include <Pegasus/CQL/QueryContext.h>
8
9 PEGASUS_NAMESPACE_BEGIN
10 /*
11 #define PEGASUS_ARRAY_T CQLFactorRep
12 #include <Pegasus/Common/ArrayImpl.h>
13 #undef PEGASUS_ARRAY_T
14 */
|
15 humberto 1.3.2.3 CQLFactorRep::CQLFactorRep(const CQLFactorRep* rep)
|
16 humberto 1.1 {
|
17 humberto 1.3.2.3 _CQLVal = rep->_CQLVal;
18 _CQLFunct = rep->_CQLFunct;
19 _CQLExp = rep->_CQLExp;
20 _invert = rep->_invert;
21 _simpleValue = rep->_simpleValue;
|
22 chuck 1.3.2.5 _containedType = rep->_containedType;
|
23 humberto 1.1 }
24
|
25 humberto 1.3.2.4 CQLFactorRep::CQLFactorRep(const CQLValue& inCQLVal)
|
26 humberto 1.1 {
27 _CQLVal = inCQLVal;
28 _simpleValue = true;
|
29 chuck 1.3.2.5 _containedType = VALUE;
|
30 humberto 1.1 }
31
32 CQLFactorRep::CQLFactorRep(CQLExpression& inCQLExp)
33 {
34 _CQLExp = inCQLExp;
35 _simpleValue = false;
|
36 chuck 1.3.2.5 _containedType = EXPRESSION;
|
37 humberto 1.1 }
38
39 CQLFactorRep::CQLFactorRep(CQLFunction& inCQLFunc)
40 {
41 _CQLFunct = inCQLFunc;
42 _simpleValue = false;
|
43 chuck 1.3.2.5 _containedType = FUNCTION;
|
44 humberto 1.1 }
45
46 CQLValue CQLFactorRep::getValue()
47 {
48 return _CQLVal;
49 }
50
51 CQLValue CQLFactorRep::resolveValue(CIMInstance CI, QueryContext& QueryCtx)
52 {
53
|
54 chuck 1.3.2.5 if(_containedType == EXPRESSION)
|
55 humberto 1.1 {
56 return _CQLExp.resolveValue(CI,QueryCtx);
57 }
|
58 chuck 1.3.2.5 else if (_containedType == FUNCTION)
|
59 humberto 1.1 {
60 return _CQLFunct.resolveValue(CI,QueryCtx);
61 }
62 else
63 {
64 _CQLVal.resolve(CI,QueryCtx);
65 return _CQLVal;
66 }
67 }
68
|
69 humberto 1.3.2.2 Boolean CQLFactorRep::isSimple()
70 {
71 return _simpleValue;
72 }
73
|
74 humberto 1.1 Boolean CQLFactorRep::isSimpleValue()
75 {
76 return _simpleValue;
77 }
78
79 CQLFunction CQLFactorRep::getCQLFunction()
80 {
81 return _CQLFunct;
82 }
83
84 CQLExpression CQLFactorRep::getCQLExpression()
85 {
86 return _CQLExp;
87 }
88
89 String CQLFactorRep::toString()
90 {
|
91 chuck 1.3.2.5 printf("CQLFactorRep::toString()\n");
92 if(_containedType == VALUE){
93 return _CQLVal.toString();
94 }
95
96 if(_containedType == FUNCTION)
|
97 humberto 1.1 {
98 return _CQLFunct.toString();
|
99 humberto 1.3.2.4 }else
|
100 humberto 1.1 {
101 return _CQLExp.toString();
102 }
103 }
104
|
105 chuck 1.3.2.5 void CQLFactorRep::applyContext(QueryContext& inContext)
|
106 humberto 1.1 {
107
|
108 chuck 1.3.2.5 if(_containedType == FUNCTION)
|
109 humberto 1.1 {
|
110 chuck 1.3.2.6 _CQLFunct.applyContext(inContext);
|
111 humberto 1.1 }
|
112 chuck 1.3.2.5 else if(_containedType == EXPRESSION)
|
113 humberto 1.1 {
|
114 chuck 1.3.2.6 _CQLExp.applyContext(inContext);
|
115 humberto 1.1 }
116 else
117 {
|
118 chuck 1.3.2.6 _CQLVal.applyContext(inContext);
|
119 humberto 1.1 }
120 return;
121 }
122
123 Boolean CQLFactorRep::operator==(const CQLFactorRep& rep){
|
124 humberto 1.3.2.1 return true;
|
125 humberto 1.1 }
126 Boolean CQLFactorRep::operator!=(const CQLFactorRep& rep){
|
127 chuck 1.3.2.5 return (!operator==(rep));
|
128 humberto 1.1 }
129 PEGASUS_NAMESPACE_END
|