3 //=============================================================================
9 //=============================================================================
11 #ifndef ACE_PARSE_NODE_H
12 #define ACE_PARSE_NODE_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/config-all.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if (ACE_USES_CLASSIC_SVC_CONF == 1)
25 #include "ace/SString.h"
26 #include "ace/Svc_Conf.h"
29 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
31 /// Forward declarations.
32 class ACE_Service_Config
;
33 class ACE_Service_Type
;
36 * @class ACE_Parse_Node
38 * @brief Provide the base of the object hierarchy that defines the parse
39 * tree of Service Nodes.
41 * @note This class is only meant for INTERNAL use by ACE.
49 explicit ACE_Parse_Node (const ACE_TCHAR
*name
);
50 virtual ~ACE_Parse_Node ();
52 ACE_Parse_Node
*link () const;
53 void link (ACE_Parse_Node
*);
55 /// Will update the yyereno member and/or the corresponding configuration
56 virtual void apply (ACE_Service_Gestalt
*cfg
, int &yyerrno
) = 0;
58 const ACE_TCHAR
*name () const;
61 /// Dump the state of an object.
64 /// Declare the dynamic allocation hooks.
65 ACE_ALLOC_HOOK_DECLARE
;
68 const ACE_TCHAR
*name_
;
69 ACE_Parse_Node
*next_
;
72 ACE_Parse_Node (const ACE_Parse_Node
&) = delete;
73 ACE_Parse_Node
& operator= (const ACE_Parse_Node
&) = delete;
77 * @class ACE_Suspend_Node
79 * @brief Suspend a Service Node.
81 * @note This class is only meant for INTERNAL use by ACE.
85 class ACE_Suspend_Node
: public ACE_Parse_Node
88 ACE_Suspend_Node (const ACE_TCHAR
*name
);
91 virtual void apply (ACE_Service_Gestalt
*cfg
, int &yyerrno
);
93 /// Dump the state of an object.
96 /// Declare the dynamic allocation hooks.
97 ACE_ALLOC_HOOK_DECLARE
;
100 ACE_Suspend_Node (const ACE_Suspend_Node
&) = delete;
101 ACE_Suspend_Node
& operator= (const ACE_Suspend_Node
&) = delete;
105 * @class ACE_Resume_Node
107 * @brief Resume a Service Node.
109 * @note This class is only meant for INTERNAL use by ACE.
113 class ACE_Resume_Node
: public ACE_Parse_Node
116 ACE_Resume_Node (const ACE_TCHAR
*name
);
119 virtual void apply (ACE_Service_Gestalt
*cfg
, int &yyerrno
);
121 /// Dump the state of an object.
124 /// Declare the dynamic allocation hooks.
125 ACE_ALLOC_HOOK_DECLARE
;
128 ACE_Resume_Node (const ACE_Resume_Node
&) = delete;
129 ACE_Resume_Node
& operator= (const ACE_Resume_Node
&) = delete;
133 * @class ACE_Remove_Node
135 * @brief Remove a Service Node.
137 * @note This class is only meant for INTERNAL use by ACE.
141 class ACE_Remove_Node
: public ACE_Parse_Node
144 ACE_Remove_Node (const ACE_TCHAR
*name
);
147 virtual void apply (ACE_Service_Gestalt
*cfg
, int &yyerrno
);
149 /// Dump the state of an object.
152 /// Declare the dynamic allocation hooks.
153 ACE_ALLOC_HOOK_DECLARE
;
156 ACE_Remove_Node (const ACE_Remove_Node
&) = delete;
157 ACE_Remove_Node
& operator= (const ACE_Remove_Node
&) = delete;
161 * @class ACE_Static_Node
163 * @brief Handle a statically linked node.
165 * @note This class is only meant for INTERNAL use by ACE.
169 class ACE_Static_Node
: public ACE_Parse_Node
172 ACE_Static_Node (const ACE_TCHAR
*name
, ACE_TCHAR
*params
= 0);
173 virtual ~ACE_Static_Node ();
175 virtual void apply (ACE_Service_Gestalt
*cfg
, int &yyerrno
);
176 virtual const ACE_Service_Type
*record (const ACE_Service_Gestalt
*g
) const;
178 ACE_TCHAR
*parameters () const;
180 /// Dump the state of an object.
183 /// Declare the dynamic allocation hooks.
184 ACE_ALLOC_HOOK_DECLARE
;
187 /// "Command-line" parameters.
188 ACE_TCHAR
*parameters_
;
191 ACE_Static_Node (const ACE_Static_Node
&) = delete;
192 ACE_Static_Node
& operator= (const ACE_Static_Node
&) = delete;
196 class ACE_Service_Type_Factory
;
199 * @class ACE_Dynamic_Node
201 * @brief Handle a dynamically linked node.
203 * @note This class is only meant for INTERNAL use by ACE.
207 class ACE_Dynamic_Node
: public ACE_Static_Node
210 ACE_Dynamic_Node (ACE_Service_Type_Factory
const *, ACE_TCHAR
*params
);
212 virtual ~ACE_Dynamic_Node ();
214 // virtual const ACE_Service_Type *record () const;
215 virtual void apply (ACE_Service_Gestalt
*cfg
, int &yyerrno
);
217 /// Dump the state of an object.
220 /// Declare the dynamic allocation hooks.
221 ACE_ALLOC_HOOK_DECLARE
;
224 /// Pointer to a descriptor that describes this node.
225 std::unique_ptr
<const ACE_Service_Type_Factory
> factory_
;
228 ACE_Dynamic_Node (const ACE_Dynamic_Node
&) = delete;
229 ACE_Dynamic_Node
& operator= (const ACE_Dynamic_Node
&) = delete;
233 * @class ACE_Stream_Node
235 * @brief Handle a Stream.
237 * @note This class is only meant for INTERNAL use by ACE.
241 class ACE_Stream_Node
: public ACE_Parse_Node
244 ACE_Stream_Node (const ACE_Static_Node
*, const ACE_Parse_Node
*);
245 virtual ~ACE_Stream_Node ();
247 virtual void apply (ACE_Service_Gestalt
*cfg
, int &yyerrno
);
249 /// Dump the state of an object.
252 /// Declare the dynamic allocation hooks.
253 ACE_ALLOC_HOOK_DECLARE
;
256 /// Linked list of modules that are part of the stream.
257 const ACE_Static_Node
*node_
;
258 const ACE_Parse_Node
*mods_
;
261 ACE_Stream_Node (const ACE_Stream_Node
&) = delete;
262 ACE_Stream_Node
& operator= (const ACE_Stream_Node
&) = delete;
266 * @class ACE_Dummy_Node
268 * @brief I forget why this is here... ;-)
269 * @brief Used in a special case of static STREAM definintion
271 * @note This class is only meant for INTERNAL use by ACE.
273 class ACE_Dummy_Node
: public ACE_Parse_Node
276 ACE_Dummy_Node (const ACE_Static_Node
*, const ACE_Parse_Node
*);
279 virtual void apply (ACE_Service_Gestalt
*cfg
, int &yyerrno
);
281 /// Dump the state of an object.
284 /// Declare the dynamic allocation hooks.
285 ACE_ALLOC_HOOK_DECLARE
;
288 /// Linked list of modules that we're dealing with.
289 const ACE_Static_Node
*node_
;
290 const ACE_Parse_Node
*mods_
;
293 ACE_Dummy_Node (const ACE_Dummy_Node
&) = delete;
294 ACE_Dummy_Node
& operator= (const ACE_Dummy_Node
&) = delete;
298 * @class ACE_Location_Node
300 * @brief Keep track of where a shared library is located.
302 * @note This class is only meant for INTERNAL use by ACE.
306 class ACE_Location_Node
309 ACE_Location_Node ();
310 const ACE_DLL
&dll ();
311 const ACE_TCHAR
*pathname () const;
312 void pathname (const ACE_TCHAR
*h
);
313 int dispose () const;
315 virtual ~ACE_Location_Node ();
316 virtual void set_symbol (void *h
);
318 /// Will update the yyerrno member and/or corresponding configuration
320 virtual void *symbol (ACE_Service_Gestalt
*cfgptr
,
322 ACE_Service_Object_Exterminator
* = 0) = 0;
324 /// Dump the state of an object.
327 /// Declare the dynamic allocation hooks.
328 ACE_ALLOC_HOOK_DECLARE
;
331 int open_dll (int & yyerrno
);
333 /// Pathname to the shared library we are working on.
334 const ACE_TCHAR
*pathname_
;
337 * Flag indicating whether the Service_Object generated by this
338 * Location Node should be deleted or not
339 * (ACE_Service_Type::DELETE_OBJ.)
343 /// The open shared library.
346 /// Symbol that we've obtained from the shared library.
350 ACE_Location_Node (const ACE_Location_Node
&) = delete;
351 ACE_Location_Node
& operator= (const ACE_Location_Node
&) = delete;
355 * @class ACE_Object_Node
357 * @brief Keeps track of the symbol name for a shared object.
359 * @note This class is only meant for INTERNAL use by ACE.
363 class ACE_Object_Node
: public ACE_Location_Node
366 ACE_Object_Node (const ACE_TCHAR
*pathname
, const ACE_TCHAR
*obj_name
);
367 virtual void *symbol (ACE_Service_Gestalt
*config
,
369 ACE_Service_Object_Exterminator
* = 0);
370 virtual ~ACE_Object_Node ();
372 /// Dump the state of an object.
375 /// Declare the dynamic allocation hooks.
376 ACE_ALLOC_HOOK_DECLARE
;
379 /// Name of the object that we're parsing.
380 const ACE_TCHAR
*object_name_
;
383 ACE_Object_Node (const ACE_Object_Node
&) = delete;
384 ACE_Object_Node
& operator= (const ACE_Object_Node
&) = delete;
388 * @class ACE_Function_Node
390 * @brief Keeps track of the symbol name of for a shared function.
392 * @note This class is only meant for INTERNAL use by ACE.
396 class ACE_Function_Node
: public ACE_Location_Node
399 ACE_Function_Node (const ACE_TCHAR
*pathname
, const ACE_TCHAR
*func_name
);
400 virtual void *symbol (ACE_Service_Gestalt
*config
,
402 ACE_Service_Object_Exterminator
*gobbler
= 0);
403 virtual ~ACE_Function_Node ();
405 /// Dump the state of an object.
408 /// Declare the dynamic allocation hooks.
409 ACE_ALLOC_HOOK_DECLARE
;
412 /// Return mangled function name that takes into account ACE
413 /// versioned namespace.
415 * This function embeds the ACE versioned namespace name into the
416 * original function name if versioned namespace support has been
417 * enabled and the original function name conforms to the ACE
418 * Service Object factory function naming conventions. For example
419 * "@c _make_Foo" becomes "@c make_ACE_5_4_7_Foo".
421 * If versioned namespace support is disabled or the factory
422 * function name does conform to ACE conventions, no mangling will
423 * occur and the verbatim function name is returned.
425 * @return Function name that takes into account versioned namespace
426 * name. Caller is responsible for calling operator
427 * delete[] or ACE::strdelete() on the returned string.
429 ACE_TCHAR
* make_func_name (ACE_TCHAR
const * func_name
);
432 /// Name of the function that we're parsing.
433 const ACE_TCHAR
*function_name_
;
436 ACE_Function_Node (const ACE_Function_Node
&) = delete;
437 ACE_Function_Node
& operator= (const ACE_Function_Node
&) = delete;
441 * @class ACE_Static_Function_Node
443 * @brief Keeps track of the symbol name for a function that is not
444 * linked in from a DLL, but is statically linked with the
447 * @note This class is only meant for INTERNAL use by ACE.
451 class ACE_Static_Function_Node
: public ACE_Location_Node
454 explicit ACE_Static_Function_Node (const ACE_TCHAR
*func_name
);
455 virtual void *symbol (ACE_Service_Gestalt
*config
,
457 ACE_Service_Object_Exterminator
* = 0);
458 virtual ~ACE_Static_Function_Node ();
460 /// Dump the state of an object.
463 /// Declare the dynamic allocation hooks.
464 ACE_ALLOC_HOOK_DECLARE
;
467 /// Name of the function that we're parsing.
468 const ACE_TCHAR
*function_name_
;
471 ACE_Static_Function_Node (const ACE_Static_Function_Node
&) = delete;
472 ACE_Static_Function_Node
& operator= (const ACE_Static_Function_Node
&) = delete;
475 /// A helper class used to safely register dynamic services, which may contains
476 /// subordinate static services. It is used to capture the necessary data during
477 /// the parsing, but perform the actual instantiation later.
478 class ACE_Service_Type_Factory
481 ACE_Service_Type_Factory (ACE_TCHAR
const *name
,
483 ACE_Location_Node
*location
,
486 ~ACE_Service_Type_Factory ();
488 ACE_Service_Type
*make_service_type (ACE_Service_Gestalt
*pcfg
) const;
490 ACE_TCHAR
const* name () const;
492 /// Declare the dynamic allocation hooks.
493 ACE_ALLOC_HOOK_DECLARE
;
497 * Not implemented to enforce no copying
499 ACE_Service_Type_Factory(const ACE_Service_Type_Factory
&) = delete;
500 ACE_Service_Type_Factory
& operator=(const ACE_Service_Type_Factory
&) = delete;
505 std::unique_ptr
<ACE_Location_Node
> location_
;
506 bool const is_active_
;
509 ACE_END_VERSIONED_NAMESPACE_DECL
511 #endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
513 #include /**/ "ace/post.h"
515 #endif /* ACE_PARSE_NODE_H */