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

  1 martin 1.10 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.11 //
  3 martin 1.10 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.11 //
 10 martin 1.10 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.11 //
 17 martin 1.10 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.11 //
 20 martin 1.10 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.11 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.10 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.11 //
 28 martin 1.10 //////////////////////////////////////////////////////////////////////////
 29 chuck  1.3  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32 humberto 1.1  #ifndef Pegasus_CQLFactory_h
 33               #define Pegasus_CQLFactory_h
 34 david.dillard 1.6  
 35                    #include <Pegasus/CQL/Linkage.h>
 36 chuck         1.3  #include <Pegasus/Common/ArrayInternal.h>
 37 humberto      1.1  #include <Pegasus/CQL/CQLValue.h>
 38                    #include <Pegasus/CQL/CQLChainedIdentifier.h>
 39 chuck         1.3  //#include <Pegasus/CQL/CQLSelectStatement.h>
 40 humberto      1.1  #include <Pegasus/CQL/CQLPredicate.h>
 41                    #include <Pegasus/CQL/CQLSimplePredicate.h>
 42                    #include <Pegasus/CQL/CQLIdentifier.h>
 43 chuck         1.3  
 44 humberto      1.1  #include <Pegasus/CQL/CQLTerm.h>
 45                    #include <Pegasus/CQL/CQLFactor.h>
 46 chuck         1.3  //#include <Pegasus/CQL/CQLParserState.h>
 47 humberto      1.1  #include <Pegasus/CQL/CQLExpression.h>
 48 chuck         1.3  #include <Pegasus/CQL/CQLFunction.h>
 49                    
 50                    #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
 51 humberto      1.1  
 52                    PEGASUS_NAMESPACE_BEGIN
 53                    
 54 chuck         1.3  typedef struct CQLObjectPtr {
 55                            void* _ptr;
 56                    } CQLOBJECTPTR;
 57                    
 58                    /*
 59                    #ifndef PEGASUS_ARRAY_T
 60                    #define PEGASUS_ARRAY_T CQLObjectPtr
 61                    #include <Pegasus/Common/ArrayInter.h>
 62                    #undef PEGASUS_ARRAY_T
 63                    #endif
 64                    */
 65                    
 66 david.dillard 1.6  enum FactoryType { Identifier, ChainedIdentifier, Value, Function,
 67                                        Factor, Term, Expression, SimplePredicate, Predicate };
 68 humberto      1.1  
 69 humberto      1.4  /**
 70 david.dillard 1.6     The CQLFactory class enables the user to construct and access complex
 71                       CQL objects from simple objects without having to call each constructor
 72                       or each getter in the CQL object tree.
 73 humberto      1.4  
 74                       Three uses:
 75 david.dillard 1.6          makeObject - allows the caller to pass in a CQL object and a target
 76                            object type.  This returns the target type built from the initial
 77                            object.
 78                    
 79                            getObject  - allows caller to pass in a CQL object and target query
 80                            object type.  This returns the target type contained within the CQL
 81                            object passed in.
 82 humberto      1.4  
 83 david.dillard 1.6          setObject  - allows caller to pass in a CQLPredicate, and object to
 84                            set into the CQlPredicate and its type.
 85 humberto      1.4  */
 86                    
 87 mike          1.8  class CQLFactory
 88 humberto      1.1  {
 89                      public:
 90 chuck         1.3    //CQLFactory();
 91                      ~CQLFactory();
 92 humberto      1.4  
 93                      /**
 94                          Makes a target type object from a CQLIdentifier
 95 david.dillard 1.6  
 96 humberto      1.4        @param  - obj.  The CQLIdentifier to make the object from
 97                          @param  - target. The target type of the object to be constructed.
 98 david.dillard 1.6        @return - A CQL object of type target cast to a void*.  Caller must
 99                                    then cast to the appropriate type.
100 humberto      1.4        @throw  - None.
101                          <I><B>Experimental Interface</B></I><BR>
102                      */
103 humberto      1.1    void* makeObject(CQLIdentifier* obj, FactoryType target);
104 humberto      1.4  
105                      /**
106                          Makes a target type object from a CQLChainedIdentifier
107 david.dillard 1.6  
108 humberto      1.4        @param  - obj.  The CQLChainedIdentifier to make the object from
109                          @param  - target. The target type of the object to be constructed.
110 david.dillard 1.6        @return - A CQL object of type target cast to a void*.  Caller must
111                                    then cast to the appropriate type.
112 humberto      1.4        @throw  - None.
113                          <I><B>Experimental Interface</B></I><BR>
114                      */
115 humberto      1.1    void* makeObject(CQLChainedIdentifier* obj, FactoryType target);
116 humberto      1.4  
117                      /**
118                          Makes a target type object from a CQLValue
119 david.dillard 1.6  
120 humberto      1.4        @param  - obj.  The CQLValue to make the object from
121                          @param  - target. The target type of the object to be constructed.
122 david.dillard 1.6        @return - A CQL object of type target cast to a void*.  Caller must
123                                    then cast to the appropriate type.
124 humberto      1.4        @throw  - None.
125                          <I><B>Experimental Interface</B></I><BR>
126                      */
127 humberto      1.1    void* makeObject(CQLValue* obj, FactoryType target);
128 humberto      1.4  
129                      /**
130                          Makes a target type object from a CQLFactor
131 david.dillard 1.6  
132 humberto      1.4        @param  - obj.  The CQLFactor to make the object from
133                          @param  - target. The target type of the object to be constructed.
134 david.dillard 1.6        @return - A CQL object of type target cast to a void*.  Caller must
135                                    then cast to the appropriate type.
136 humberto      1.4        @throw  - None.
137                          <I><B>Experimental Interface</B></I><BR>
138                      */
139 humberto      1.1    void* makeObject(CQLFactor* obj, FactoryType target);
140 humberto      1.4  
141                      /**
142                          Makes a target type object from a CQLFunction
143 david.dillard 1.6  
144 humberto      1.4        @param  - obj.  The CQLFunction to make the object from
145                          @param  - target. The target type of the object to be constructed.
146 david.dillard 1.6        @return - A CQL object of type target cast to a void*.  Caller must
147                                    then cast to the appropriate type.
148 humberto      1.4        @throw  - None.
149                          <I><B>Experimental Interface</B></I><BR>
150                      */
151 chuck         1.3    void* makeObject(CQLFunction* obj, FactoryType target);
152 humberto      1.4  
153                      /**
154                          Makes a target type object from a CQLTerm
155 david.dillard 1.6  
156 humberto      1.4        @param  - obj.  The CQLTerm to make the object from
157                          @param  - target. The target type of the object to be constructed.
158 david.dillard 1.6        @return - A CQL object of type target cast to a void*.  Caller must
159                                    then cast to the appropriate type.
160 humberto      1.4        @throw  - None.
161                          <I><B>Experimental Interface</B></I><BR>
162                      */
163 humberto      1.1    void* makeObject(CQLTerm* obj, FactoryType target);
164 humberto      1.4  
165                      /**
166                          Makes a target type object from a CQLExpression
167 david.dillard 1.6  
168 humberto      1.4        @param  - obj.  The CQLExpression to make the object from
169                          @param  - target. The target type of the object to be constructed.
170 david.dillard 1.6        @return - A CQL object of type target cast to a void*.  Caller must
171                                    then cast to the appropriate type.
172 humberto      1.4        @throw  - None.
173                          <I><B>Experimental Interface</B></I><BR>
174                      */
175 humberto      1.1    void* makeObject(CQLExpression* obj, FactoryType target);
176 humberto      1.4  
177                      /**
178                          Makes a target type object from a CQLSimplePredicate
179 david.dillard 1.6  
180 humberto      1.4        @param  - obj.  The CQLSimplePredicate to make the object from
181                          @param  - target. The target type of the object to be constructed.
182 david.dillard 1.6        @return - A CQL object of type target cast to a void*.  Caller must
183                                    then cast to the appropriate type.
184 humberto      1.4        @throw  - None.
185                          <I><B>Experimental Interface</B></I><BR>
186                      */
187 humberto      1.1    void* makeObject(CQLSimplePredicate* obj, FactoryType target);
188 david.dillard 1.6  
189 humberto      1.4    /**
190 david.dillard 1.6        Returns an object of targetType contained within CQL object being
191                          passed in.
192                          This method is a general use method that internally calls one of the
193                          specific getObject flavors.
194                    
195 humberto      1.4        @param  - inObject.  The object to extract the target type from.
196                          @param  - inObjectType. The target type of the object being passed in.
197 david.dillard 1.6        @param  - targetType. The target type of the object to extract from the
198                                    CQL object passed in.
199                          @return - A CQL object of type target cast to a void*.  Caller must then
200                                    cast to the appropriate type.
201 humberto      1.4        @throw  - None.
202                          <I><B>Experimental Interface</B></I><BR>
203                      */
204 karl          1.9    void* getObject(void* inObject, FactoryType inObjectType,
205                              FactoryType targetType);
206 chuck         1.3  
207                      void* getObject(CQLChainedIdentifier* obj, FactoryType target);
208                      void* getObject(CQLValue* obj, FactoryType target);
209                      void* getObject(CQLFactor* obj, FactoryType target);
210                      void* getObject(CQLTerm* obj, FactoryType target);
211                      void* getObject(CQLExpression* obj, FactoryType target);
212                      void* getObject(CQLSimplePredicate* obj, FactoryType target);
213                      void* getObject(CQLPredicate* obj, FactoryType target);
214 david.dillard 1.6  
215 humberto      1.4    /**
216 david.dillard 1.6        Sets an object of targetType into the CQLPredicate.
217                          The caller may want to replace the CQLValue within the CQLPredicate.
218                          This enables the caller to do this with one call.
219                    
220 humberto      1.4        @param  - predicate.  The CQLPredicate to set the target type object into.
221                          @param  - obj.  The object to set into the CQLPredicate
222                          @param  - objType. The type of "obj"
223                          @return - None.
224                          @throw  - None.
225                          <I><B>Experimental Interface</B></I><BR>
226                      */
227 chuck         1.3    void setObject(CQLPredicate* predicate, void* obj, FactoryType objType);
228 humberto      1.4  
229                    
230                      /**
231 david.dillard 1.6        Frees all memory allocated.
232 humberto      1.4  
233                          @param  - None.
234                          @return - None.
235                          @throw  - None.
236                          <I><B>Experimental Interface</B></I><BR>
237                      */
238 chuck         1.3    void cleanup();
239 david.dillard 1.6  private:
240 chuck         1.3    void cleanupArray(Array<CQLObjectPtr>& arr, FactoryType type);
241                    
242                      Array<CQLObjectPtr> _makeObjectPredicates;
243                      Array<CQLObjectPtr> _makeObjectSimplePredicates;
244                      Array<CQLObjectPtr> _makeObjectExpressions;
245                      Array<CQLObjectPtr> _makeObjectTerms;
246                      Array<CQLObjectPtr> _makeObjectFactors;
247                      Array<CQLObjectPtr> _makeObjectFunctions;
248                      Array<CQLObjectPtr> _makeObjectValues;
249                      Array<CQLObjectPtr> _makeObjectChainedIdentifiers;
250                      Array<CQLObjectPtr> _makeObjectIdentifiers;
251                    
252                      Array<CQLObjectPtr> _getObjectPredicates;
253                      Array<CQLObjectPtr> _getObjectSimplePredicates;
254                      Array<CQLObjectPtr> _getObjectExpressions;
255                      Array<CQLObjectPtr> _getObjectTerms;
256                      Array<CQLObjectPtr> _getObjectFactors;
257                      Array<CQLObjectPtr> _getObjectFunctions;
258                      Array<CQLObjectPtr> _getObjectValues;
259                      Array<CQLObjectPtr> _getObjectChainedIdentifiers;
260                      Array<CQLObjectPtr> _getObjectIdentifiers;
261 chuck         1.3  
262 david.dillard 1.6  };
263 humberto      1.1  PEGASUS_NAMESPACE_END
264                    #endif
265 chuck         1.3  #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2