00001
00002
00003
00004 #include "PSDL_Module_Scope.h"
00005 #include "PSDL_Interface_Scope.h"
00006
00007 ACE_RCSID (PSS, PSDL_Interface_Scope, "PSDL_Interface_Scope.cpp,v 1.1 2002/07/25 15:25:50 pgontla Exp")
00008
00009 TAO_PSDL_Interface_Scope::TAO_PSDL_Interface_Scope (TAO_PSDL_Scope *parent_scope)
00010 : interface_scope_ (),
00011 parent_scope_ (parent_scope)
00012 {
00013
00014 }
00015
00016 TAO_PSDL_Interface_Scope::~TAO_PSDL_Interface_Scope (void)
00017 {
00018
00019 }
00020
00021 int
00022 TAO_PSDL_Interface_Scope::add_interface (ACE_CString interface_name)
00023 {
00024 return TAO_PSDL_Scope::instance ()->add_interface_to_scope (interface_name,
00025 this);
00026 }
00027
00028 int
00029 TAO_PSDL_Interface_Scope::add_struct (ACE_CString struct_name)
00030 {
00031 return TAO_PSDL_Scope::instance ()->add_struct_to_scope (struct_name,
00032 this);
00033 }
00034
00035 int
00036 TAO_PSDL_Interface_Scope::add_typedef (ACE_CString identifier,
00037 ACE_CString identifier_type)
00038 {
00039 return TAO_PSDL_Scope::instance ()->add_typedef_to_scope (identifier,
00040 identifier_type,
00041 this);
00042 }
00043
00044 int
00045 TAO_PSDL_Interface_Scope::add_const_decl (ACE_CString identifier,
00046 ACE_CString identifier_type)
00047 {
00048 return TAO_PSDL_Scope::instance ()->add_const_decl_to_scope (identifier,
00049 identifier_type,
00050 this);
00051 }
00052
00053 int
00054 TAO_PSDL_Interface_Scope::add_except_decl (ACE_CString identifier,
00055 ACE_CString identifier_type)
00056 {
00057 return TAO_PSDL_Scope::instance ()->add_except_decl_to_scope (identifier,
00058 identifier_type,
00059 this);
00060 }
00061
00062 int
00063 TAO_PSDL_Interface_Scope::add_exception (ACE_CString identifier)
00064 {
00065 return TAO_PSDL_Scope::instance ()->add_exception_to_scope (identifier,
00066 this);
00067 }
00068
00069 int
00070 TAO_PSDL_Interface_Scope::add_op_dcl (ACE_CString identifier)
00071 {
00072 return TAO_PSDL_Scope::instance ()->add_op_dcl_to_scope (identifier,
00073 this);
00074 }
00075
00076 void
00077 TAO_PSDL_Interface_Scope::dump (CORBA::ULong depth)
00078 {
00079 depth = depth + 5;
00080
00081 for (Scope_Map_Iterator i = this->interface_scope_.begin ();
00082 i != this->interface_scope_.end ();
00083 ++i)
00084 {
00085 this->print_depth (depth);
00086 ACE_DEBUG ((LM_DEBUG,
00087 "%s (interface/exception/struct)\n",
00088 (*i).ext_id_.c_str ()));
00089 (*i).int_id_->dump (depth);
00090 }
00091 }
00092
00093 int
00094 TAO_PSDL_Interface_Scope::find (const ACE_CString &identifier_name,
00095 ACE_CString &identifier_type)
00096 {
00097 for (Scope_Map_Iterator i = this->interface_scope_.begin ();
00098 i != this->interface_scope_.end ();
00099 ++i)
00100 {
00101 if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00102 {
00103 identifier_type = (*i).int_id_->identifier_type ();
00104 return 0;
00105 }
00106 else
00107 {
00108 if ((*i).int_id_->find (identifier_name,
00109 identifier_type) == 0)
00110 {
00111 return 0;
00112 }
00113 }
00114 }
00115
00116 return -1;
00117 }
00118
00119 int
00120 TAO_PSDL_Interface_Scope::find (const ACE_CString &identifier_name)
00121 {
00122 for (Scope_Map_Iterator i = this->interface_scope_.begin ();
00123 i != this->interface_scope_.end ();
00124 ++i)
00125 {
00126 if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00127 {
00128 return 0;
00129 }
00130 else
00131 {
00132 if ((*i).int_id_->find (identifier_name) == 0)
00133 {
00134
00135
00136 return 0;
00137 }
00138 }
00139 }
00140
00141 return -1;
00142 }
00143
00144 int
00145 TAO_PSDL_Interface_Scope::get_module_name (const ACE_CString &identifier_name,
00146 ACE_CString &module_name)
00147 {
00148 for (Scope_Map_Iterator i = this->interface_scope_.begin ();
00149 i != this->interface_scope_.end ();
00150 ++i)
00151 {
00152 if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00153 {
00154 module_name = (*i).int_id_->module_name ();
00155 return 0;
00156 }
00157 else
00158 {
00159 if ((*i).int_id_->get_module_name (identifier_name,
00160 module_name) == 0)
00161 {
00162 return 0;
00163 }
00164 }
00165 }
00166
00167 return -1;
00168 }
00169
00170 int
00171 TAO_PSDL_Interface_Scope::get_interface_name (const ACE_CString &identifier_name,
00172 ACE_CString &interface_name)
00173 {
00174 for (Scope_Map_Iterator i = this->interface_scope_.begin ();
00175 i != this->interface_scope_.end ();
00176 ++i)
00177 {
00178 if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00179 {
00180 interface_name = (*i).int_id_->interface_name ();
00181 return 0;
00182 }
00183 else
00184 {
00185 if ((*i).int_id_->get_interface_name (identifier_name,
00186 interface_name) == 0)
00187 {
00188 return 0;
00189 }
00190 }
00191 }
00192
00193 return -1;
00194 }
00195
00196 TAO_PSDL_Scope *
00197 TAO_PSDL_Interface_Scope::parent_scope (void)
00198 {
00199 return this->parent_scope_;
00200 }
00201
00202 Scope_Map *
00203 TAO_PSDL_Interface_Scope::scope_map (void)
00204 {
00205 return &this->interface_scope_;
00206 }
00207
00208 ACE_CString
00209 TAO_PSDL_Interface_Scope::identifier_type (void)
00210 {
00211 return this->identifier_type_;
00212 }
00213
00214 ACE_CString
00215 TAO_PSDL_Interface_Scope::module_name (void)
00216 {
00217 return this->module_name_;
00218 }
00219
00220 ACE_CString
00221 TAO_PSDL_Interface_Scope::interface_name (void)
00222 {
00223 return this->interface_name_;
00224 }