TAO_PSDL_Module_Scope Class Reference

#include <PSDL_Module_Scope.h>

Inheritance diagram for TAO_PSDL_Module_Scope:

Inheritance graph
[legend]
Collaboration diagram for TAO_PSDL_Module_Scope:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_PSDL_Module_Scope (TAO_PSDL_Scope *parent_scope)
 ~TAO_PSDL_Module_Scope (void)
int add_module (ACE_CString identifier)
int add_interface (ACE_CString identifier)
int add_struct (ACE_CString identifier)
int add_typedef (ACE_CString identifier, ACE_CString identifier_type)
int add_const_decl (ACE_CString identifier, ACE_CString identifier_type)
int add_except_decl (ACE_CString identifier, ACE_CString identifier_type)
int add_exception (ACE_CString identifier)
int add_enum_decl (ACE_CString identifier, ACE_CString identifier_type)
int add_op_dcl (ACE_CString identifier)
void dump (CORBA::ULong depth)
 Function to help indent the output of the parse tree.

int find (const ACE_CString &identifier_name, ACE_CString &identifier_type)
 Function to find the TAO_PSDL_Scope for the given identifier_name.

int find (const ACE_CString &identifier_name)
int get_module_name (const ACE_CString &identifier_name, ACE_CString &module_name)
int get_interface_name (const ACE_CString &identifier_name, ACE_CString &interface_name)
TAO_PSDL_Scopeparent_scope (void)
 Return the pointer to the parent scope.

Scope_Mapscope_map (void)
 Return the pointer to Scope_Map of the instance.

ACE_CString identifier_type (void)
ACE_CString module_name (void)
ACE_CString interface_name (void)

Protected Attributes

Scope_Map module_scope_
TAO_PSDL_Scopeparent_scope_
ACE_CString identifier_type_
ACE_CString module_name_
ACE_CString interface_name_

Constructor & Destructor Documentation

TAO_PSDL_Module_Scope::TAO_PSDL_Module_Scope TAO_PSDL_Scope parent_scope  ) 
 

Definition at line 9 of file PSDL_Module_Scope.cpp.

00010   : module_scope_ (),
00011     parent_scope_ (parent_scope),
00012     identifier_type_ ("module")
00013 {
00014 }

TAO_PSDL_Module_Scope::~TAO_PSDL_Module_Scope void   ) 
 

Definition at line 16 of file PSDL_Module_Scope.cpp.

00017 {
00018 }


Member Function Documentation

int TAO_PSDL_Module_Scope::add_const_decl ACE_CString  identifier,
ACE_CString  identifier_type
[virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 51 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_const_decl_to_scope(), and TAO_PSDL_Scope::instance().

00053 {
00054   return TAO_PSDL_Scope::instance ()->add_const_decl_to_scope (identifier,
00055                                                                identifier_type,
00056                                                                this);
00057 }

int TAO_PSDL_Module_Scope::add_enum_decl ACE_CString  identifier,
ACE_CString  identifier_type
 

Definition at line 76 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_enum_decl_to_scope(), and TAO_PSDL_Scope::instance().

00078 {
00079   return TAO_PSDL_Scope::instance ()->add_enum_decl_to_scope (identifier,
00080                                                               identifier_type,
00081                                                               this);
00082 }

int TAO_PSDL_Module_Scope::add_except_decl ACE_CString  identifier,
ACE_CString  identifier_type
[virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 60 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_except_decl_to_scope(), and TAO_PSDL_Scope::instance().

00062 {
00063   return TAO_PSDL_Scope::instance ()->add_except_decl_to_scope (identifier,
00064                                                                 identifier_type,
00065                                                                 this);
00066 }

int TAO_PSDL_Module_Scope::add_exception ACE_CString  identifier  )  [virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 69 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_exception_to_scope(), and TAO_PSDL_Scope::instance().

00070 {
00071   return TAO_PSDL_Scope::instance ()->add_exception_to_scope (identifier,
00072                                                               this);
00073 }

int TAO_PSDL_Module_Scope::add_interface ACE_CString  identifier  )  [virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 28 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_interface_to_scope(), and TAO_PSDL_Scope::instance().

00029 {
00030   return TAO_PSDL_Scope::instance ()->add_interface_to_scope (interface_name,
00031                                                               this);
00032 }

int TAO_PSDL_Module_Scope::add_module ACE_CString  identifier  )  [virtual]
 

The add functions are overridden by the derived classes to add the respective types in their scopes. The return value is a '0' if successful and '-1' if it ends up as a failure.

Reimplemented from TAO_PSDL_Scope.

Definition at line 21 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_module_to_scope(), and TAO_PSDL_Scope::instance().

00022 {
00023   return TAO_PSDL_Scope::instance ()->add_module_to_scope (identifier,
00024                                                            this);
00025 }

int TAO_PSDL_Module_Scope::add_op_dcl ACE_CString  identifier  )  [virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 85 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_op_dcl_to_scope(), and TAO_PSDL_Scope::instance().

00086 {
00087   return TAO_PSDL_Scope::instance ()->add_op_dcl_to_scope (identifier,
00088                                                            this);
00089 }

int TAO_PSDL_Module_Scope::add_struct ACE_CString  identifier  )  [virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 35 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_struct_to_scope(), and TAO_PSDL_Scope::instance().

00036 {
00037   return TAO_PSDL_Scope::instance ()->add_struct_to_scope (struct_name,
00038                                                               this);
00039 }

int TAO_PSDL_Module_Scope::add_typedef ACE_CString  identifier,
ACE_CString  identifier_type
[virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 42 of file PSDL_Module_Scope.cpp.

References TAO_PSDL_Scope::add_typedef_to_scope(), and TAO_PSDL_Scope::instance().

00044 {
00045   return TAO_PSDL_Scope::instance ()->add_typedef_to_scope (identifier,
00046                                                             identifier_type,
00047                                                             this);
00048 }

void TAO_PSDL_Module_Scope::dump CORBA::ULong  depth  )  [virtual]
 

Function to help indent the output of the parse tree.

Reimplemented from TAO_PSDL_Scope.

Definition at line 92 of file PSDL_Module_Scope.cpp.

References ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), LM_DEBUG, module_scope_, TAO_PSDL_Scope::print_depth(), and Scope_Map_Iterator.

00093 {
00094   depth = depth + 5;
00095 
00096   for (Scope_Map_Iterator i = this->module_scope_.begin ();
00097        i != this->module_scope_.end ();
00098        ++i)
00099     {
00100       this->print_depth (depth);
00101       ACE_DEBUG ((LM_DEBUG,
00102                   "%s (module/interface/storagebase/struct)\n",
00103                   (*i).ext_id_.c_str ()));
00104       (*i).int_id_->dump (depth);
00105     }
00106 }

int TAO_PSDL_Module_Scope::find const ACE_CString identifier_name  )  [virtual]
 

Function to check if a particular identifier_name exists in the scope.

Reimplemented from TAO_PSDL_Scope.

Definition at line 135 of file PSDL_Module_Scope.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), module_scope_, Scope_Map_Iterator, and ACE_OS::strcmp().

00136 {
00137   for (Scope_Map_Iterator i = this->module_scope_.begin ();
00138        i != this->module_scope_.end ();
00139        ++i)
00140     {
00141       if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00142         {
00143           return 0;
00144         }
00145       else
00146         {
00147           if ((*i).int_id_->find (identifier_name) == 0)
00148             {
00149               return 0;
00150             }
00151         }
00152     }
00153 
00154   return -1;
00155 }

int TAO_PSDL_Module_Scope::find const ACE_CString identifier_name,
ACE_CString identifier_type
[virtual]
 

Function to find the TAO_PSDL_Scope for the given identifier_name.

Reimplemented from TAO_PSDL_Scope.

Definition at line 109 of file PSDL_Module_Scope.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), module_scope_, Scope_Map_Iterator, and ACE_OS::strcmp().

00111 {
00112   for (Scope_Map_Iterator i = this->module_scope_.begin ();
00113        i != this->module_scope_.end ();
00114        ++i)
00115     {
00116       if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00117         {
00118           identifier_type = (*i).int_id_->identifier_type ();
00119           return 0;
00120         }
00121       else
00122         {
00123           if ((*i).int_id_->find (identifier_name,
00124                                   identifier_type) == 0)
00125             {
00126               return 0;
00127             }
00128         }
00129     }
00130 
00131   return -1;
00132 }

int TAO_PSDL_Module_Scope::get_interface_name const ACE_CString identifier_name,
ACE_CString interface_name
[virtual]
 

To get the name of the interface to which an identifier_name belongs. returns '0' on succes and '-1' on failure.

Reimplemented from TAO_PSDL_Scope.

Definition at line 184 of file PSDL_Module_Scope.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), module_scope_, Scope_Map_Iterator, and ACE_OS::strcmp().

00186 {
00187   for (Scope_Map_Iterator i = this->module_scope_.begin ();
00188        i != this->module_scope_.end ();
00189        ++i)
00190     {
00191       if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00192         {
00193           interface_name = (*i).int_id_->interface_name ();
00194           return 0;
00195         }
00196       else
00197         {
00198           if ((*i).int_id_->get_interface_name (identifier_name,
00199                                                 interface_name) == 0)
00200             {
00201               return 0;
00202             }
00203         }
00204     }
00205 
00206   return -1;
00207 }

int TAO_PSDL_Module_Scope::get_module_name const ACE_CString identifier_name,
ACE_CString module_name
[virtual]
 

To get the name of the module to which an identifier_name belongs. returns '0' on succes and '-1' on failure.

Reimplemented from TAO_PSDL_Scope.

Definition at line 158 of file PSDL_Module_Scope.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), module_scope_, Scope_Map_Iterator, and ACE_OS::strcmp().

00160 {
00161   for (Scope_Map_Iterator i = this->module_scope_.begin ();
00162        i != this->module_scope_.end ();
00163        ++i)
00164     {
00165       if (ACE_OS::strcmp (identifier_name.c_str (), (*i).ext_id_.c_str ()) == 0)
00166         {
00167           module_name = (*i).int_id_->module_name ();
00168           return 0;
00169         }
00170       else
00171         {
00172           if ((*i).int_id_->get_module_name (identifier_name,
00173                                              module_name) == 0)
00174             {
00175               return 0;
00176             }
00177         }
00178     }
00179 
00180   return -1;
00181 }

ACE_CString TAO_PSDL_Module_Scope::identifier_type void   )  [virtual]
 

Each identifier will have an instance of a derived type of TAO_PSDL_Scope *.. the following method is an accessor to the type of the identifier name

Reimplemented from TAO_PSDL_Scope.

Definition at line 222 of file PSDL_Module_Scope.cpp.

00223 {
00224   return this->identifier_type_;
00225 }

ACE_CString TAO_PSDL_Module_Scope::interface_name void   )  [virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 234 of file PSDL_Module_Scope.cpp.

00235 {
00236   return this->interface_name_;
00237 }

ACE_CString TAO_PSDL_Module_Scope::module_name void   )  [virtual]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 228 of file PSDL_Module_Scope.cpp.

00229 {
00230   return this->module_name_;
00231 }

TAO_PSDL_Scope * TAO_PSDL_Module_Scope::parent_scope void   )  [virtual]
 

Return the pointer to the parent scope.

Reimplemented from TAO_PSDL_Scope.

Definition at line 210 of file PSDL_Module_Scope.cpp.

00211 {
00212   return this->parent_scope_;
00213 }

Scope_Map * TAO_PSDL_Module_Scope::scope_map void   )  [virtual]
 

Return the pointer to Scope_Map of the instance.

Reimplemented from TAO_PSDL_Scope.

Definition at line 216 of file PSDL_Module_Scope.cpp.

References module_scope_.

00217 {
00218   return &this->module_scope_;
00219 }


Member Data Documentation

ACE_CString TAO_PSDL_Module_Scope::identifier_type_ [protected]
 

Definition at line 90 of file PSDL_Module_Scope.h.

ACE_CString TAO_PSDL_Module_Scope::interface_name_ [protected]
 

Reimplemented from TAO_PSDL_Scope.

Definition at line 92 of file PSDL_Module_Scope.h.

ACE_CString TAO_PSDL_Module_Scope::module_name_ [protected]
 

Definition at line 91 of file PSDL_Module_Scope.h.

Scope_Map TAO_PSDL_Module_Scope::module_scope_ [protected]
 

Definition at line 85 of file PSDL_Module_Scope.h.

Referenced by dump(), find(), get_interface_name(), get_module_name(), and scope_map().

TAO_PSDL_Scope* TAO_PSDL_Module_Scope::parent_scope_ [protected]
 

Definition at line 86 of file PSDL_Module_Scope.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:09:23 2006 for TAO_PSS by doxygen 1.3.6