1 karl 1.5 //%2005////////////////////////////////////////////////////////////////////////
|
2 chuck 1.2 //
|
3 karl 1.5 // 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 chuck 1.2 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.5 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 chuck 1.2 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
13 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
|
18 david.dillard 1.6 //
|
19 chuck 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Authors: David Rosckes (rosckes@us.ibm.com)
31 // Bert Rivero (hurivero@us.ibm.com)
32 // Chuck Carmack (carmack@us.ibm.com)
|
33 david.dillard 1.6 // Brian Lucier (lucier@us.ibm.com)
|
34 chuck 1.2 //
|
35 david.dillard 1.6 // Modified By: David Dillard, VERITAS Software Corp.
36 // (david.dillard@veritas.com)
|
37 vijay.eli 1.7 // Vijay Eli, IBM (vijayeli@in.ibm.com) bug#3590
|
38 chuck 1.2 //
39 //%/////////////////////////////////////////////////////////////////////////////
40
41 #ifndef Pegasus_CQLPredicateRep_h
42 #define Pegasus_CQLPredicateRep_h
43
|
44 david.dillard 1.6 #include <Pegasus/CQL/Linkage.h>
|
45 chuck 1.2 #include <Pegasus/CQL/CQLSimplePredicate.h>
46
47
48 PEGASUS_NAMESPACE_BEGIN
49
50 class PEGASUS_QUERYCOMMON_LINKAGE QueryContext;
51 class PEGASUS_CQL_LINKAGE CQLFactory;
52
|
53 david.dillard 1.6 /**
|
54 chuck 1.2 This object is populated by Bison.
55
56 Valid operations for each type of CQLValue are in accordance with the DMTF
57 CQL Specification.
|
58 david.dillard 1.6
|
59 chuck 1.2 The CQLPredicate is considered "terminal" if it does not contain any
60 CQLPredicate objects.
61 A 'terminal' predicate can be evaluated to TRUE/FALSE by examining the
62 CQLExpressions and operator.
63 Valid operators are:
64 <, >, =, <=, >=, <>, IS NULL, IS NOT NULL, ISA, LIKE
65
|
66 david.dillard 1.6 CQLExpressions:
|
67 chuck 1.2 For an expression, CQLExpression::getValue is called and will return a
68 CQLValue.
69 The appropriate operator is then invoked on CQLValue and that operator
70 function will
71 enforce the type restrictions as documented in the DMTF CQL
72 Specification.
73 That operator then determines whether the predicate is TRUE / FALSE.
74
75
|
76 david.dillard 1.6 CQLPredicates:
|
77 chuck 1.2 The CQLPredicate is non-terminal if it contains only CQLPredicate
78 objects.
79 A non-terminal CQLPredicate is evaluated by in turn evaluating the
80 contained CQLPredicates and
81 boolean operator.
82 Valid operators are:
83 AND, OR
84
85 For the evaluate method on each CQLPredicate. the CQLPredicate is evaluated
|
86 david.dillard 1.6 to TRUE/FALSE and
|
87 chuck 1.2 the result of the evaluation is then applied to the appropriate boolean
|
88 david.dillard 1.6 operator.
|
89 chuck 1.2
90 The result of the evaluation is and then inverted if the _invert member
91 variable is set to TRUE
92 and then returned to the caller.
93
94 */
95 class PEGASUS_CQL_LINKAGE CQLPredicateRep
96 {
97 public:
98 CQLPredicateRep();
|
99 david.dillard 1.6
|
100 chuck 1.2 CQLPredicateRep(const CQLSimplePredicate & inSimplePredicate, Boolean inVerted = false);
101
102 CQLPredicateRep(const CQLPredicate & inPredicate, Boolean inVerted = false);
103
104 CQLPredicateRep(const CQLPredicateRep* rep);
105
106 ~CQLPredicateRep(){}
|
107 david.dillard 1.6 /**
108 CQLExpressions:
|
109 chuck 1.2 For an expression, CQLExpression::getValue is called and will return a
110 CQLValue.
111 The appropriate operator is then invoked on CQLValue and that operator
112 function will
113 enforce the type restrictions as documented in the DMTF CQL
114 Specification.
115 That operator then determines whether the predicate is TRUE / FALSE.
|
116 david.dillard 1.6
117
118 CQLPredicates:
|
119 chuck 1.2 The CQLPredicate is non-terminal if it contains only CQLPredicate
120 objects.
121 A non-terminal CQLPredicate is evaluated by in turn evaluating the
122 contained CQLPredicates and
123 boolean operator.
124 Valid operators are:
125 AND, OR
|
126 david.dillard 1.6
|
127 chuck 1.2 For the evaluate method on each CQLPredicate. the CQLPredicate is
|
128 david.dillard 1.6 evaluated to TRUE/FALSE and
|
129 chuck 1.2 the result of the evaluation is then applied to the appropriate boolean
|
130 david.dillard 1.6 operator.
131
|
132 chuck 1.2 The result of the evaluation is and then inverted if the _invert member
133 variable is set to TRUE
134 and then returned to the caller.
|
135 david.dillard 1.6
|
136 chuck 1.2 */
137 Boolean evaluate(CIMInstance CI, QueryContext& QueryCtx);
138
139 Boolean getInverted()const;
140
|
141 humberto 1.4 void setInverted(Boolean invert);
|
142 chuck 1.2
143 /** Appends a predicate to the predicate array. This method should only
144 be called by Bison.
145 */
|
146 humberto 1.3 void appendPredicate(const CQLPredicate& inPredicate);
147
|
148 chuck 1.2 void appendPredicate(const CQLPredicate& inPredicate, BooleanOpType inBooleanOperator);
149
150 Array<CQLPredicate> getPredicates()const;
|
151 david.dillard 1.6
|
152 chuck 1.2 CQLSimplePredicate getSimplePredicate()const;
153
154 Array<BooleanOpType> getOperators()const;
155
|
156 vijay.eli 1.7 void applyContext(const QueryContext& queryContext);
|
157 chuck 1.2
158 Boolean isSimple()const;
159
160 Boolean isSimpleValue()const;
161 String toString()const;
|
162 humberto 1.3
|
163 chuck 1.2 friend class CQLFactory;
164 private:
|
165 david.dillard 1.6
|
166 chuck 1.2 Array<CQLPredicate> _predicates;
167 CQLSimplePredicate _simplePredicate;
168 Array<BooleanOpType> _operators;
169
|
170 humberto 1.3 Boolean _invert;
|
171 chuck 1.2
172 };
173
174 PEGASUS_NAMESPACE_END
175
|
176 david.dillard 1.6 #endif
|