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