1 chuck 1.2 //%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.2 // 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 #ifndef Pegasus_CQLFunction_h
36 #define Pegasus_CQLFunction_h
37
38 #include <Pegasus/Common/Config.h>
39 #include <Pegasus/CQL/CQLValue.h>
40 #include <Pegasus/CQL/Linkage.h>
41 //#include <Pegasus/CQL/CQLExpression.h>
42 #include <Pegasus/CQL/CQLPredicate.h>
43 chuck 1.2
44 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
45
46 PEGASUS_NAMESPACE_BEGIN
47
48 class PEGASUS_CQL_LINKAGE CQLFactory;
49 class PEGASUS_CQL_LINKAGE CQLFunctionRep;
50 //class PEGASUS_CQL_LINKAGE CQLPredicate;
51
52 /** The Enum is private, the definition is public.
53 */
54 enum FunctionOpType
55 {
|
57 chuck 1.2 DATETIMETOMICROSECOND,
58 STRINGTOUINT,
59 STRINGTOSINT,
60 STRINGTOREAL,
61 STRINGTONUMERIC,
62 UPPERCASE,
63 NUMERICTOSTRING,
64 REFERENCETOSTRING,
65 CLASSNAME,
66 NAMESPACENAME,
67 NAMESPACETYPE,
68 HOSTPORT,
69 MODELPATH,
70 CLASSPATH,
71 OBJECTPATH,
72 INSTANCETOREFERENCE,
73 CURRENTDATETIME,
74 DATETIME,
75 MICROSECONDTOTIMESTAMP,
76 MICROSECONDTOINTERVAL
77 };
78 chuck 1.2 /**
79 CQLFunction objects are populated by the
80 Bison code.
81
82 Supported functions are in accordance with the
83 DMTF CQL Specification.
84 TODO: THIS LIST IS SUBJECT TO CHANGE
85
86 classname( <expr> )
87 classname( )
88 count(*)
89 count( distinct * )
90 count( distinct <expr> )
91 something for createarray
92 something for datetime
93 something for hostname
94 max( <expr> )
95 mean( <expr> )
96 median( <expr> )
97 min( <expr> )
98 something for modelpath
99 chuck 1.2 something for namespacename
100 something for namespacepath
101 something for objectpath
102 something for scheme
103 sum( <expr> )
104 something for userinfo
105 uppercase( <expr> )
106
107 */
108
109
110 class PEGASUS_CQL_LINKAGE CQLFunction
111 {
112 public:
113
114 CQLFunction();
115
116 CQLFunction(const CQLFunction& inFunc);
117
118 // CQLFunction(FunctionOpType inFunctionOpType, Array<CQLExpression> inParms);
119
120 chuck 1.2 CQLFunction(CQLIdentifier inOpType, Array<CQLPredicate> inParms);
121
122 ~CQLFunction();
123 /**
124 The getValue method validates the parms versus FunctionOpType.
125 (A) resolves prarameter types
126 (B) number of parms
127 and then actually executes the function.
128 Returns a CQLValue object that has already been resolved.
129 */
130 CQLValue resolveValue(const CIMInstance& CI, const QueryContext& queryCtx);
131
132 Array<CQLPredicate> getParms()const;
133
134 FunctionOpType getFunctionType()const;
135
136 String toString()const;
137
138 void applyContext(QueryContext& inContext);
139
140 CQLFunction& operator=(const CQLFunction& rhs);
141 chuck 1.2
|