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
55 enum SVC_CONF_PARAM_TYPE
57 /// The lexer will scan a file containing one or more directives.
60 /// The lexer will scan a string containing a directive.
65 ACE_Svc_Conf_Param (ACE_Service_Gestalt
* config
, FILE *file
)
66 : type (SVC_CONF_FILE
),
77 ACE_Svc_Conf_Param (ACE_Service_Gestalt
* config
, const ACE_TCHAR
*directive
)
78 : type (SVC_CONF_DIRECTIVE
),
85 source
.directive
= directive
;
88 ~ACE_Svc_Conf_Param ()
90 ace_yy_delete_buffer (this->buffer
);
96 /// FILE stream from which directives will be scanned and parsed.
99 /// String containing directive that will be scanned and parsed.
100 const ACE_TCHAR
*directive
;
103 /// Discriminant use to determine which union member to use.
104 SVC_CONF_PARAM_TYPE type
;
106 /// Keeps track of the number of errors encountered so far.
109 /// Keeps track of the current line number for error-handling routine.
112 /// Lexer buffer that corresponds to the current Service
113 /// Configurator file/direct scan.
114 ace_yy_buffer_state
*buffer
;
116 /// Obstack used for efficient memory allocation when
117 /// parsing/scanning a service configurator directive.
118 ACE_Obstack_T
<ACE_TCHAR
> obstack
;
120 /// A reference to the configuration
121 ACE_Service_Gestalt
*config
;
125 // Parameter that is passed down to the yyparse() function, and
126 // eventually to yylex().
127 #define YYPARSE_PARAM ace_svc_conf_parameter
129 #define YYLEX_PARAM YYPARSE_PARAM
131 #define ACE_SVC_CONF_PARAM (static_cast<ACE_Svc_Conf_Param *> (YYLEX_PARAM))
133 ACE_END_VERSIONED_NAMESPACE_DECL
135 #include /**/ "ace/post.h"
137 #endif /* ACE_SVC_CONF_PARAM_H */