3 //=============================================================================
5 * @file Svc_Conf_Param.h
7 * $Id: Svc_Conf_Param.h 81312 2008-04-09 21:01:34Z iliyan $
9 * @author Iliyan Jeliazkov <iliyan@ociweb.com>
10 * @author Based on code originally found in Svc_Conf.h by Doug
11 Schmidt and Ossama Othman.
13 //=============================================================================
16 #ifndef ACE_SVC_CONF_PARAM_H
17 #define ACE_SVC_CONF_PARAM_H
19 #include /**/ "ace/pre.h"
21 // Globally visible macros, type decls, and extern var decls for
22 // Service Configurator utility.
24 #include "ace/Obstack.h"
26 #if !defined (ACE_LACKS_PRAGMA_ONCE)
28 #endif /* ACE_LACKS_PRAGMA_ONCE */
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 // Forward declarations.
33 struct ace_yy_buffer_state
;
34 class ACE_Service_Gestalt
;
36 extern void ace_yy_delete_buffer (ace_yy_buffer_state
*buffer
);
39 * @class ACE_Svc_Conf_Param
41 * @brief An instance of this object will be passed down to the
42 * yyparse() and yylex() functions.
44 * This is intended for internal use within ACE service configuration
47 * This class retains the state for a given parse/scan. It primarily
48 * makes it possible to hold the static object lock in the scanner
49 * for as short a period of time as possible. The resulting finer
50 * grained locking prevents deadlocks from occuring when scanning a
51 * `svc.conf' file and activating an ACE_Task, for example, as a
52 * result of processing the directives in that file.
54 class ACE_Svc_Conf_Param
58 enum SVC_CONF_PARAM_TYPE
60 /// The lexer will scan a file containing one or more directives.
63 /// The lexer will scan a string containing a directive.
68 ACE_Svc_Conf_Param (ACE_Service_Gestalt
* config
, FILE *file
)
69 : type (SVC_CONF_FILE
),
80 ACE_Svc_Conf_Param (ACE_Service_Gestalt
* config
, const ACE_TCHAR
*directive
)
81 : type (SVC_CONF_DIRECTIVE
),
88 source
.directive
= directive
;
91 ~ACE_Svc_Conf_Param (void)
93 ace_yy_delete_buffer (this->buffer
);
100 /// FILE stream from which directives will be scanned and parsed.
103 /// String containing directive that will be scanned and parsed.
104 const ACE_TCHAR
*directive
;
108 /// Discriminant use to determine which union member to use.
109 SVC_CONF_PARAM_TYPE type
;
111 /// Keeps track of the number of errors encountered so far.
114 /// Keeps track of the current line number for error-handling routine.
117 /// Lexer buffer that corresponds to the current Service
118 /// Configurator file/direct scan.
119 ace_yy_buffer_state
*buffer
;
121 /// Obstack used for efficient memory allocation when
122 /// parsing/scanning a service configurator directive.
123 ACE_Obstack_T
<ACE_TCHAR
> obstack
;
125 /// A reference to the configuration
126 ACE_Service_Gestalt
*config
;
130 // Parameter that is passed down to the yyparse() function, and
131 // eventually to yylex().
132 #define YYPARSE_PARAM ace_svc_conf_parameter
134 #define YYLEX_PARAM YYPARSE_PARAM
136 #define ACE_SVC_CONF_PARAM (static_cast<ACE_Svc_Conf_Param *> (YYLEX_PARAM))
138 ACE_END_VERSIONED_NAMESPACE_DECL
140 #include /**/ "ace/post.h"
142 #endif /* ACE_SVC_CONF_PARAM_H */