Parse_Node.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Parse_Node.h
00006  *
00007  *  $Id: Parse_Node.h 79075 2007-07-30 11:24:34Z johnnyw $
00008  *
00009  *  @author Doug Schmidt
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_PARSE_NODE_H
00015 #define ACE_PARSE_NODE_H
00016 
00017 #include /**/ "ace/pre.h"
00018 
00019 #include /**/ "ace/config-all.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #if (ACE_USES_CLASSIC_SVC_CONF == 1)
00026 
00027 #include "ace/DLL.h"
00028 #include "ace/Svc_Conf.h"
00029 
00030 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 /// Forward declarations.
00033 class ACE_Service_Config;
00034 class ACE_Service_Type;
00035 
00036 /**
00037  * @class ACE_Parse_Node
00038  *
00039  * @brief Provide the base of the object hierarchy that defines the parse
00040  * tree of Service Nodes.
00041  *
00042  * @note This class is only meant for INTERNAL use by ACE.
00043  *
00044  * @internal
00045  */
00046 class ACE_Parse_Node
00047 {
00048 public:
00049   ACE_Parse_Node (void);
00050   explicit ACE_Parse_Node (const ACE_TCHAR *name);
00051   virtual ~ACE_Parse_Node (void);
00052 
00053   ACE_Parse_Node *link (void) const;
00054   void link (ACE_Parse_Node *);
00055 
00056   /// Will update the yyereno member and/or the corresponding configuration
00057   virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno) = 0;
00058 
00059   const ACE_TCHAR *name (void) const;
00060   void print (void) const;
00061 
00062   /// Dump the state of an object.
00063   void dump (void) const;
00064 
00065   /// Declare the dynamic allocation hooks.
00066   ACE_ALLOC_HOOK_DECLARE;
00067 
00068 private:
00069   const ACE_TCHAR *name_;
00070   ACE_Parse_Node *next_;
00071 
00072 private:
00073   ACE_UNIMPLEMENTED_FUNC (ACE_Parse_Node (const ACE_Parse_Node&))
00074   ACE_UNIMPLEMENTED_FUNC (ACE_Parse_Node& operator= (const ACE_Parse_Node&))
00075 };
00076 
00077 /**
00078  * @class ACE_Suspend_Node
00079  *
00080  * @brief Suspend a Service Node.
00081  *
00082  * @note This class is only meant for INTERNAL use by ACE.
00083  *
00084  * @internal
00085  */
00086 class ACE_Suspend_Node : public ACE_Parse_Node
00087 {
00088 public:
00089   ACE_Suspend_Node (const ACE_TCHAR *name);
00090   ~ACE_Suspend_Node (void);
00091 
00092   virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
00093 
00094   /// Dump the state of an object.
00095   void dump (void) const;
00096 
00097   /// Declare the dynamic allocation hooks.
00098   ACE_ALLOC_HOOK_DECLARE;
00099 
00100 private:
00101   ACE_UNIMPLEMENTED_FUNC (ACE_Suspend_Node (const ACE_Suspend_Node&))
00102   ACE_UNIMPLEMENTED_FUNC (ACE_Suspend_Node& operator= (const ACE_Suspend_Node&))
00103 };
00104 
00105 /**
00106  * @class ACE_Resume_Node
00107  *
00108  * @brief Resume a Service Node.
00109  *
00110  * @note This class is only meant for INTERNAL use by ACE.
00111  *
00112  * @internal
00113  */
00114 class ACE_Resume_Node : public ACE_Parse_Node
00115 {
00116 public:
00117   ACE_Resume_Node (const ACE_TCHAR *name);
00118   ~ACE_Resume_Node (void);
00119 
00120   virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
00121 
00122   /// Dump the state of an object.
00123   void dump (void) const;
00124 
00125   /// Declare the dynamic allocation hooks.
00126   ACE_ALLOC_HOOK_DECLARE;
00127 
00128 private:
00129   ACE_UNIMPLEMENTED_FUNC (ACE_Resume_Node (const ACE_Resume_Node&))
00130   ACE_UNIMPLEMENTED_FUNC (ACE_Resume_Node& operator= (const ACE_Resume_Node&))
00131 };
00132 
00133 /**
00134  * @class ACE_Remove_Node
00135  *
00136  * @brief Remove a Service Node.
00137  *
00138  * @note This class is only meant for INTERNAL use by ACE.
00139  *
00140  * @internal
00141  */
00142 class ACE_Remove_Node : public ACE_Parse_Node
00143 {
00144 public:
00145   ACE_Remove_Node (const ACE_TCHAR *name);
00146   ~ACE_Remove_Node (void);
00147 
00148   virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
00149 
00150   /// Dump the state of an object.
00151   void dump (void) const;
00152 
00153   /// Declare the dynamic allocation hooks.
00154   ACE_ALLOC_HOOK_DECLARE;
00155 
00156 private:
00157   ACE_UNIMPLEMENTED_FUNC (ACE_Remove_Node (const ACE_Remove_Node&))
00158   ACE_UNIMPLEMENTED_FUNC (ACE_Remove_Node& operator= (const ACE_Remove_Node&))
00159 };
00160 
00161 /**
00162  * @class ACE_Static_Node
00163  *
00164  * @brief Handle a statically linked node.
00165  *
00166  * @note This class is only meant for INTERNAL use by ACE.
00167  *
00168  * @internal
00169  */
00170 class ACE_Static_Node : public ACE_Parse_Node
00171 {
00172 public:
00173   ACE_Static_Node (const ACE_TCHAR *name, ACE_TCHAR *params = 0);
00174   virtual ~ACE_Static_Node (void);
00175 
00176   virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
00177   virtual const ACE_Service_Type *record (const ACE_Service_Gestalt *g) const;
00178 
00179   ACE_TCHAR *parameters (void) const;
00180 
00181   /// Dump the state of an object.
00182   void dump (void) const;
00183 
00184   /// Declare the dynamic allocation hooks.
00185   ACE_ALLOC_HOOK_DECLARE;
00186 
00187 private:
00188   /// "Command-line" parameters.
00189   ACE_TCHAR *parameters_;
00190 
00191 private:
00192   ACE_UNIMPLEMENTED_FUNC (ACE_Static_Node (const ACE_Static_Node&))
00193   ACE_UNIMPLEMENTED_FUNC (ACE_Static_Node& operator= (const ACE_Static_Node&))
00194 };
00195 
00196 
00197 class ACE_Service_Type_Factory;
00198 
00199 /**
00200  * @class ACE_Dynamic_Node
00201  *
00202  * @brief Handle a dynamically linked node.
00203  *
00204  * @note This class is only meant for INTERNAL use by ACE.
00205  *
00206  * @internal
00207  */
00208 class ACE_Dynamic_Node : public ACE_Static_Node
00209 {
00210 public:
00211   ACE_Dynamic_Node (ACE_Service_Type_Factory const *, ACE_TCHAR *params);
00212 
00213   virtual ~ACE_Dynamic_Node (void);
00214 
00215   //  virtual const ACE_Service_Type *record (void) const;
00216   virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
00217 
00218   /// Dump the state of an object.
00219   void dump (void) const;
00220 
00221   /// Declare the dynamic allocation hooks.
00222   ACE_ALLOC_HOOK_DECLARE;
00223 
00224 private:
00225   /// Pointer to a descriptor that describes this node.
00226   ACE_Auto_Ptr<const ACE_Service_Type_Factory> factory_;
00227 
00228 private:
00229   ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Node (const ACE_Dynamic_Node&))
00230   ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Node& operator= (const ACE_Dynamic_Node&))
00231 };
00232 
00233 /**
00234  * @class ACE_Stream_Node
00235  *
00236  * @brief Handle a Stream.
00237  *
00238  * @note This class is only meant for INTERNAL use by ACE.
00239  *
00240  * @internal
00241  */
00242 class ACE_Stream_Node : public ACE_Parse_Node
00243 {
00244 public:
00245   ACE_Stream_Node (const ACE_Static_Node *, const ACE_Parse_Node *);
00246   virtual ~ACE_Stream_Node (void);
00247 
00248   virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
00249 
00250   /// Dump the state of an object.
00251   void dump (void) const;
00252 
00253   /// Declare the dynamic allocation hooks.
00254   ACE_ALLOC_HOOK_DECLARE;
00255 
00256 private:
00257   /// Linked list of modules that are part of the stream.
00258   const ACE_Static_Node *node_;
00259   const ACE_Parse_Node *mods_;
00260 
00261 private:
00262   ACE_UNIMPLEMENTED_FUNC (ACE_Stream_Node (const ACE_Stream_Node&))
00263   ACE_UNIMPLEMENTED_FUNC (ACE_Stream_Node& operator= (const ACE_Stream_Node&))
00264 };
00265 
00266 /**
00267  * @class ACE_Dummy_Node
00268  *
00269  * @brief I forget why this is here... ;-)
00270  * @brief Used in a special case of static STREAM definintion
00271  *
00272  * @note This class is only meant for INTERNAL use by ACE.
00273  */
00274 class ACE_Dummy_Node : public ACE_Parse_Node
00275 {
00276 public:
00277   ACE_Dummy_Node (const ACE_Static_Node *, const ACE_Parse_Node *);
00278   ~ACE_Dummy_Node (void);
00279 
00280   virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
00281 
00282   /// Dump the state of an object.
00283   void dump (void) const;
00284 
00285   /// Declare the dynamic allocation hooks.
00286   ACE_ALLOC_HOOK_DECLARE;
00287 
00288 private:
00289   /// Linked list of modules that we're dealing with.
00290   const ACE_Static_Node *node_;
00291   const ACE_Parse_Node *mods_;
00292 
00293 private:
00294   ACE_UNIMPLEMENTED_FUNC (ACE_Dummy_Node (const ACE_Dummy_Node&))
00295   ACE_UNIMPLEMENTED_FUNC (ACE_Dummy_Node& operator= (const ACE_Dummy_Node&))
00296 };
00297 
00298 /**
00299  * @class ACE_Location_Node
00300  *
00301  * @brief Keep track of where a shared library is located.
00302  *
00303  * @note This class is only meant for INTERNAL use by ACE.
00304  *
00305  * @internal
00306  */
00307 class ACE_Location_Node
00308 {
00309 public:
00310   ACE_Location_Node (void);
00311   const ACE_DLL &dll (void);
00312   const ACE_TCHAR *pathname (void) const;
00313   void pathname (const ACE_TCHAR *h);
00314   int dispose (void) const;
00315 
00316   virtual ~ACE_Location_Node (void);
00317   virtual void set_symbol (void *h);
00318 
00319   /// Will update the yyerrno member and/or corresponding configuration
00320   /// repository
00321   virtual void *symbol (ACE_Service_Gestalt *cfgptr,
00322                         int &yyerrno,
00323                         ACE_Service_Object_Exterminator * = 0) = 0;
00324 
00325   /// Dump the state of an object.
00326   void dump (void) const;
00327 
00328   /// Declare the dynamic allocation hooks.
00329   ACE_ALLOC_HOOK_DECLARE;
00330 
00331 protected:
00332   int open_dll (int & yyerrno);
00333 
00334   /// Pathname to the shared library we are working on.
00335   const ACE_TCHAR *pathname_;
00336 
00337   /**
00338    * Flag indicating whether the Service_Object generated by this
00339    * Location Node should be deleted or not
00340    * (ACE_Service_Type::DELETE_OBJ.)
00341    */
00342   int must_delete_;
00343 
00344   /// The open shared library.
00345   ACE_DLL dll_;
00346 
00347   /// Symbol that we've obtained from the shared library.
00348   void *symbol_;
00349 
00350 private:
00351   ACE_UNIMPLEMENTED_FUNC (ACE_Location_Node (const ACE_Location_Node&))
00352   ACE_UNIMPLEMENTED_FUNC (ACE_Location_Node& operator= (const ACE_Location_Node&))
00353 };
00354 
00355 /**
00356  * @class ACE_Object_Node
00357  *
00358  * @brief Keeps track of the symbol name for a shared object.
00359  *
00360  * @note This class is only meant for INTERNAL use by ACE.
00361  *
00362  * @internal
00363  */
00364 class ACE_Object_Node : public ACE_Location_Node
00365 {
00366 public:
00367   ACE_Object_Node (const ACE_TCHAR *pathname, const ACE_TCHAR *obj_name);
00368   virtual void *symbol (ACE_Service_Gestalt *config,
00369                         int &yyerrno,
00370                         ACE_Service_Object_Exterminator * = 0);
00371   virtual ~ACE_Object_Node (void);
00372 
00373   /// Dump the state of an object.
00374   void dump (void) const;
00375 
00376   /// Declare the dynamic allocation hooks.
00377   ACE_ALLOC_HOOK_DECLARE;
00378 
00379 private:
00380   /// Name of the object that we're parsing.
00381   const ACE_TCHAR *object_name_;
00382 
00383 private:
00384   ACE_UNIMPLEMENTED_FUNC (ACE_Object_Node (const ACE_Object_Node&))
00385   ACE_UNIMPLEMENTED_FUNC (ACE_Object_Node& operator= (const ACE_Object_Node&))
00386 };
00387 
00388 /**
00389  * @class ACE_Function_Node
00390  *
00391  * @brief Keeps track of the symbol name of for a shared function.
00392  *
00393  * @note This class is only meant for INTERNAL use by ACE.
00394  *
00395  * @internal
00396  */
00397 class ACE_Function_Node : public ACE_Location_Node
00398 {
00399 public:
00400   ACE_Function_Node (const ACE_TCHAR *pathname, const ACE_TCHAR *func_name);
00401   virtual void *symbol (ACE_Service_Gestalt *config,
00402                         int &yyerrno,
00403                         ACE_Service_Object_Exterminator *gobbler = 0);
00404   virtual ~ACE_Function_Node (void);
00405 
00406   /// Dump the state of an object.
00407   void dump (void) const;
00408 
00409   /// Declare the dynamic allocation hooks.
00410   ACE_ALLOC_HOOK_DECLARE;
00411 
00412 private:
00413 
00414   /// Return mangled function name that takes into account ACE
00415   /// versioned namespace.
00416   /**
00417    * This function embeds the ACE versioned namespace name into the
00418    * original function name if versioned namespace support has been
00419    * enabled and the original function name conforms to the ACE
00420    * Service Object factory function naming conventions.  For example
00421    * "@c _make_Foo" becomes "@c make_ACE_5_4_7_Foo".
00422    * @par
00423    * If versioned namespace support is disabled or the factory
00424    * function name does conform to ACE conventions, no mangling will
00425    * occur and the verbatim function name is returned.
00426    *
00427    * @return Function name that takes into account versioned namespace
00428    *         name.  Caller is responsible for calling operator
00429    *         delete[] or ACE::strdelete() on the returned string.
00430    */
00431   ACE_TCHAR * make_func_name (ACE_TCHAR const * func_name);
00432 
00433 private:
00434 
00435   /// Name of the function that we're parsing.
00436   const ACE_TCHAR *function_name_;
00437 
00438 private:
00439   ACE_UNIMPLEMENTED_FUNC (ACE_Function_Node (const ACE_Function_Node&))
00440   ACE_UNIMPLEMENTED_FUNC (ACE_Function_Node& operator= (const ACE_Function_Node&))
00441 };
00442 
00443 /**
00444  * @class ACE_Static_Function_Node
00445  *
00446  * @brief Keeps track of the symbol name for a function that is not
00447  * linked in from a DLL, but is statically linked with the
00448  * application.
00449  *
00450  * @note This class is only meant for INTERNAL use by ACE.
00451  *
00452  * @internal
00453  */
00454 class ACE_Static_Function_Node : public ACE_Location_Node
00455 {
00456 public:
00457   explicit ACE_Static_Function_Node (const ACE_TCHAR *func_name);
00458   virtual void *symbol (ACE_Service_Gestalt *config,
00459                         int &yyerrno,
00460                         ACE_Service_Object_Exterminator * = 0);
00461   virtual ~ACE_Static_Function_Node (void);
00462 
00463   /// Dump the state of an object.
00464   void dump (void) const;
00465 
00466   /// Declare the dynamic allocation hooks.
00467   ACE_ALLOC_HOOK_DECLARE;
00468 
00469 private:
00470   /// Name of the function that we're parsing.
00471   const ACE_TCHAR *function_name_;
00472 
00473 private:
00474   ACE_UNIMPLEMENTED_FUNC (ACE_Static_Function_Node (const ACE_Static_Function_Node&))
00475   ACE_UNIMPLEMENTED_FUNC (ACE_Static_Function_Node& operator= (const ACE_Static_Function_Node&))
00476 };
00477 
00478 /// A helper class used to safely register dynamic services, which may contains
00479 /// subordinate static services. It is used to capture the necessary data during
00480 /// the parsing, but perform the actuall instantiation later.
00481 class ACE_Service_Type_Factory
00482 {
00483 public:
00484   ACE_Service_Type_Factory (ACE_TCHAR const *name,
00485                             int type,
00486                             ACE_Location_Node *location,
00487                             int active);
00488 
00489   ~ACE_Service_Type_Factory (void);
00490 
00491   ACE_Service_Type *make_service_type (ACE_Service_Gestalt *pcfg) const;
00492 
00493   ACE_TCHAR const* name (void) const;
00494 
00495   /// Declare the dynamic allocation hooks.
00496   ACE_ALLOC_HOOK_DECLARE;
00497 
00498 private:
00499 
00500   /**
00501    * Not implemented to enforce no copying
00502    */
00503   ACE_UNIMPLEMENTED_FUNC
00504     (ACE_Service_Type_Factory(const ACE_Service_Type_Factory&))
00505 
00506   ACE_UNIMPLEMENTED_FUNC
00507     (ACE_Service_Type_Factory& operator=(const ACE_Service_Type_Factory&))
00508 
00509 private:
00510   ACE_TString name_;
00511   int type_;
00512   ACE_Auto_Ptr<ACE_Location_Node> location_;
00513   int is_active_;
00514 };
00515 
00516 ACE_END_VERSIONED_NAMESPACE_DECL
00517 
00518 #endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
00519 
00520 #include /**/ "ace/post.h"
00521 
00522 #endif  /* ACE_PARSE_NODE_H */

Generated on Sun Jan 27 12:05:34 2008 for ACE by doxygen 1.3.6