00001
00002
00003
00004 #include "PSDL_Simple_Scope.h"
00005 #include "PSDL_Interface_Scope.h"
00006
00007 ACE_RCSID (PSS, PSDL_Simple_Scope, "PSDL_Simple_Scope.cpp,v 1.1 2002/07/25 15:25:51 pgontla Exp")
00008
00009 TAO_PSDL_Simple_Scope::TAO_PSDL_Simple_Scope (TAO_PSDL_Scope *parent_scope,
00010 ACE_CString identifier_type)
00011 : scope_map_ (),
00012 parent_scope_ (parent_scope),
00013 identifier_type_ (identifier_type)
00014 {
00015 }
00016
00017 TAO_PSDL_Simple_Scope::~TAO_PSDL_Simple_Scope (void)
00018 {
00019 }
00020
00021 int
00022 TAO_PSDL_Simple_Scope::add_typedef (ACE_CString identifier,
00023 ACE_CString identifier_type)
00024 {
00025 return TAO_PSDL_Scope::instance ()->add_typedef_to_scope (identifier,
00026 identifier_type,
00027 this);
00028 }
00029
00030 int
00031 TAO_PSDL_Simple_Scope::add_const_decl (ACE_CString identifier,
00032 ACE_CString identifier_type)
00033 {
00034 return TAO_PSDL_Scope::instance ()->add_const_decl_to_scope (identifier,
00035 identifier_type,
00036 this);
00037 }
00038
00039 int
00040 TAO_PSDL_Simple_Scope::add_except_decl (ACE_CString identifier,
00041 ACE_CString identifier_type)
00042 {
00043 return TAO_PSDL_Scope::instance ()->add_except_decl_to_scope (identifier,
00044 identifier_type,
00045 this);
00046 }
00047
00048 int
00049 TAO_PSDL_Simple_Scope::add_enum_decl (ACE_CString identifier,
00050 ACE_CString identifier_type)
00051 {
00052 return TAO_PSDL_Scope::instance ()->add_enum_decl_to_scope (identifier,
00053 identifier_type,
00054 this);
00055 }
00056
00057 int
00058 TAO_PSDL_Simple_Scope::add_op_dcl (ACE_CString identifier)
00059 {
00060 return TAO_PSDL_Scope::instance ()->add_op_dcl_to_scope (identifier,
00061 this);
00062 }
00063
00064 void
00065 TAO_PSDL_Simple_Scope::dump (CORBA::ULong depth)
00066 {
00067 depth = depth + 5;
00068
00069 for (Scope_Map_Iterator i = this->scope_map_.begin ();
00070 i != this->scope_map_.end ();
00071 ++i)
00072 {
00073 this->print_depth (depth);
00074 ACE_DEBUG ((LM_DEBUG,
00075 "%s (simple types)",
00076 (*i).ext_id_.c_str ()));
00077 (*i).int_id_->dump (depth);
00078 }
00079 }
00080
00081 int
00082 TAO_PSDL_Simple_Scope::find (const ACE_CString &identifier_name,
00083 ACE_CString &identifier_type)
00084 {
00085 for (Scope_Map_Iterator i = this->scope_map_.begin ();
00086 i != this->scope_map_.end ();
00087 ++i)
00088 {
00089 if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00090 {
00091 identifier_type = (*i).int_id_->identifier_type ();
00092 return 0;
00093 }
00094 else
00095 {
00096 if ((*i).int_id_->find (identifier_name,
00097 identifier_type) == 0)
00098 {
00099 return 0;
00100 }
00101 }
00102 }
00103
00104 return -1;
00105 }
00106
00107 int
00108 TAO_PSDL_Simple_Scope::find (const ACE_CString &identifier_name)
00109 {
00110 for (Scope_Map_Iterator i = this->scope_map_.begin ();
00111 i != this->scope_map_.end ();
00112 ++i)
00113 {
00114 if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00115 {
00116 return 0;
00117 }
00118 else
00119 {
00120 if ((*i).int_id_->find (identifier_name) == 0)
00121 {
00122
00123
00124 return 0;
00125 }
00126 }
00127 }
00128
00129 return -1;
00130 }
00131
00132 ACE_CString
00133 TAO_PSDL_Simple_Scope::identifier_type (void)
00134 {
00135 return this->identifier_type_;
00136 }
00137
00138 ACE_CString
00139 TAO_PSDL_Simple_Scope::module_name (void)
00140 {
00141 return this->module_name_;
00142 }
00143
00144 ACE_CString
00145 TAO_PSDL_Simple_Scope::interface_name (void)
00146 {
00147 return this->interface_name_;
00148 }
00149
00150 TAO_PSDL_Scope *
00151 TAO_PSDL_Simple_Scope::parent_scope (void)
00152 {
00153 return this->parent_scope_;
00154 }
00155
00156 Scope_Map *
00157 TAO_PSDL_Simple_Scope::scope_map (void)
00158 {
00159 return &this->scope_map_;
00160 }