(file) Return to CQLFactory.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / CQL

  1 karl  1.7 //%2006////////////////////////////////////////////////////////////////////////
  2 chuck 1.3 //
  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.3 // 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.7 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12           // EMC Corporation; Symantec Corporation; The Open Group.
 13 chuck 1.3 //
 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.7 // 
 21 chuck 1.3 // 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           //          Brian Lucier (lucier@us.ibm.com)
 36           //
 37 david.dillard 1.6 // Modified By: David Dillard, VERITAS Software Corp.
 38                   //                  (david.dillard@veritas.com)
 39 chuck         1.3 //
 40                   //%/////////////////////////////////////////////////////////////////////////////
 41                   
 42 humberto      1.1 #ifndef Pegasus_CQLFactory_h
 43                   #define Pegasus_CQLFactory_h
 44 david.dillard 1.6 
 45                   #include <Pegasus/CQL/Linkage.h>
 46 chuck         1.3 #include <Pegasus/Common/ArrayInternal.h>
 47 humberto      1.1 #include <Pegasus/CQL/CQLValue.h>
 48                   #include <Pegasus/CQL/CQLChainedIdentifier.h>
 49 chuck         1.3 //#include <Pegasus/CQL/CQLSelectStatement.h>
 50 humberto      1.1 #include <Pegasus/CQL/CQLPredicate.h>
 51                   #include <Pegasus/CQL/CQLSimplePredicate.h>
 52                   #include <Pegasus/CQL/CQLIdentifier.h>
 53 chuck         1.3 
 54 humberto      1.1 #include <Pegasus/CQL/CQLTerm.h>
 55                   #include <Pegasus/CQL/CQLFactor.h>
 56 chuck         1.3 //#include <Pegasus/CQL/CQLParserState.h>
 57 humberto      1.1 #include <Pegasus/CQL/CQLExpression.h>
 58 chuck         1.3 #include <Pegasus/CQL/CQLFunction.h>
 59                   
 60                   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
 61 humberto      1.1 
 62                   PEGASUS_NAMESPACE_BEGIN
 63                   
 64 chuck         1.3 typedef struct CQLObjectPtr {
 65                           void* _ptr;
 66                   } CQLOBJECTPTR;
 67                   
 68                   /*
 69                   #ifndef PEGASUS_ARRAY_T
 70                   #define PEGASUS_ARRAY_T CQLObjectPtr
 71                   #include <Pegasus/Common/ArrayInter.h>
 72                   #undef PEGASUS_ARRAY_T
 73                   #endif
 74                   */
 75                   
 76 david.dillard 1.6 enum FactoryType { Identifier, ChainedIdentifier, Value, Function,
 77                                       Factor, Term, Expression, SimplePredicate, Predicate };
 78 humberto      1.1 
 79 humberto      1.4 /**
 80 david.dillard 1.6    The CQLFactory class enables the user to construct and access complex
 81                      CQL objects from simple objects without having to call each constructor
 82                      or each getter in the CQL object tree.
 83 humberto      1.4 
 84                      Three uses:
 85 david.dillard 1.6         makeObject - allows the caller to pass in a CQL object and a target
 86                           object type.  This returns the target type built from the initial
 87                           object.
 88                   
 89                           getObject  - allows caller to pass in a CQL object and target query
 90                           object type.  This returns the target type contained within the CQL
 91                           object passed in.
 92 humberto      1.4 
 93 david.dillard 1.6         setObject  - allows caller to pass in a CQLPredicate, and object to
 94                           set into the CQlPredicate and its type.
 95 humberto      1.4 */
 96                   
 97 mike          1.8 class CQLFactory
 98 humberto      1.1 {
 99                     public:
100 chuck         1.3   //CQLFactory();
101                     ~CQLFactory();
102 humberto      1.4 
103                     /**
104                         Makes a target type object from a CQLIdentifier
105 david.dillard 1.6 
106 humberto      1.4       @param  - obj.  The CQLIdentifier to make the object from
107                         @param  - target. The target type of the object to be constructed.
108 david.dillard 1.6       @return - A CQL object of type target cast to a void*.  Caller must
109                                   then cast to the appropriate type.
110 humberto      1.4       @throw  - None.
111                         <I><B>Experimental Interface</B></I><BR>
112                     */
113 humberto      1.1   void* makeObject(CQLIdentifier* obj, FactoryType target);
114 humberto      1.4 
115                     /**
116                         Makes a target type object from a CQLChainedIdentifier
117 david.dillard 1.6 
118 humberto      1.4       @param  - obj.  The CQLChainedIdentifier to make the object from
119                         @param  - target. The target type of the object to be constructed.
120 david.dillard 1.6       @return - A CQL object of type target cast to a void*.  Caller must
121                                   then cast to the appropriate type.
122 humberto      1.4       @throw  - None.
123                         <I><B>Experimental Interface</B></I><BR>
124                     */
125 humberto      1.1   void* makeObject(CQLChainedIdentifier* obj, FactoryType target);
126 humberto      1.4 
127                     /**
128                         Makes a target type object from a CQLValue
129 david.dillard 1.6 
130 humberto      1.4       @param  - obj.  The CQLValue to make the object from
131                         @param  - target. The target type of the object to be constructed.
132 david.dillard 1.6       @return - A CQL object of type target cast to a void*.  Caller must
133                                   then cast to the appropriate type.
134 humberto      1.4       @throw  - None.
135                         <I><B>Experimental Interface</B></I><BR>
136                     */
137 humberto      1.1   void* makeObject(CQLValue* obj, FactoryType target);
138 humberto      1.4 
139                     /**
140                         Makes a target type object from a CQLFactor
141 david.dillard 1.6 
142 humberto      1.4       @param  - obj.  The CQLFactor to make the object from
143                         @param  - target. The target type of the object to be constructed.
144 david.dillard 1.6       @return - A CQL object of type target cast to a void*.  Caller must
145                                   then cast to the appropriate type.
146 humberto      1.4       @throw  - None.
147                         <I><B>Experimental Interface</B></I><BR>
148                     */
149 humberto      1.1   void* makeObject(CQLFactor* obj, FactoryType target);
150 humberto      1.4 
151                     /**
152                         Makes a target type object from a CQLFunction
153 david.dillard 1.6 
154 humberto      1.4       @param  - obj.  The CQLFunction to make the object from
155                         @param  - target. The target type of the object to be constructed.
156 david.dillard 1.6       @return - A CQL object of type target cast to a void*.  Caller must
157                                   then cast to the appropriate type.
158 humberto      1.4       @throw  - None.
159                         <I><B>Experimental Interface</B></I><BR>
160                     */
161 chuck         1.3   void* makeObject(CQLFunction* obj, FactoryType target);
162 humberto      1.4 
163                     /**
164                         Makes a target type object from a CQLTerm
165 david.dillard 1.6 
166 humberto      1.4       @param  - obj.  The CQLTerm to make the object from
167                         @param  - target. The target type of the object to be constructed.
168 david.dillard 1.6       @return - A CQL object of type target cast to a void*.  Caller must
169                                   then cast to the appropriate type.
170 humberto      1.4       @throw  - None.
171                         <I><B>Experimental Interface</B></I><BR>
172                     */
173 humberto      1.1   void* makeObject(CQLTerm* obj, FactoryType target);
174 humberto      1.4 
175                     /**
176                         Makes a target type object from a CQLExpression
177 david.dillard 1.6 
178 humberto      1.4       @param  - obj.  The CQLExpression to make the object from
179                         @param  - target. The target type of the object to be constructed.
180 david.dillard 1.6       @return - A CQL object of type target cast to a void*.  Caller must
181                                   then cast to the appropriate type.
182 humberto      1.4       @throw  - None.
183                         <I><B>Experimental Interface</B></I><BR>
184                     */
185 humberto      1.1   void* makeObject(CQLExpression* obj, FactoryType target);
186 humberto      1.4 
187                     /**
188                         Makes a target type object from a CQLSimplePredicate
189 david.dillard 1.6 
190 humberto      1.4       @param  - obj.  The CQLSimplePredicate to make the object from
191                         @param  - target. The target type of the object to be constructed.
192 david.dillard 1.6       @return - A CQL object of type target cast to a void*.  Caller must
193                                   then cast to the appropriate type.
194 humberto      1.4       @throw  - None.
195                         <I><B>Experimental Interface</B></I><BR>
196                     */
197 humberto      1.1   void* makeObject(CQLSimplePredicate* obj, FactoryType target);
198 david.dillard 1.6 
199 humberto      1.4   /**
200 david.dillard 1.6       Returns an object of targetType contained within CQL object being
201                         passed in.
202                         This method is a general use method that internally calls one of the
203                         specific getObject flavors.
204                   
205 humberto      1.4       @param  - inObject.  The object to extract the target type from.
206                         @param  - inObjectType. The target type of the object being passed in.
207 david.dillard 1.6       @param  - targetType. The target type of the object to extract from the
208                                   CQL object passed in.
209                         @return - A CQL object of type target cast to a void*.  Caller must then
210                                   cast to the appropriate type.
211 humberto      1.4       @throw  - None.
212                         <I><B>Experimental Interface</B></I><BR>
213                     */
214 chuck         1.3   void* getObject(void* inObject, FactoryType inObjectType, FactoryType targetType);
215                   
216                     void* getObject(CQLChainedIdentifier* obj, FactoryType target);
217                     void* getObject(CQLValue* obj, FactoryType target);
218                     void* getObject(CQLFactor* obj, FactoryType target);
219                     void* getObject(CQLTerm* obj, FactoryType target);
220                     void* getObject(CQLExpression* obj, FactoryType target);
221                     void* getObject(CQLSimplePredicate* obj, FactoryType target);
222                     void* getObject(CQLPredicate* obj, FactoryType target);
223 david.dillard 1.6 
224 humberto      1.4   /**
225 david.dillard 1.6       Sets an object of targetType into the CQLPredicate.
226                         The caller may want to replace the CQLValue within the CQLPredicate.
227                         This enables the caller to do this with one call.
228                   
229 humberto      1.4       @param  - predicate.  The CQLPredicate to set the target type object into.
230                         @param  - obj.  The object to set into the CQLPredicate
231                         @param  - objType. The type of "obj"
232                         @return - None.
233                         @throw  - None.
234                         <I><B>Experimental Interface</B></I><BR>
235                     */
236 chuck         1.3   void setObject(CQLPredicate* predicate, void* obj, FactoryType objType);
237 humberto      1.4 
238                   
239                     /**
240 david.dillard 1.6       Frees all memory allocated.
241 humberto      1.4 
242                         @param  - None.
243                         @return - None.
244                         @throw  - None.
245                         <I><B>Experimental Interface</B></I><BR>
246                     */
247 chuck         1.3   void cleanup();
248 david.dillard 1.6 private:
249 chuck         1.3   void cleanupArray(Array<CQLObjectPtr>& arr, FactoryType type);
250                   
251                     Array<CQLObjectPtr> _makeObjectPredicates;
252                     Array<CQLObjectPtr> _makeObjectSimplePredicates;
253                     Array<CQLObjectPtr> _makeObjectExpressions;
254                     Array<CQLObjectPtr> _makeObjectTerms;
255                     Array<CQLObjectPtr> _makeObjectFactors;
256                     Array<CQLObjectPtr> _makeObjectFunctions;
257                     Array<CQLObjectPtr> _makeObjectValues;
258                     Array<CQLObjectPtr> _makeObjectChainedIdentifiers;
259                     Array<CQLObjectPtr> _makeObjectIdentifiers;
260                   
261                     Array<CQLObjectPtr> _getObjectPredicates;
262                     Array<CQLObjectPtr> _getObjectSimplePredicates;
263                     Array<CQLObjectPtr> _getObjectExpressions;
264                     Array<CQLObjectPtr> _getObjectTerms;
265                     Array<CQLObjectPtr> _getObjectFactors;
266                     Array<CQLObjectPtr> _getObjectFunctions;
267                     Array<CQLObjectPtr> _getObjectValues;
268                     Array<CQLObjectPtr> _getObjectChainedIdentifiers;
269                     Array<CQLObjectPtr> _getObjectIdentifiers;
270 chuck         1.3 
271 david.dillard 1.6 };
272 humberto      1.1 PEGASUS_NAMESPACE_END
273                   #endif
274 chuck         1.3 #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2