3 //=============================================================================
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)
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
);
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
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
56 enum SVC_CONF_PARAM_TYPE
58 /// The lexer will scan a file containing one or more directives.
61 /// The lexer will scan a string containing a directive.
66 ACE_Svc_Conf_Param (ACE_Service_Gestalt
* config
, FILE *file
)
67 : type (SVC_CONF_FILE
),
78 ACE_Svc_Conf_Param (ACE_Service_Gestalt
* config
, const ACE_TCHAR
*directive
)
79 : type (SVC_CONF_DIRECTIVE
),
86 source
.directive
= directive
;
89 ~ACE_Svc_Conf_Param (void)
91 ace_yy_delete_buffer (this->buffer
);
98 /// FILE stream from which directives will be scanned and parsed.
101 /// String containing directive that will be scanned and parsed.
102 const ACE_TCHAR
*directive
;
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.
112 /// Keeps track of the current line number for error-handling routine.
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 */