Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Parse_Node.h
blob2fac713694e9664c86a0cca1cc46dabdcb308eec
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Parse_Node.h
7 * @author Doug Schmidt
8 */
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)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if (ACE_USES_CLASSIC_SVC_CONF == 1)
24 #include "ace/DLL.h"
25 #include "ace/SString.h"
26 #include "ace/Svc_Conf.h"
27 #include <memory>
29 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
31 /// Forward declarations.
32 class ACE_Service_Config;
33 class ACE_Service_Type;
35 /**
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.
43 * @internal
45 class ACE_Parse_Node
47 public:
48 ACE_Parse_Node ();
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;
59 void print () const;
61 /// Dump the state of an object.
62 void dump () const;
64 /// Declare the dynamic allocation hooks.
65 ACE_ALLOC_HOOK_DECLARE;
67 private:
68 const ACE_TCHAR *name_;
69 ACE_Parse_Node *next_;
71 private:
72 ACE_Parse_Node (const ACE_Parse_Node&) = delete;
73 ACE_Parse_Node& operator= (const ACE_Parse_Node&) = delete;
76 /**
77 * @class ACE_Suspend_Node
79 * @brief Suspend a Service Node.
81 * @note This class is only meant for INTERNAL use by ACE.
83 * @internal
85 class ACE_Suspend_Node : public ACE_Parse_Node
87 public:
88 ACE_Suspend_Node (const ACE_TCHAR *name);
89 ~ACE_Suspend_Node ();
91 virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
93 /// Dump the state of an object.
94 void dump () const;
96 /// Declare the dynamic allocation hooks.
97 ACE_ALLOC_HOOK_DECLARE;
99 private:
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.
111 * @internal
113 class ACE_Resume_Node : public ACE_Parse_Node
115 public:
116 ACE_Resume_Node (const ACE_TCHAR *name);
117 ~ACE_Resume_Node ();
119 virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
121 /// Dump the state of an object.
122 void dump () const;
124 /// Declare the dynamic allocation hooks.
125 ACE_ALLOC_HOOK_DECLARE;
127 private:
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.
139 * @internal
141 class ACE_Remove_Node : public ACE_Parse_Node
143 public:
144 ACE_Remove_Node (const ACE_TCHAR *name);
145 ~ACE_Remove_Node ();
147 virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
149 /// Dump the state of an object.
150 void dump () const;
152 /// Declare the dynamic allocation hooks.
153 ACE_ALLOC_HOOK_DECLARE;
155 private:
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.
167 * @internal
169 class ACE_Static_Node : public ACE_Parse_Node
171 public:
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.
181 void dump () const;
183 /// Declare the dynamic allocation hooks.
184 ACE_ALLOC_HOOK_DECLARE;
186 private:
187 /// "Command-line" parameters.
188 ACE_TCHAR *parameters_;
190 private:
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.
205 * @internal
207 class ACE_Dynamic_Node : public ACE_Static_Node
209 public:
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.
218 void dump () const;
220 /// Declare the dynamic allocation hooks.
221 ACE_ALLOC_HOOK_DECLARE;
223 private:
224 /// Pointer to a descriptor that describes this node.
225 std::unique_ptr<const ACE_Service_Type_Factory> factory_;
227 private:
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.
239 * @internal
241 class ACE_Stream_Node : public ACE_Parse_Node
243 public:
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.
250 void dump () const;
252 /// Declare the dynamic allocation hooks.
253 ACE_ALLOC_HOOK_DECLARE;
255 private:
256 /// Linked list of modules that are part of the stream.
257 const ACE_Static_Node *node_;
258 const ACE_Parse_Node *mods_;
260 private:
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
275 public:
276 ACE_Dummy_Node (const ACE_Static_Node *, const ACE_Parse_Node *);
277 ~ACE_Dummy_Node ();
279 virtual void apply (ACE_Service_Gestalt *cfg, int &yyerrno);
281 /// Dump the state of an object.
282 void dump () const;
284 /// Declare the dynamic allocation hooks.
285 ACE_ALLOC_HOOK_DECLARE;
287 private:
288 /// Linked list of modules that we're dealing with.
289 const ACE_Static_Node *node_;
290 const ACE_Parse_Node *mods_;
292 private:
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.
304 * @internal
306 class ACE_Location_Node
308 public:
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
319 /// repository
320 virtual void *symbol (ACE_Service_Gestalt *cfgptr,
321 int &yyerrno,
322 ACE_Service_Object_Exterminator * = 0) = 0;
324 /// Dump the state of an object.
325 void dump () const;
327 /// Declare the dynamic allocation hooks.
328 ACE_ALLOC_HOOK_DECLARE;
330 protected:
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.)
341 int must_delete_;
343 /// The open shared library.
344 ACE_DLL dll_;
346 /// Symbol that we've obtained from the shared library.
347 void *symbol_;
349 private:
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.
361 * @internal
363 class ACE_Object_Node : public ACE_Location_Node
365 public:
366 ACE_Object_Node (const ACE_TCHAR *pathname, const ACE_TCHAR *obj_name);
367 virtual void *symbol (ACE_Service_Gestalt *config,
368 int &yyerrno,
369 ACE_Service_Object_Exterminator * = 0);
370 virtual ~ACE_Object_Node ();
372 /// Dump the state of an object.
373 void dump () const;
375 /// Declare the dynamic allocation hooks.
376 ACE_ALLOC_HOOK_DECLARE;
378 private:
379 /// Name of the object that we're parsing.
380 const ACE_TCHAR *object_name_;
382 private:
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.
394 * @internal
396 class ACE_Function_Node : public ACE_Location_Node
398 public:
399 ACE_Function_Node (const ACE_TCHAR *pathname, const ACE_TCHAR *func_name);
400 virtual void *symbol (ACE_Service_Gestalt *config,
401 int &yyerrno,
402 ACE_Service_Object_Exterminator *gobbler = 0);
403 virtual ~ACE_Function_Node ();
405 /// Dump the state of an object.
406 void dump () const;
408 /// Declare the dynamic allocation hooks.
409 ACE_ALLOC_HOOK_DECLARE;
411 private:
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".
420 * @par
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);
431 private:
432 /// Name of the function that we're parsing.
433 const ACE_TCHAR *function_name_;
435 private:
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
445 * application.
447 * @note This class is only meant for INTERNAL use by ACE.
449 * @internal
451 class ACE_Static_Function_Node : public ACE_Location_Node
453 public:
454 explicit ACE_Static_Function_Node (const ACE_TCHAR *func_name);
455 virtual void *symbol (ACE_Service_Gestalt *config,
456 int &yyerrno,
457 ACE_Service_Object_Exterminator * = 0);
458 virtual ~ACE_Static_Function_Node ();
460 /// Dump the state of an object.
461 void dump () const;
463 /// Declare the dynamic allocation hooks.
464 ACE_ALLOC_HOOK_DECLARE;
466 private:
467 /// Name of the function that we're parsing.
468 const ACE_TCHAR *function_name_;
470 private:
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
480 public:
481 ACE_Service_Type_Factory (ACE_TCHAR const *name,
482 int type,
483 ACE_Location_Node *location,
484 bool active);
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;
495 private:
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;
502 private:
503 ACE_TString name_;
504 int type_;
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 */