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