summaryrefslogtreecommitdiff
path: root/ace/Svc_Conf_Lexer_Guard.cpp
blob: 13848feaac9b2aa73eb9c0f15ebcc83e496ff841 (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
// -*- C++ -*-

#include "ace/Svc_Conf.h"

#include "ace/Svc_Conf_Lexer_Guard.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_);
}