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