#include <PSDL_Exception_Visitor.h>
Inheritance diagram for TAO_PSDL_Exception_Visitor:
Public Member Functions | |
TAO_PSDL_Exception_Visitor () | |
~TAO_PSDL_Exception_Visitor () | |
int | visit_identifier (TAO_PSDL_Identifier *identifier) |
int | visit_except_dcl (TAO_PSDL_Except_Dcl *except_dcl) |
int | visit_member_list (TAO_PSDL_Member_List *member_list) |
int | visit_predefined_type (TAO_PSDL_Predefined_Type *predefined_type) |
Private Member Functions | |
void | print_class_for_exception (void) |
Private Attributes | |
ACE_CString | exception_name_ |
|
Definition at line 9 of file PSDL_Exception_Visitor.cpp.
00010 : exception_name_ () 00011 { 00012 // Constructor 00013 } |
|
Definition at line 15 of file PSDL_Exception_Visitor.cpp.
00016 {
00017 // Destructor
00018 }
|
|
Definition at line 89 of file PSDL_Exception_Visitor.cpp. References ACE_CString, TAO_PSDL_Node_Visitor::base_type(), exception_name_, TAO_PSDL_Scope::get_interface_name(), TAO_PSDL_Scope::get_name_space(), TAO_PSDL_Scope::get_sh(), TAO_PSDL_Scope::instance(), TAO_PSDL_Stream::nl(), ACE_Array_Base< ACE_CString >::size(), ACE_OS::strcmp(), and TAO_PSDL_Node_Visitor::version_for_stub(). Referenced by visit_except_dcl().
00090 { 00091 // Get a pointer to PSDL_Stream of the stub header. 00092 TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh (); 00093 00094 // Code that should be generated to the stub (idlC.h) according to 00095 // the specification. 00096 ps_sh->nl (); 00097 ps_sh->nl (); 00098 00099 ACE_CString name_space = 00100 TAO_PSDL_Scope::instance ()->get_name_space (); 00101 00102 ACE_CString interface_name = 00103 TAO_PSDL_Scope::instance ()->get_interface_name (); 00104 00105 *ps_sh << "#if !defined (_" << name_space << "_" 00106 << interface_name << "_" << this->exception_name_ << "_CH_)\n"; 00107 *ps_sh << "#define _" << name_space << "_" << interface_name 00108 << "_" << this->exception_name_ << "_CH_\n"; 00109 ps_sh->nl (); 00110 *ps_sh << " class " << this->exception_name_ 00111 << " : public CORBA::UserException\n"; 00112 *ps_sh << " {\n"; 00113 00114 *ps_sh << " public:\n"; 00115 00116 ACE_CString type; 00117 for (unsigned int i = 1; i < this->count_; ++i) 00118 { 00119 if (this->base_type (this->identifiers_[i], type)) 00120 { 00121 if (ACE_OS::strcmp (type.c_str (), "char *") == 0) 00122 { 00123 *ps_sh << " " << "TAO::String_Manager" 00124 << " " << this->identifiers_[i+1] 00125 << ";\n"; 00126 } 00127 else 00128 { 00129 *ps_sh << " " << this->version_for_stub (type) 00130 << " " << this->identifiers_[i+1] 00131 << ";\n"; 00132 } 00133 } 00134 else 00135 { 00136 // Types defined previously in the idl. 00137 *ps_sh << " ACE_NESTED_CLASS (" 00138 //@@@deal << base_node_info.module_name << "::" 00139 //@@@deal << base_node_info.interface_name 00140 << ", " << this->identifiers_[i] 00141 << ") " << this->identifiers_[i+1] 00142 << ";\n"; 00143 } 00144 ++i; 00145 } 00146 00147 *ps_sh << " " << this->exception_name_ 00148 << " (void);\n"; 00149 *ps_sh << " " << this->exception_name_ 00150 << " (const " << this->exception_name_ << " &);\n"; 00151 *ps_sh << " ~" << this->exception_name_ << " (void);\n"; 00152 *ps_sh << "\n"; 00153 *ps_sh << " " << this->exception_name_ 00154 << " &operator= (const " << this->exception_name_ << " &);\n"; 00155 *ps_sh << "\n"; 00156 *ps_sh << " static void _tao_any_destructor (void*);\n"; 00157 *ps_sh << "\n"; 00158 *ps_sh << " static " << this->exception_name_ 00159 << " *_downcast (CORBA::Exception *);\n"; 00160 *ps_sh << " static CORBA::Exception *_alloc (void);\n"; 00161 *ps_sh << "\n"; 00162 *ps_sh << " virtual CORBA::Exception *_tao_duplicate (void) const;\n"; 00163 *ps_sh << "\n"; 00164 *ps_sh << " virtual void _raise (void);\n"; 00165 *ps_sh << "\n"; 00166 *ps_sh << " virtual void _tao_encode (\n"; 00167 *ps_sh << " TAO_OutputCDR &\n"; 00168 *ps_sh << " ACE_ENV_ARG_DECL_NOT_USED\n"; 00169 *ps_sh << " ) const;\n"; 00170 *ps_sh << " \n"; 00171 *ps_sh << " virtual void _tao_decode (\n"; 00172 *ps_sh << " TAO_InputCDR &\n"; 00173 *ps_sh << " ACE_ENV_ARG_DECL_NOT_USED\n"; 00174 *ps_sh << " );\n"; 00175 *ps_sh << " \n"; 00176 00177 if (this->identifiers_.size () > 1) 00178 { 00179 *ps_sh << " " << this->exception_name_ << " (\n"; 00180 00181 for (unsigned int i = 1; i < this->count_; ++i) 00182 { 00183 if (this->base_type (this->identifiers_[i], type)) 00184 { 00185 if (ACE_OS::strcmp (type.c_str (), "char *") == 0) 00186 { 00187 *ps_sh << " " << "const char *" 00188 << " " << this->identifiers_[i+1] 00189 << ";\n"; 00190 } 00191 else 00192 { 00193 *ps_sh << " " << this->version_for_stub (type) 00194 << " " << this->identifiers_[i+1] 00195 << ";\n"; 00196 } 00197 } 00198 else 00199 { 00200 // Types defined previously in the idl. 00201 *ps_sh << " ACE_NESTED_CLASS (" 00202 << name_space << "::" << interface_name 00203 << ", " << this->identifiers_[i] 00204 << ") " << this->identifiers_[i+1] 00205 << ";\n"; 00206 } 00207 ++i; 00208 } 00209 } 00210 00211 *ps_sh << " \n"; 00212 *ps_sh << " virtual CORBA::TypeCode_ptr _type (void) const;\n"; 00213 *ps_sh << " };\n"; 00214 *ps_sh << "\n"; 00215 *ps_sh << "static ::CORBA::TypeCode_ptr _tc_" 00216 << this->exception_name_ << ";\n"; 00217 *ps_sh << " \n"; 00218 *ps_sh << " \n"; 00219 *ps_sh << "#endif /* end #if !defined */\n"; 00220 *ps_sh << " \n"; 00221 } |
|
Reimplemented from TAO_PSDL_Node_Visitor. Definition at line 35 of file PSDL_Exception_Visitor.cpp. References TAO_PSDL_Node::accept(), exception_name_, TAO_PSDL_Except_Dcl::identifier(), TAO_PSDL_Except_Dcl::member_list(), print_class_for_exception(), and ACE_Array_Base< ACE_CString >::size().
00036 { 00037 // This is where the control first comes to this class. Set the 00038 // initial size of this->identifiers_ 00039 this->identifiers_.size (1); 00040 00041 if (except_dcl->identifier ()->accept (this) == -1) 00042 return -1; 00043 00044 // Save the exception name. 00045 this->exception_name_ = this->identifiers_ [this->count_ - 1]; 00046 00047 if (except_dcl->member_list () != 0) 00048 if (except_dcl->member_list ()->accept (this) == -1) 00049 return -1; 00050 00051 // Print the code that should go into the generated header file. 00052 // @@ Update this method to get the code that should go to 00053 // implementation method (as applies). 00054 this->print_class_for_exception (); 00055 00056 return 0; 00057 } |
|
Reimplemented from TAO_PSDL_Node_Visitor. Definition at line 21 of file PSDL_Exception_Visitor.cpp. References ACE_Array_Base< ACE_CString >::size(), and TAO_PSDL_Identifier::value().
00022 { 00023 // Save the identifiers for future use. 00024 this->identifiers_.size (this->count_ +1); 00025 00026 this->identifiers_ [this->count_] = identifier->value (); 00027 00028 // Increment the count..for future purposes. 00029 ++this->count_; 00030 00031 return 0; 00032 } |
|
Reimplemented from TAO_PSDL_Node_Visitor. Definition at line 60 of file PSDL_Exception_Visitor.cpp. References TAO_PSDL_Node::accept(), TAO_PSDL_Member_List::member(), and TAO_PSDL_Member_List::member_list().
00061 { 00062 if (member_list->member ()->accept (this) == -1) 00063 return -1; 00064 00065 if (member_list->member_list () != 0) 00066 { 00067 if (member_list->member_list ()->accept (this) == -1) 00068 return -1; 00069 } 00070 return 0; 00071 } |
|
Reimplemented from TAO_PSDL_Node_Visitor. Definition at line 74 of file PSDL_Exception_Visitor.cpp. References TAO_PSDL_Scope::convert_str(), TAO_PSDL_Scope::instance(), ACE_Array_Base< ACE_CString >::size(), and TAO_PSDL_Predefined_Type::type_one().
00075 { 00076 if (predefined_type->type_one () != 0) 00077 { 00078 this->identifiers_.size (this->count_ +1); 00079 00080 // Save the type of the identifier. 00081 this->identifiers_ [this->count_] = 00082 TAO_PSDL_Scope::instance ()->convert_str (predefined_type->type_one ()); 00083 ++this->count_; 00084 } 00085 return 0; 00086 } |
|
Definition at line 51 of file PSDL_Exception_Visitor.h. Referenced by print_class_for_exception(), and visit_except_dcl(). |