GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / Svc_Conf_Param.h
blob4b03076bb55936466491dd0720177500b8d44d6c
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Svc_Conf_Param.h
7 * @author Iliyan Jeliazkov <iliyan@ociweb.com>
8 * @author Based on code originally found in Svc_Conf.h by Doug
9 Schmidt and Ossama Othman.
11 //=============================================================================
14 #ifndef ACE_SVC_CONF_PARAM_H
15 #define ACE_SVC_CONF_PARAM_H
17 #include /**/ "ace/pre.h"
19 // Globally visible macros, type decls, and extern var decls for
20 // Service Configurator utility.
22 #include "ace/Obstack.h"
24 #if !defined (ACE_LACKS_PRAGMA_ONCE)
25 # pragma once
26 #endif /* ACE_LACKS_PRAGMA_ONCE */
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 // Forward declarations.
31 struct ace_yy_buffer_state;
32 class ACE_Service_Gestalt;
34 extern void ace_yy_delete_buffer (ace_yy_buffer_state *buffer);
36 /**
37 * @class ACE_Svc_Conf_Param
39 * @brief An instance of this object will be passed down to the
40 * yyparse() and yylex() functions.
42 * This is intended for internal use within ACE service configuration
43 * framework only.
45 * This class retains the state for a given parse/scan. It primarily
46 * makes it possible to hold the static object lock in the scanner
47 * for as short a period of time as possible. The resulting finer
48 * grained locking prevents deadlocks from occurring when scanning a
49 * `svc.conf' file and activating an ACE_Task, for example, as a
50 * result of processing the directives in that file.
52 class ACE_Svc_Conf_Param
54 public:
56 enum SVC_CONF_PARAM_TYPE
58 /// The lexer will scan a file containing one or more directives.
59 SVC_CONF_FILE,
61 /// The lexer will scan a string containing a directive.
62 SVC_CONF_DIRECTIVE
65 /// Constructor
66 ACE_Svc_Conf_Param (ACE_Service_Gestalt* config, FILE *file)
67 : type (SVC_CONF_FILE),
68 yyerrno (0),
69 yylineno (1),
70 buffer (0),
71 obstack (),
72 config (config)
74 source.file = file;
77 /// Constructor
78 ACE_Svc_Conf_Param (ACE_Service_Gestalt* config, const ACE_TCHAR *directive)
79 : type (SVC_CONF_DIRECTIVE),
80 yyerrno (0),
81 yylineno (1),
82 buffer (0),
83 obstack (),
84 config (config)
86 source.directive = directive;
89 ~ACE_Svc_Conf_Param (void)
91 ace_yy_delete_buffer (this->buffer);
94 public:
96 union
98 /// FILE stream from which directives will be scanned and parsed.
99 FILE *file;
101 /// String containing directive that will be scanned and parsed.
102 const ACE_TCHAR *directive;
104 } source;
106 /// Discriminant use to determine which union member to use.
107 SVC_CONF_PARAM_TYPE type;
109 /// Keeps track of the number of errors encountered so far.
110 int yyerrno;
112 /// Keeps track of the current line number for error-handling routine.
113 int yylineno;
115 /// Lexer buffer that corresponds to the current Service
116 /// Configurator file/direct scan.
117 ace_yy_buffer_state *buffer;
119 /// Obstack used for efficient memory allocation when
120 /// parsing/scanning a service configurator directive.
121 ACE_Obstack_T<ACE_TCHAR> obstack;
123 /// A reference to the configuration
124 ACE_Service_Gestalt *config;
128 // Parameter that is passed down to the yyparse() function, and
129 // eventually to yylex().
130 #define YYPARSE_PARAM ace_svc_conf_parameter
132 #define YYLEX_PARAM YYPARSE_PARAM
134 #define ACE_SVC_CONF_PARAM (static_cast<ACE_Svc_Conf_Param *> (YYLEX_PARAM))
136 ACE_END_VERSIONED_NAMESPACE_DECL
138 #include /**/ "ace/post.h"
140 #endif /* ACE_SVC_CONF_PARAM_H */