summaryrefslogtreecommitdiff
path: root/ace/Svc_Conf_Lexer_Guard.cpp
blob: c5d79aa1f320ab4d5af8ce495f7b22b03c83969e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -*- C++ -*-

#include "ace/Svc_Conf_Lexer_Guard.h"

#if (ACE_USES_CLASSIC_SVC_CONF == 1)

#include "ace/Svc_Conf.h"

ACE_RCSID (ace,
           Svc_Conf_Lexer_Guard,
           "$Id$")

ACE_Svc_Conf_Lexer_Guard::ACE_Svc_Conf_Lexer_Guard (ACE_Svc_Conf_Param *param)
  : buffer_ (0)
{
  // External synchronization is required.

  // Note that allocation/deallocation is done once during the
  // processing of a service configurator directive.  Memory
  // managements is done at a higher level, not in this class.  This
  // is necessary to prevent an allocation/deallocation from occurring
  // when parsing/scanning each token.

  if (param->type == ACE_Svc_Conf_Param::SVC_CONF_FILE)
    ::ace_yy_push_buffer (param->source.file, param->buffer);
  else
    ::ace_yy_push_buffer (param->source.directive,
                          param->buffer);

  this->buffer_ = param->buffer;
}

ACE_Svc_Conf_Lexer_Guard::~ACE_Svc_Conf_Lexer_Guard (void)
{
  // External synchronization is required.

  ::ace_yy_pop_buffer (this->buffer_);
}
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */