summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/orbsvcs/IFRService/RecursDef_i.cpp
blob: a6e4c6a6051fa77eb6f81439cb8f1767e96ba36a (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
40
41
42
43
44
45
46
47
// $Id$

#include "orbsvcs/IFRService/RecursDef_i.h"


ACE_RCSID (IFRService,
           RecursDef_i,
           "RecursDef_i.cpp,v 1.1 2004/10/18 09:00:00 SMA Exp")


TAO_BEGIN_VERSIONED_NAMESPACE_DECL

//-----------------------------------------------------------------------------
// Class TAO_RecursiveDef_OuterScopes is a support class for StructDef_i.h and
// UnionDef_i.h files. It creates a stack of outer structure definitions, used
// by TAO_StructDef_i::type_i(), and TAO_UnionDef_i::type_i() during nested
// structure processing.
//-----------------------------------------------------------------------------

TAO_RecursiveDef_OuterScopes::TAO_RecursiveDef_OuterScopes( const ACE_TString &id )
  : id_( id ), pNextOuterID_( pIDsSeenAlready )
{
  pIDsSeenAlready= this; // "Push" this scope
}

TAO_RecursiveDef_OuterScopes::~TAO_RecursiveDef_OuterScopes()
{
  pIDsSeenAlready= pNextOuterID_; // "Pop" this scope
}

bool TAO_RecursiveDef_OuterScopes::SeenBefore( const ACE_TString &id )
{
  for ( const TAO_RecursiveDef_OuterScopes *pOuterScope= pIDsSeenAlready;
        pOuterScope;
        pOuterScope= pOuterScope->pNextOuterID_ )
  {
    if (pOuterScope->id_ == id)
      return true;
  }

  return false;
}

const TAO_RecursiveDef_OuterScopes
  *TAO_RecursiveDef_OuterScopes::pIDsSeenAlready= 0;

TAO_END_VERSIONED_NAMESPACE_DECL