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

Generated on Tue Feb 2 17:18:41 2010 for ACE by  doxygen 1.4.7