00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Svc_Conf_Lexer_Guard.h 00006 * 00007 * $Id: Svc_Conf_Lexer_Guard.h,v 1.1.1.1 2001/12/04 14:33:09 chad Exp $ 00008 * 00009 * @author Ossama Othman <ossama@uci.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef ACE_SVC_CONF_LEXER_GUARD_H 00014 #define ACE_SVC_CONF_LEXER_GUARD_H 00015 00016 #include "ace/pre.h" 00017 00018 #include "ace/config-all.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 /// Forward declarations 00025 class ACE_Svc_Conf_Param; 00026 00027 struct ace_yy_buffer_state; 00028 00029 /** 00030 * @class ACE_Svc_Conf_Lexer_Guard 00031 * 00032 * @brief "Guard" that ensures lexer buffer switching is 00033 * exception-safe. 00034 * 00035 * Buffers are switched, if necessary, each time a token is 00036 * parsed/scanned. The buffer switching must be synchronized 00037 * externally. This class performs no synchronization. 00038 * 00039 * @note Note that allocation/deallocation is done once during the 00040 * processing of a service configurator directive. Memory 00041 * managements is done at a higher level, not in this class. 00042 * This is necessary to prevent an allocation/deallocation from 00043 * occurring when parsing/scanning each token. 00044 */ 00045 class ACE_Svc_Conf_Lexer_Guard 00046 { 00047 public: 00048 00049 /// Constructor 00050 /** 00051 * Switches buffers, if necessary, when token scanning first 00052 * begins. Allocation of the buffer will also occur if one has not 00053 * already been allocated. This operation effectively pushes a 00054 * buffer on to a stack. 00055 */ 00056 ACE_Svc_Conf_Lexer_Guard (ACE_Svc_Conf_Param *param); 00057 00058 /// Destructor 00059 /** 00060 * Switches buffers, if necessary when token scanning completes. No 00061 * buffer deallocation occurs here. Buffers are deallocated when 00062 * parsing of the entire directive is done, not when scanning of a 00063 * single token is done. This operation effective pops a buffer off 00064 * of a stack. 00065 */ 00066 ~ACE_Svc_Conf_Lexer_Guard (void); 00067 00068 private: 00069 00070 /// Lexer buffer that corresponds to the current Service 00071 /// Configurator file/direct scan. 00072 ace_yy_buffer_state *buffer_; 00073 00074 }; 00075 00076 00077 #include "ace/post.h" 00078 00079 #endif /* ACE_SVC_CONF_LEXER_GUARD_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002