00001 #include "PSDL_Interface_Visitor.h"
00002 #include "PSDL_Stream.h"
00003
00004 ACE_RCSID (PSS,
00005 PSDL_Interface_Visitor,
00006 "$Id: PSDL_Interface_Visitor.cpp 76589 2007-01-25 18:04:11Z elliott_c $")
00007
00008 TAO_PSDL_Interface_Visitor::TAO_PSDL_Interface_Visitor (void)
00009 : forward_dcl_ (0),
00010 interface_name_ ()
00011 {
00012
00013 }
00014
00015 TAO_PSDL_Interface_Visitor::~TAO_PSDL_Interface_Visitor (void)
00016 {
00017
00018 }
00019
00020 int
00021 TAO_PSDL_Interface_Visitor::visit_identifier (TAO_PSDL_Identifier *identifier)
00022 {
00023 this->identifiers_.size (1);
00024 this->count_ = 0;
00025
00026
00027 this->identifiers_ [this->count_] = identifier->value ();
00028
00029 return 0;
00030 }
00031
00032 int
00033 TAO_PSDL_Interface_Visitor::visit_forward_dcl (TAO_PSDL_Forward_Dcl *forward_dcl)
00034 {
00035 if (forward_dcl->identifier ()->accept (this) == -1)
00036 return -1;
00037
00038 this->interface_name_ = this->identifiers_[this->count_];
00039
00040
00041 TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
00042
00043 ps_sh->reset ();
00044
00045 *ps_sh << "class " << this->interface_name_ << ";";
00046 ps_sh->nl ();
00047
00048 this->forward_dcl_ = 1;
00049 this->print_for_forward_dcl ();
00050
00051 return 0;
00052 }
00053
00054 int
00055 TAO_PSDL_Interface_Visitor::visit_interface_dcl (TAO_PSDL_Interface_Dcl *interface_dcl)
00056 {
00057 if (interface_dcl->interface_header ()->accept (this) == -1)
00058 return -1;
00059
00060 if (interface_dcl->interface_body () != 0)
00061 {
00062 if (interface_dcl->interface_body ()->accept (this) == -1)
00063 return -1;
00064 }
00065
00066
00067 this->print_end_for_interface ();
00068 return 0;
00069 }
00070
00071 int
00072 TAO_PSDL_Interface_Visitor::visit_interface_header (TAO_PSDL_Interface_Header *interface_header)
00073 {
00074 if (interface_header->identifier ()->accept (this) == -1)
00075 return -1;
00076
00077 this->interface_name_ = this->identifiers_[this->count_];
00078 TAO_PSDL_Scope::instance ()->set_interface_name (this->interface_name_);
00079 this->print_class_for_interface ();
00080
00081 if (interface_header->type () != 0)
00082 {
00083 if (interface_header->type ()->accept (this) == -1)
00084 return -1;
00085 }
00086
00087 if (interface_header->interface_inheritance_spec () != 0)
00088 {
00089 if (interface_header->interface_inheritance_spec ()->accept (this) == -1)
00090 return -1;
00091 }
00092
00093 return 0;
00094 }
00095
00096 void
00097 TAO_PSDL_Interface_Visitor::print_for_forward_dcl (void)
00098 {
00099
00100 TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
00101
00102 ps_sh->reset ();
00103
00104 ps_sh->nl ();
00105
00106 ACE_CString name_space = TAO_PSDL_Scope::instance ()->get_name_space ();
00107
00108 *ps_sh << "#if !defined (_" << name_space << "_" << this->interface_name_
00109 << "___PTR_CH_)"; ps_sh->nl ();
00110
00111 *ps_sh << "#define _" << name_space << "_"
00112 << this->interface_name_ << "___PTR_CH_";
00113
00114 ps_sh->nl ();
00115 ps_sh->nl ();
00116
00117 if (this->forward_dcl_ != 1)
00118 {
00119 *ps_sh << "class " << this->interface_name_ << ";"; ps_sh->nl ();
00120 }
00121
00122 *ps_sh << "typedef " << this->interface_name_ << "*"
00123 << this->interface_name_ << "_ptr;";
00124 ps_sh->nl ();
00125 ps_sh->nl ();
00126
00127 *ps_sh << "#endif /* end #if !defined */" << "\n\n"; ps_sh->nl ();
00128
00129 *ps_sh << "#if !defined (_" << name_space << "_"
00130 << this->interface_name_ << "___VAR_CH_)";
00131 ps_sh->nl ();
00132
00133 *ps_sh << "#define _" << name_space << "_"
00134 << this->interface_name_ << "___VAR_CH_";
00135 ps_sh->nl ();
00136 ps_sh->nl ();
00137
00138 *ps_sh << "class " << this->interface_name_.c_str ()
00139 << "_var : public TAO_Base_Var"; ps_sh->nl ();
00140
00141 *ps_sh << "{";
00142 ps_sh->nl ();
00143 ps_sh->incr_indent (0);
00144
00145 *ps_sh << "public:";
00146 ps_sh->nl ();
00147
00148 *ps_sh << this->interface_name_ << "_var (void);"
00149 << "// default constructor";
00150 ps_sh->nl ();
00151
00152 *ps_sh << this->interface_name_ << "_var (" << this->interface_name_
00153 << "_ptr p) : ptr_ (p) {}";
00154 ps_sh->nl ();
00155
00156 *ps_sh << this->interface_name_ << "_var (const "
00157 << this->interface_name_
00158 << "_var &);" << "// copy constructor";
00159 ps_sh->nl ();
00160
00161 *ps_sh << " ~" << this->interface_name_ << "_var (void"
00162 << "); // destructor";
00163 ps_sh->nl ();
00164 ps_sh->nl ();
00165
00166 *ps_sh << this->interface_name_ << "_var"
00167 << "&operator= (" << this->interface_name_
00168 << "_ptr);"; ps_sh->nl ();
00169
00170 *ps_sh << this->interface_name_ << "_var"
00171 << "&operator= (const " << this->interface_name_
00172 << "_var &);";
00173 ps_sh->nl ();
00174
00175 *ps_sh << this->interface_name_
00176 << "_ptr operator-> (void) const;";
00177 ps_sh->nl ();
00178 ps_sh->nl ();
00179
00180 *ps_sh << "operator const "
00181 << this->interface_name_ << "_ptr &() const;"; ps_sh->nl ();
00182
00183 *ps_sh << "operator "
00184 << this->interface_name_ << "_ptr &();";
00185
00186 ps_sh->nl ();
00187 ps_sh->nl ();
00188
00189 *ps_sh << "// in, inout, out, _retn"; ps_sh->nl ();
00190
00191 *ps_sh << this->interface_name_ << "_ptr in (void) const;";
00192 ps_sh->nl ();
00193
00194 *ps_sh << this->interface_name_ << "_ptr &inout (void);";
00195 ps_sh->nl ();
00196
00197 *ps_sh << this->interface_name_ << "_ptr &out (void);";
00198 ps_sh->nl ();
00199
00200 *ps_sh << this->interface_name_ << "_ptr _retn (void);";
00201 ps_sh->nl ();
00202
00203 *ps_sh << this->interface_name_ << "_ptr ptr (void) const;";
00204 ps_sh->nl ();
00205 ps_sh->nl ();
00206
00207 *ps_sh << "// Hooks used by template sequence and object manager classes";
00208 ps_sh->nl ();
00209
00210 *ps_sh << "// for non-defined forward declared interfaces."; ps_sh->nl ();
00211
00212 *ps_sh << "static " << this->interface_name_ << "_ptr tao_duplicate ("
00213 << this->interface_name_ << "_ptr);";
00214 ps_sh->nl ();
00215
00216 *ps_sh << "static void tao_release ("
00217 << this->interface_name_ << "_ptr);";
00218 ps_sh->nl ();
00219
00220 *ps_sh << "static " << this->interface_name_
00221 << "_ptr tao_nil (void);"; ps_sh->nl ();
00222
00223 *ps_sh << "static " << this->interface_name_ << "_ptr tao_narrow (";
00224 ps_sh->incr_indent (0);
00225 ps_sh->nl ();
00226
00227 *ps_sh << "CORBA::Object *";
00228 ps_sh->nl ();
00229 *ps_sh << "";
00230
00231 ps_sh->decr_indent (0);
00232 ps_sh->nl ();
00233
00234 *ps_sh << ");";
00235 ps_sh->nl ();
00236
00237 *ps_sh << "static CORBA::Object * tao_upcast (void *);";
00238
00239 ps_sh->reset ();
00240 ps_sh->nl ();
00241 ps_sh->nl ();
00242
00243 *ps_sh << "private:";
00244 ps_sh->incr_indent (0);
00245 ps_sh->nl ();
00246
00247 *ps_sh << this->interface_name_ << "_ptr ptr_;";
00248 ps_sh->nl ();
00249
00250 *ps_sh << "// Unimplemented - prevents widening assignment.";
00251 ps_sh->nl ();
00252
00253 *ps_sh << this->interface_name_ << "_var (const TAO_Base_var &rhs);";
00254 ps_sh->nl ();
00255
00256 *ps_sh << this->interface_name_
00257 << "_var &operator= (const TAO_Base_var &rhs);";
00258 ps_sh->nl ();
00259
00260 ps_sh->decr_indent (0);
00261 ps_sh->nl ();
00262
00263 *ps_sh << "};";
00264 ps_sh->nl ();
00265
00266 *ps_sh << "#endif /* end #if !defined */";
00267 ps_sh->nl ();
00268 ps_sh->nl ();
00269
00270 ps_sh->reset ();
00271
00272 *ps_sh << "#if !defined (_" << name_space
00273 << "_" << this->interface_name_ << "___OUT_CH_)";
00274 ps_sh->nl ();
00275
00276 *ps_sh << "#define _" << name_space
00277 << "_" << this->interface_name_ << "___OUT_CH_";
00278 ps_sh->nl ();
00279 ps_sh->nl ();
00280
00281 *ps_sh << "class " << this->interface_name_ << "_out"; ps_sh->nl ();
00282 *ps_sh << "{";
00283 ps_sh->nl ();
00284 ps_sh->incr_indent (0);
00285
00286 *ps_sh << "public:"; ps_sh->nl ();
00287 *ps_sh << this->interface_name_ << "_out (" << this->interface_name_
00288 << "_ptr &);"; ps_sh->nl ();
00289 *ps_sh << this->interface_name_ << "_out (" << this->interface_name_
00290 << "_var &);"; ps_sh->nl ();
00291 *ps_sh << this->interface_name_ << "_out (const "
00292 << this->interface_name_ << "_out &);"; ps_sh->nl ();
00293 *ps_sh << this->interface_name_ << "_out &operator= (const "
00294 << this->interface_name_ << "_out &);"; ps_sh->nl ();
00295 *ps_sh << this->interface_name_ << "_out &operator= (const "
00296 << this->interface_name_ << "_var &);"; ps_sh->nl ();
00297 *ps_sh << this->interface_name_ << "_out &operator= ("
00298 << this->interface_name_ << "_ptr);"; ps_sh->nl ();
00299 *ps_sh << "operator " << this->interface_name_ << "_ptr &();"; ps_sh->nl ();
00300 *ps_sh << this->interface_name_ << "_ptr &ptr (void);"; ps_sh->nl ();
00301
00302 *ps_sh << this->interface_name_ << "_ptr operator-> (void);";
00303
00304 ps_sh->reset ();
00305 ps_sh->nl ();
00306 ps_sh->nl ();
00307
00308 *ps_sh << "private:";
00309 ps_sh->incr_indent (0);
00310 ps_sh->nl ();
00311 *ps_sh << this->interface_name_ << "_ptr &ptr_;"; ps_sh->nl ();
00312
00313 ps_sh->decr_indent (0);
00314 ps_sh->nl ();
00315
00316 *ps_sh << "};\n";
00317
00318 *ps_sh << "#endif /* end #if !defined */";
00319
00320 ps_sh->reset ();
00321
00322 ps_sh->nl ();
00323 ps_sh->nl ();
00324
00325
00326 *ps_sh << "// External declarations for undefined interface";
00327 ps_sh->nl ();
00328 *ps_sh << "//" << this->interface_name_;
00329 ps_sh->nl ();
00330 ps_sh->nl ();
00331
00332 *ps_sh << this->interface_name_ << "_ptr";
00333 ps_sh->nl ();
00334
00335 *ps_sh << "tao_" << this->interface_name_ << "_duplicate (";
00336 ps_sh->incr_indent (0);
00337 ps_sh->nl ();
00338
00339 *ps_sh << this->interface_name_ << "_ptr";
00340
00341 ps_sh->decr_indent (0);
00342 ps_sh->nl ();
00343 *ps_sh << ");";
00344
00345 ps_sh->nl ();
00346 ps_sh->nl ();
00347
00348 *ps_sh << "void";
00349 ps_sh->nl ();
00350 *ps_sh << "tao_" << this->interface_name_ << "_release (";
00351 ps_sh->incr_indent (0);
00352 ps_sh->nl ();
00353 *ps_sh << this->interface_name_ << "_ptr";
00354 ps_sh->decr_indent (0);
00355 ps_sh->nl ();
00356 *ps_sh << ");";
00357
00358 ps_sh->nl ();
00359 ps_sh->nl ();
00360
00361 *ps_sh << this->interface_name_ << "_ptr";
00362 ps_sh->nl ();
00363
00364 *ps_sh << "tao_" << this->interface_name_ << "_nil (";
00365 ps_sh->incr_indent (0);
00366 ps_sh->nl ();
00367 *ps_sh << "void";
00368 ps_sh->decr_indent (0);
00369 ps_sh->nl ();
00370 *ps_sh << ");";
00371
00372 ps_sh->nl ();
00373 ps_sh->nl ();
00374
00375 *ps_sh << this->interface_name_ << "_ptr";
00376 ps_sh->nl ();
00377
00378 *ps_sh << "tao_" << this->interface_name_ << "_narrow (";
00379 ps_sh->incr_indent (0);
00380 ps_sh->nl ();
00381
00382 *ps_sh << "CORBA::Object *";
00383 ps_sh->nl ();
00384
00385 *ps_sh << "";
00386
00387 ps_sh->decr_indent (0);
00388 ps_sh->nl ();
00389 *ps_sh << ");";
00390
00391 ps_sh->nl ();
00392 ps_sh->nl ();
00393
00394 *ps_sh << "CORBA::Object *";
00395 ps_sh->nl ();
00396 *ps_sh << "tao_" << this->interface_name_ << "_upcast (";
00397 ps_sh->incr_indent (0);
00398 ps_sh->nl ();
00399 *ps_sh << "void *";
00400 ps_sh->decr_indent (0);
00401 ps_sh->nl ();
00402 *ps_sh << ");";
00403
00404 ps_sh->nl ();
00405 ps_sh->nl ();
00406
00407 *ps_sh << "// Any operators for interface " << this->interface_name_;
00408 ps_sh->nl ();
00409
00410 *ps_sh << "void operator<<= (CORBA::Any &, " << this->interface_name_ << "_ptr);";
00411 ps_sh->nl ();
00412
00413 *ps_sh << "CORBA::Boolean operator>>= (const CORBA::Any &, " << this->interface_name_ << " *&);";
00414 ps_sh->nl ();
00415 ps_sh->nl ();
00416 *ps_sh << "#ifndef __ACE_INLINE__";
00417 ps_sh->nl ();
00418 ps_sh->nl ();
00419
00420 *ps_sh << " CORBA::Boolean operator<< (TAO_OutputCDR &, const " << this->interface_name_ << "_ptr );";
00421 ps_sh->nl ();
00422 *ps_sh << " CORBA::Boolean operator>> (TAO_InputCDR &, " << this->interface_name_ << "_ptr &);";
00423 ps_sh->nl ();
00424 ps_sh->nl ();
00425 *ps_sh << "#endif /* __ACE_INLINE__ */";
00426 ps_sh->nl ();
00427
00428 }
00429
00430 void
00431 TAO_PSDL_Interface_Visitor::print_class_for_interface (void)
00432 {
00433 this->print_for_forward_dcl ();
00434
00435 ACE_CString name_space = TAO_PSDL_Scope::instance ()->get_name_space ();
00436
00437
00438 TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
00439
00440 *ps_sh << "#if !defined (_" << name_space << "_" << this->interface_name_
00441 << "_CH_)"; ps_sh->nl ();
00442 *ps_sh << "#define _" << name_space << this->interface_name_
00443 << "_CH_"; ps_sh->nl ();
00444
00445 *ps_sh << "// Forward Classes Declaration."; ps_sh->nl ();
00446 *ps_sh << "class _TAO_" << this->interface_name_ << "_Proxy_Impl;"; ps_sh->nl ();
00447 *ps_sh << "class _TAO_" << this->interface_name_ << "_Remote_Proxy_Impl;"; ps_sh->nl ();
00448 *ps_sh << "class _TAO_" << this->interface_name_ << "_Proxy_Broker;"; ps_sh->nl ();
00449 *ps_sh << "class _TAO_" << this->interface_name_ << "_Remote_Proxy_Broker;"; ps_sh->nl ();
00450
00451
00452 *ps_sh << "class " << this->interface_name_;
00453 *ps_sh << ": public virtual CORBA::Object"; ps_sh->nl ();
00454
00455 *ps_sh << "{";
00456 ps_sh->nl ();
00457 ps_sh->incr_indent (0);
00458
00459 *ps_sh << "public:"; ps_sh->nl ();
00460
00461 *ps_sh << "typedef " << this->interface_name_ << "_ptr _ptr_type;"; ps_sh->nl ();
00462 *ps_sh << "typedef " << this->interface_name_ << "_var _var_type;"; ps_sh->nl ();
00463
00464 *ps_sh << "static int _tao_class_id;"; ps_sh->nl ();
00465
00466 *ps_sh << "// The static operations."; ps_sh->nl ();
00467 *ps_sh << "static " << this->interface_name_
00468 << "_ptr _duplicate ("
00469 << this->interface_name_ << "_ptr obj);"
00470 ;
00471
00472 *ps_sh << "static " << this->interface_name_ << "_ptr _narrow ("; ps_sh->nl ();
00473 *ps_sh << "CORBA::Object_ptr obj"; ps_sh->nl ();
00474 *ps_sh << ""; ps_sh->nl ();
00475 *ps_sh << ");"; ps_sh->nl ();
00476
00477 *ps_sh << "static " << this->interface_name_
00478 << "_ptr _unchecked_narrow ("; ps_sh->nl ();
00479 *ps_sh << "CORBA::Object_ptr obj"; ps_sh->nl ();
00480 *ps_sh << ""; ps_sh->nl ();
00481 *ps_sh << ");"; ps_sh->nl ();
00482
00483 *ps_sh << "static " << this->interface_name_ << "_ptr _nil (void)"; ps_sh->nl ();
00484 *ps_sh << "{"; ps_sh->nl ();
00485 *ps_sh << "return (" << this->interface_name_ << "_ptr)0;";
00486
00487 ps_sh->decr_indent (0);
00488 ps_sh->nl ();
00489
00490 *ps_sh << "}"; ps_sh->nl ();
00491
00492 *ps_sh << "static void _tao_any_destructor (void*);"; ps_sh->nl ();
00493
00494
00495 }
00496
00497 void
00498 TAO_PSDL_Interface_Visitor::print_end_for_interface (void)
00499 {
00500 ACE_CString name_space = TAO_PSDL_Scope::instance ()->get_name_space ();
00501
00502
00503 TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
00504
00505 *ps_sh << "virtual CORBA::Boolean _is_a ("; ps_sh->nl ();
00506 *ps_sh << "const CORBA::Char *type_id"; ps_sh->nl ();
00507 *ps_sh << ""; ps_sh->nl ();
00508 *ps_sh << ");"; ps_sh->nl ();
00509
00510 *ps_sh << "virtual void *_tao_QueryInterface (ptrdiff_t type);"; ps_sh->nl ();
00511
00512 *ps_sh << "virtual const char* _interface_repository_id (void) const;"; ps_sh->nl ();
00513
00514 *ps_sh << "private:"; ps_sh->nl ();
00515 *ps_sh << "_TAO_" << this->interface_name_ << "_Proxy_Broker *the_TAO_" << this->interface_name_ << "_Proxy_Broker_;"; ps_sh->nl ();
00516
00517 *ps_sh << "protected:"; ps_sh->nl ();
00518 *ps_sh << this->interface_name_ << "(int collocated = 0);"; ps_sh->nl ();
00519
00520 *ps_sh << "// These methods travese the inheritance tree and set the"; ps_sh->nl ();
00521 *ps_sh << "// parents piece of the given class in the right mode"; ps_sh->nl ();
00522 *ps_sh << "virtual void " << name_space << "_" << this->interface_name_
00523 << "_setup_collocation (int collocated);"; ps_sh->nl ();
00524
00525 *ps_sh << this->interface_name_ << "("; ps_sh->nl ();
00526 *ps_sh << "TAO_Stub *objref, "; ps_sh->nl ();
00527 *ps_sh << "CORBA::Boolean _tao_collocated = 0,"; ps_sh->nl ();
00528 *ps_sh << "TAO_Abstract_ServantBase *servant = 0"; ps_sh->nl ();
00529 *ps_sh << ");"; ps_sh->nl ();
00530
00531 *ps_sh << "friend class _TAO_" << this->interface_name_ << "_Remote_Proxy_Impl;"; ps_sh->nl ();
00532 *ps_sh << "friend class _TAO_" << this->interface_name_ << "_ThruPOA_Proxy_Impl;"; ps_sh->nl ();
00533 *ps_sh << "friend class _TAO_" << this->interface_name_ << "_Direct_Proxy_Impl;"; ps_sh->nl ();
00534
00535 *ps_sh << "virtual ~" << this->interface_name_ << "(void);"; ps_sh->nl ();
00536
00537 *ps_sh << "private:"; ps_sh->nl ();
00538 *ps_sh << this->interface_name_ << "(const " << this->interface_name_ << "&);"; ps_sh->nl ();
00539 *ps_sh << "void operator= (const " << this->interface_name_ << "&);"; ps_sh->nl ();
00540 *ps_sh << "};"; ps_sh->nl ();
00541
00542 *ps_sh << "// The Proxy Implementations are used by each interface to"; ps_sh->nl ();
00543 *ps_sh << "// perform a call. Each different implementation encapsulate"; ps_sh->nl ();
00544 *ps_sh << "// an invocation logics."; ps_sh->nl ();
00545
00546
00547 *ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
00548 *ps_sh << "// Base Proxy Impl. Declaration"; ps_sh->nl ();
00549 *ps_sh << "//"; ps_sh->nl ();
00550
00551 *ps_sh << "class _TAO_" << this->interface_name_ << "_Proxy_Impl"; ps_sh->nl ();
00552 *ps_sh << ": public virtual TAO_Object_Proxy_Impl"; ps_sh->nl ();
00553
00554 *ps_sh << "{";
00555 ps_sh->nl ();
00556 ps_sh->incr_indent (0);
00557
00558 *ps_sh << "public:"; ps_sh->nl ();
00559 *ps_sh << "virtual ~_TAO_" << this->interface_name_ << "_Proxy_Impl (void) { }"; ps_sh->nl ();
00560
00561 *ps_sh << "protected:"; ps_sh->nl ();
00562 *ps_sh << "_TAO_" << this->interface_name_ << "_Proxy_Impl (void);"; ps_sh->nl ();
00563 *ps_sh << "};"; ps_sh->nl ();
00564
00565 *ps_sh << "//"; ps_sh->nl ();
00566 *ps_sh << "// End Base Proxy Impl. Declaration"; ps_sh->nl ();
00567 *ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
00568
00569
00570 *ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
00571 *ps_sh << "// Remote Proxy Impl. Declaration"; ps_sh->nl ();
00572 *ps_sh << "//"; ps_sh->nl ();
00573
00574 *ps_sh << "class _TAO_" << this->interface_name_ << "_Remote_Proxy_Impl"; ps_sh->nl ();
00575 *ps_sh << ": public virtual _TAO_" << this->interface_name_ << "_Proxy_Impl,"; ps_sh->nl ();
00576 *ps_sh << "public virtual TAO_Remote_Object_Proxy_Impl"; ps_sh->nl ();
00577
00578 *ps_sh << "{";
00579 ps_sh->nl ();
00580 ps_sh->incr_indent (0);
00581
00582 *ps_sh << "public:";
00583 ps_sh->nl ();
00584
00585 *ps_sh << "_TAO_" << this->interface_name_
00586 << "_Remote_Proxy_Impl (void);";
00587 ps_sh->nl ();
00588
00589 *ps_sh << "virtual ~_TAO_" << this->interface_name_
00590 << "_Remote_Proxy_Impl (void) { }";
00591
00592 ps_sh->decr_indent (0);
00593 ps_sh->nl ();
00594
00595 *ps_sh << "};"; ps_sh->nl ();
00596
00597 *ps_sh << "//"; ps_sh->nl ();
00598 *ps_sh << "// End Remote Proxy Impl. Declaration"; ps_sh->nl ();
00599 *ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
00600
00601 *ps_sh << "// The Proxy Brokers are used by each interface to get"; ps_sh->nl ();
00602 *ps_sh << "// the right proxy for performing a call. In the new "; ps_sh->nl ();
00603 *ps_sh << "// collocation scheme, the proxy to be used can vary on"; ps_sh->nl ();
00604 *ps_sh << "// a call by call basis."; ps_sh->nl ();
00605
00606
00607 *ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
00608 *ps_sh << "// Base Proxy Broker Declaration "; ps_sh->nl ();
00609 *ps_sh << "//"; ps_sh->nl ();
00610
00611 *ps_sh << "class _TAO_" << this->interface_name_ << "_Proxy_Broker";
00612 ps_sh->nl ();
00613
00614 *ps_sh << "{";
00615 ps_sh->incr_indent (0);
00616 ps_sh->nl ();
00617
00618 *ps_sh << "public:";
00619 ps_sh->nl ();
00620 *ps_sh << "virtual ~_TAO_" << this->interface_name_ << "_Proxy_Broker (void);"; ps_sh->nl ();
00621 *ps_sh << "virtual _TAO_" << this->interface_name_ << "_Proxy_Impl &select_proxy ("; ps_sh->nl ();
00622 *ps_sh << this->interface_name_ << "*object"; ps_sh->nl ();
00623 *ps_sh << ""; ps_sh->nl ();
00624 *ps_sh << ") = 0;"; ps_sh->nl ();
00625
00626 *ps_sh << "protected:"; ps_sh->nl ();
00627 *ps_sh << "_TAO_" << this->interface_name_ << "_Proxy_Broker (void);";
00628 ps_sh->nl ();
00629
00630 *ps_sh << "};"; ps_sh->nl ();
00631
00632 *ps_sh << "//"; ps_sh->nl ();
00633 *ps_sh << "// End Base Proxy Broker Declaration "; ps_sh->nl ();
00634 *ps_sh << "///////////////////////////////////////////////////////////////";
00635 ps_sh->nl ();
00636
00637
00638 *ps_sh << "///////////////////////////////////////////////////////////////";
00639 ps_sh->nl ();
00640 *ps_sh << "// Remote Proxy Broker Declaration ";
00641 ps_sh->nl ();
00642 *ps_sh << "//";
00643 ps_sh->nl ();
00644
00645 *ps_sh << "class _TAO_" << this->interface_name_ << "_Remote_Proxy_Broker";
00646 ps_sh->nl ();
00647 *ps_sh << ": public virtual _TAO_" << this->interface_name_
00648 << "_Proxy_Broker";
00649 ps_sh->nl ();
00650
00651 *ps_sh << "{";
00652 ps_sh->incr_indent (0);
00653 ps_sh->nl ();
00654
00655 *ps_sh << "public: "; ps_sh->nl ();
00656 *ps_sh << "_TAO_" << this->interface_name_ << "_Remote_Proxy_Broker (void);"; ps_sh->nl ();
00657
00658 *ps_sh << "virtual ~_TAO_" << this->interface_name_ << "_Remote_Proxy_Broker (void);"; ps_sh->nl ();
00659
00660 *ps_sh << "virtual _TAO_" << this->interface_name_ << "_Proxy_Impl &select_proxy ("; ps_sh->nl ();
00661 *ps_sh << this->interface_name_ << "*object"; ps_sh->nl ();
00662 *ps_sh << ""; ps_sh->nl ();
00663 *ps_sh << ");"; ps_sh->nl ();
00664
00665 *ps_sh << "private:"; ps_sh->nl ();
00666 *ps_sh << "_TAO_" << this->interface_name_ << "_Remote_Proxy_Impl remote_proxy_impl_;"; ps_sh->nl ();
00667
00668 *ps_sh << "public:"; ps_sh->nl ();
00669 *ps_sh << "// This member function is used to get an handle to the unique instance"; ps_sh->nl ();
00670 *ps_sh << "// of the Remote Proxy Broker that is available for a given"; ps_sh->nl ();
00671 *ps_sh << "// interface."; ps_sh->nl ();
00672 *ps_sh << "static _TAO_" << this->interface_name_ << "_Remote_Proxy_Broker *the_TAO_" << this->interface_name_ << "_Remote_Proxy_Broker (void);"; ps_sh->nl ();
00673 *ps_sh << "};"; ps_sh->nl ();
00674
00675 *ps_sh << "//"; ps_sh->nl ();
00676 *ps_sh << "// End Remote Proxy Broker Declaration "; ps_sh->nl ();
00677 *ps_sh << "//////////////////////////////////////////////////////////////";
00678 ps_sh->nl ();
00679
00680 *ps_sh << "#endif /* end #if !defined */"; ps_sh->nl ();
00681
00682 *ps_sh << "TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_"
00683 << this->interface_name_ << ";";
00684 ps_sh->nl ();
00685 }
00686
00687 void
00688 TAO_PSDL_Interface_Visitor::gen_code_for_si (void)
00689 {
00690 TAO_PSDL_Stream *ps_si = TAO_PSDL_Scope::instance ()->get_si ();
00691
00692 ps_si->reset ();
00693 ps_si->indent ();
00694
00695 *ps_si << "int " << this->interface_name_ << "::_tao_class_id = 0;";
00696 ps_si->nl ();
00697 ps_si->nl ();
00698
00699 *ps_si << this->interface_name_ << "_ptr";
00700 ps_si->nl ();
00701 *ps_si << "tao_" << this->interface_name_ << "_duplicate (";
00702 ps_si->incr_indent (0);
00703 ps_si->nl ();
00704 *ps_si << this->interface_name_ << "_ptr p";
00705 ps_si->nl ();
00706 *ps_si << ")";
00707 ps_si->decr_indent (0);
00708 ps_si->nl ();
00709 *ps_si << "{";
00710 ps_si->incr_indent (0);
00711 ps_si->nl ();
00712 *ps_si << "return " << this->interface_name_ << "::_duplicate (p);";
00713 ps_si->decr_indent (0);
00714 ps_si->nl ();
00715 *ps_si << "}";
00716 ps_si->nl ();
00717
00718 ps_si->nl ();
00719
00720 *ps_si << "void";
00721 ps_si->nl ();
00722
00723 *ps_si << "tao_" << this->interface_name_ << "_release (";
00724 ps_si->incr_indent (0);
00725 ps_si->nl ();
00726
00727 *ps_si << this->interface_name_ << "_ptr p";
00728 ps_si->nl ();
00729
00730 *ps_si << ")";
00731 ps_si->decr_indent (0);
00732 ps_si->nl ();
00733 *ps_si << "{";
00734
00735 ps_si->incr_indent (0);
00736 ps_si->nl ();
00737 *ps_si << "CORBA::release (p);";
00738 ps_si->decr_indent (0);
00739 ps_si->nl ();
00740 *ps_si << "}";
00741
00742 ps_si->nl ();
00743 ps_si->nl ();
00744
00745 *ps_si << this->interface_name_ << "_ptr";
00746 ps_si->nl ();
00747 *ps_si << "tao_" << this->interface_name_ << "_nil (";
00748 ps_si->incr_indent (0);
00749 ps_si->nl ();
00750 *ps_si << "void";
00751 ps_si->nl ();
00752 *ps_si << ")";
00753 ps_si->decr_indent (0);
00754 ps_si->nl ();
00755 *ps_si << "{";
00756 ps_si->incr_indent (0);
00757 ps_si->nl ();
00758 *ps_si << "return " << this->interface_name_ << "::_nil ();";
00759 ps_si->decr_indent (0);
00760 ps_si->nl ();
00761 *ps_si << "}";
00762 ps_si->nl ();
00763
00764 ps_si->nl ();
00765
00766 *ps_si << this->interface_name_ << "_ptr";
00767 ps_si->nl ();
00768 *ps_si << "tao_" << this->interface_name_ << "_narrow (";
00769 ps_si->incr_indent (0);
00770 ps_si->nl ();
00771 *ps_si << "CORBA::Object *p";
00772 ps_si->nl ();
00773
00774 *ps_si << ""; ps_si->nl ();
00775 *ps_si << ")";
00776 ps_si->decr_indent (0);
00777 ps_si->nl ();
00778 *ps_si << "{";
00779
00780 ps_si->incr_indent (0);
00781 ps_si->nl ();
00782
00783 *ps_si << "return " << this->interface_name_
00784 << "::_narrow (p);";
00785 ps_si->decr_indent (0);
00786 ps_si->nl ();
00787 *ps_si << "}";
00788
00789 ps_si->nl ();
00790 ps_si->nl ();
00791
00792 *ps_si << "CORBA::Object *"; ps_si->nl ();
00793 *ps_si << "tao_" << this->interface_name_ << "_upcast (";
00794
00795 ps_si->incr_indent (0);
00796 ps_si->nl ();
00797
00798 *ps_si << "void *src"; ps_si->nl ();
00799 *ps_si << ")";
00800 ps_si->decr_indent (0);
00801 ps_si->nl ();
00802
00803 *ps_si << "{";
00804 ps_si->incr_indent (0);
00805 ps_si->nl ();
00806
00807 *ps_si << this->interface_name_ << " **tmp =";
00808 ps_si->incr_indent (0);
00809 ps_si->nl ();
00810 *ps_si << "ACE_static_cast (" << this->interface_name_ << " **, src);";
00811 ps_si->decr_indent (0);
00812 ps_si->nl ();
00813 *ps_si << "return *tmp;";
00814 ps_si->decr_indent (0);
00815 ps_si->nl ();
00816 *ps_si << "}";
00817
00818 ps_si->nl ();
00819 ps_si->nl ();
00820
00821 *ps_si << "// ***********************************************************";
00822 ps_si->nl ();
00823 *ps_si << "// " << this->interface_name_ << "_var"; ps_si->nl ();
00824 *ps_si << "// ***********************************************************";
00825
00826 ps_si->nl ();
00827 ps_si->nl ();
00828
00829 *ps_si << this->interface_name_ << "_var::"
00830 << this->interface_name_
00831 << "_var (void) // default constructor";
00832
00833 ps_si->incr_indent (0);
00834 ps_si->nl ();
00835 *ps_si << ": ptr_ (" << this->interface_name_ << "::_nil ())";
00836
00837 ps_si->decr_indent (0);
00838 ps_si->nl ();
00839 *ps_si << "{}";
00840
00841 ps_si->nl ();
00842 ps_si->nl ();
00843
00844 *ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
00845 *ps_si << this->interface_name_ << "_var::ptr (void) const"; ps_si->nl ();
00846
00847 *ps_si << "{";
00848 ps_si->incr_indent (0);
00849 ps_si->nl ();
00850 *ps_si << "return this->ptr_;";
00851
00852 ps_si->decr_indent (0);
00853 ps_si->nl ();
00854 *ps_si << "}";
00855
00856 ps_si->nl ();
00857 ps_si->nl ();
00858
00859 *ps_si << this->interface_name_ << "_var::"
00860 << this->interface_name_ << "_var (const ::"
00861 << this->interface_name_ << "_var &p) // copy constructor";
00862
00863 ps_si->incr_indent (0);
00864 ps_si->nl ();
00865 *ps_si << ": TAO_Base_var (),";
00866
00867 ps_si->incr_indent (0); ps_si->nl ();
00868 *ps_si << "ptr_ (" << this->interface_name_
00869 << "::_duplicate (p.ptr ()))";
00870
00871 ps_si->decr_indent (0);
00872 ps_si->decr_indent (0);
00873 ps_si->nl ();
00874 *ps_si << "{}";
00875
00876 ps_si->nl ();
00877 ps_si->nl ();
00878
00879 *ps_si << this->interface_name_ << "_var::~"
00880 << this->interface_name_ << "_var (void) // destructor";
00881
00882 ps_si->nl ();
00883 *ps_si << "{";
00884 ps_si->incr_indent (0);
00885 ps_si->nl ();
00886 *ps_si << "CORBA::release (this->ptr_);";
00887
00888 ps_si->decr_indent (0);
00889 ps_si->nl ();
00890 *ps_si << "}";
00891
00892 ps_si->nl ();
00893 ps_si->nl ();
00894
00895 *ps_si << this->interface_name_ << "_var &"; ps_si->nl ();
00896 *ps_si << this->interface_name_ << "_var::operator= ("
00897 << this->interface_name_ << "_ptr p)";
00898
00899 ps_si->nl ();
00900 *ps_si << "{";
00901 ps_si->incr_indent (0);
00902 ps_si->nl ();
00903
00904 *ps_si << "this->ptr_ = p;"; ps_si->nl ();
00905 *ps_si << "return *this;";
00906
00907 ps_si->decr_indent (0);
00908 ps_si->nl ();
00909 *ps_si << "}";
00910
00911 ps_si->nl ();
00912 ps_si->nl ();
00913
00914 *ps_si << this->interface_name_ << "_var &"; ps_si->nl ();
00915 *ps_si << this->interface_name_ << "_var::operator= (const ::"
00916 << this->interface_name_ << "_var &p)";
00917 ps_si->nl ();
00918
00919 *ps_si << "{";
00920 ps_si->incr_indent (0);
00921 ps_si->nl ();
00922
00923 *ps_si << "if (this != &p)";
00924
00925 ps_si->incr_indent (0);
00926 ps_si->nl ();
00927 *ps_si << "{";
00928
00929 ps_si->incr_indent (0);
00930 ps_si->nl ();
00931
00932 *ps_si << "CORBA::release (this->ptr_);"; ps_si->nl ();
00933 *ps_si << "this->ptr_ = ::" << this->interface_name_
00934 << "::_duplicate (p.ptr ());";
00935 ps_si->decr_indent (0);
00936 ps_si->nl ();
00937 *ps_si << "}";
00938
00939 ps_si->decr_indent (0);
00940 ps_si->nl ();
00941
00942 *ps_si << "return *this;";
00943
00944 ps_si->decr_indent (0);
00945 ps_si->nl ();
00946 *ps_si << "}";
00947
00948 ps_si->nl ();
00949 ps_si->nl ();
00950
00951 *ps_si << this->interface_name_ << "_var::operator const ::"
00952 << this->interface_name_ << "_ptr &() const // cast"; ps_si->nl ();
00953 *ps_si << "{";
00954
00955 ps_si->incr_indent (0);
00956 ps_si->nl ();
00957 *ps_si << "return this->ptr_;";
00958
00959 ps_si->decr_indent (0);
00960 ps_si->nl ();
00961 *ps_si << "}";
00962
00963 ps_si->nl ();
00964 ps_si->nl ();
00965
00966 *ps_si << this->interface_name_ << "_var::operator ::"
00967 << this->interface_name_ << "_ptr &() // cast "; ps_si->nl ();
00968 *ps_si << "{";
00969 ps_si->incr_indent (0);
00970 ps_si->nl ();
00971
00972 *ps_si << "return this->ptr_;";
00973
00974 ps_si->decr_indent (0);
00975 ps_si->nl ();
00976 *ps_si << "}";
00977
00978 ps_si->nl ();
00979 ps_si->nl ();
00980
00981 *ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
00982 *ps_si << this->interface_name_ << "_var::operator-> (void) const";
00983 ps_si->nl ();
00984
00985 *ps_si << "{";
00986 ps_si->incr_indent (0);
00987 ps_si->nl ();
00988
00989 *ps_si << "return this->ptr_;";
00990
00991 ps_si->decr_indent (0);
00992 ps_si->nl ();
00993 *ps_si << "}";
00994
00995 ps_si->nl ();
00996 ps_si->nl ();
00997
00998 *ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
00999 *ps_si << this->interface_name_ << "_var::in (void) const"; ps_si->nl ();
01000
01001 *ps_si << "{";
01002 ps_si->incr_indent (0);
01003 ps_si->nl ();
01004
01005 *ps_si << "return this->ptr_;";
01006
01007 ps_si->decr_indent (0);
01008 ps_si->nl ();
01009 *ps_si << "}";
01010
01011 ps_si->nl ();
01012 ps_si->nl ();
01013
01014 *ps_si << "::" << this->interface_name_ << "_ptr &"; ps_si->nl ();
01015 *ps_si << this->interface_name_ << "_var::inout (void)"; ps_si->nl ();
01016
01017 *ps_si << "{";
01018 ps_si->incr_indent (0);
01019 ps_si->nl ();
01020
01021 *ps_si << "return this->ptr_;";
01022
01023 ps_si->decr_indent (0);
01024 ps_si->nl ();
01025 *ps_si << "}";
01026
01027 ps_si->nl ();
01028 ps_si->nl ();
01029
01030 *ps_si << "::" << this->interface_name_ << "_ptr &"; ps_si->nl ();
01031 *ps_si << this->interface_name_ << "_var::out (void)"; ps_si->nl ();
01032
01033 *ps_si << "{";
01034 ps_si->incr_indent (0);
01035 ps_si->nl ();
01036
01037 *ps_si << "CORBA::release (this->ptr_);"; ps_si->nl ();
01038 *ps_si << "this->ptr_ = ::" << this->interface_name_ << "::_nil ();";
01039 ps_si->nl ();
01040 *ps_si << "return this->ptr_;";
01041
01042 ps_si->nl ();
01043 ps_si->decr_indent (0);
01044 *ps_si << "}";
01045
01046 ps_si->nl ();
01047 ps_si->nl ();
01048
01049 *ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
01050 *ps_si << this->interface_name_ << "_var::_retn (void)"; ps_si->nl ();
01051
01052 *ps_si << "{";
01053 ps_si->incr_indent (0);
01054 ps_si->nl ();
01055
01056 *ps_si << "// yield ownership of managed obj reference"; ps_si->nl ();
01057 *ps_si << "::" << this->interface_name_ << "_ptr val = this->ptr_;";
01058 ps_si->nl ();
01059 *ps_si << "this->ptr_ = ::" << this->interface_name_ << "::_nil ();";
01060 ps_si->nl ();
01061 *ps_si << "return val;";
01062
01063 ps_si->decr_indent (0);
01064 ps_si->nl ();
01065 *ps_si << "}";
01066
01067 ps_si->nl ();
01068 ps_si->nl ();
01069
01070 *ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
01071 *ps_si << this->interface_name_ << "_var::tao_duplicate ("
01072 << this->interface_name_ << "_ptr p)";
01073 ps_si->nl ();
01074
01075 *ps_si << "{";
01076 ps_si->incr_indent (0);
01077 ps_si->nl ();
01078
01079 *ps_si << "return ::" << this->interface_name_ << "::_duplicate (p);";
01080
01081 ps_si->decr_indent (0);
01082 ps_si->nl ();
01083 *ps_si << "}";
01084
01085 ps_si->nl ();
01086 ps_si->nl ();
01087
01088 *ps_si << "void"; ps_si->nl ();
01089 *ps_si << this->interface_name_ << "_var::tao_release ("
01090 << this->interface_name_ << "_ptr p)";
01091 ps_si->nl ();
01092
01093 *ps_si << "{";
01094 ps_si->incr_indent (0);
01095 ps_si->nl ();
01096
01097 *ps_si << "CORBA::release (p);";
01098
01099 ps_si->nl ();
01100 ps_si->decr_indent (0);
01101 *ps_si << "}";
01102
01103 ps_si->nl ();
01104 ps_si->nl ();
01105
01106 *ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
01107 *ps_si << this->interface_name_ << "_var::tao_nil (void)"; ps_si->nl ();
01108
01109 *ps_si << "{";
01110 ps_si->incr_indent (0);
01111 ps_si->nl ();
01112
01113 *ps_si << "return ::" << this->interface_name_ << "::_nil ();";
01114
01115 ps_si->decr_indent (0);
01116 ps_si->nl ();
01117 *ps_si << "}";
01118
01119 ps_si->nl ();
01120 ps_si->nl ();
01121
01122 *ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
01123 *ps_si << this->interface_name_ << "_var::tao_narrow (";
01124
01125 ps_si->incr_indent (0);
01126 ps_si->nl ();
01127
01128 *ps_si << "CORBA::Object *p"; ps_si->nl ();
01129 *ps_si << ""; ps_si->nl ();
01130 *ps_si << ")";
01131
01132 ps_si->decr_indent (0);
01133 ps_si->nl ();
01134
01135 *ps_si << "{";
01136 ps_si->incr_indent (0);
01137 ps_si->nl ();
01138
01139 *ps_si << "return ::" << this->interface_name_
01140 << "::_narrow (p);";
01141
01142 ps_si->decr_indent (0);
01143 ps_si->nl ();
01144 *ps_si << "}";
01145
01146 ps_si->nl ();
01147 ps_si->nl ();
01148
01149 *ps_si << "CORBA::Object *"; ps_si->nl ();
01150 *ps_si << this->interface_name_ << "_var::tao_upcast (void *src)";
01151 ps_si->nl ();
01152
01153 *ps_si << "{";
01154 ps_si->incr_indent (0);
01155 ps_si->nl ();
01156
01157 *ps_si << this->interface_name_ << " **tmp ="; ps_si->nl ();
01158 *ps_si << "ACE_static_cast (" << this->interface_name_ << " **, src);";
01159 ps_si->nl ();
01160 *ps_si << "return *tmp;";
01161
01162 ps_si->decr_indent (0);
01163 ps_si->nl ();
01164 *ps_si << "}";
01165
01166 ps_si->nl ();
01167 ps_si->nl ();
01168
01169 *ps_si << "// **********************************************************";
01170 ps_si->nl ();
01171 *ps_si << "// " << this->interface_name_ << "_out"; ps_si->nl ();
01172 *ps_si << "// **********************************************************";
01173
01174 ps_si->nl ();
01175 ps_si->nl ();
01176
01177 *ps_si << this->interface_name_ << "_out::"
01178 << this->interface_name_ << "_out ("
01179 << this->interface_name_ << "_ptr &p)";
01180
01181 ps_si->incr_indent (0);
01182 ps_si->nl ();
01183 *ps_si << ": ptr_ (p)";
01184 ps_si->decr_indent (0);
01185 ps_si->nl ();
01186
01187 *ps_si << "{";
01188 ps_si->incr_indent (0);
01189 ps_si->nl ();
01190
01191 *ps_si << "this->ptr_ = ::" << this->interface_name_ << "::_nil ();";
01192
01193 ps_si->decr_indent (0);
01194 ps_si->nl ();
01195 *ps_si << "}";
01196
01197 ps_si->nl ();
01198 ps_si->nl ();
01199
01200 *ps_si << this->interface_name_ << "_out::"
01201 << this->interface_name_ << "_out ("
01202 << this->interface_name_
01203 << "_var &p) // constructor from _var";
01204
01205 ps_si->decr_indent (0);
01206 ps_si->nl ();
01207 *ps_si << ": ptr_ (p.out ())";
01208 ps_si->decr_indent (0);
01209 ps_si->nl ();
01210
01211 *ps_si << "{";
01212 ps_si->incr_indent (0);
01213 ps_si->nl ();
01214
01215 *ps_si << "CORBA::release (this->ptr_);"; ps_si->nl ();
01216 *ps_si << "this->ptr_ = ::" << this->interface_name_ << "::_nil ();";
01217
01218 ps_si->decr_indent (0);
01219 ps_si->nl ();
01220 *ps_si << "}";
01221
01222 ps_si->nl ();
01223 ps_si->nl ();
01224
01225 *ps_si << this->interface_name_ << "_out::"
01226 << this->interface_name_ << "_out (const ::"
01227 << this->interface_name_ << "_out &p) // copy constructor";
01228
01229 ps_si->decr_indent (0);
01230 ps_si->nl ();
01231 *ps_si << ": ptr_ (ACE_const_cast ("
01232 << this->interface_name_
01233 << "_out &, p).ptr_)";
01234 ps_si->decr_indent (0);
01235 ps_si->nl ();
01236
01237 *ps_si << "{}";
01238
01239 ps_si->nl ();
01240 ps_si->nl ();
01241
01242 *ps_si << "::" << this->interface_name_ << "_out &"; ps_si->nl ();
01243 *ps_si << this->interface_name_ << "_out::operator= (const ::"
01244 << this->interface_name_ << "_out &p)"; ps_si->nl ();
01245
01246 *ps_si << "{";
01247 ps_si->incr_indent (0);
01248 ps_si->nl ();
01249
01250 *ps_si << "this->ptr_ = ACE_const_cast ("
01251 << this->interface_name_ << "_out&, p).ptr_;"; ps_si->nl ();
01252 *ps_si << "return *this;";
01253
01254 ps_si->decr_indent (0);
01255 ps_si->nl ();
01256 *ps_si << "}";
01257
01258 ps_si->nl ();
01259 ps_si->nl ();
01260
01261 *ps_si << this->interface_name_ << "_out &"; ps_si->nl ();
01262 *ps_si << this->interface_name_ << "_out::operator= (const ::"
01263 << this->interface_name_ << "_var &p)"; ps_si->nl ();
01264
01265 *ps_si << "{";
01266 ps_si->incr_indent (0);
01267 ps_si->nl ();
01268
01269 *ps_si << "this->ptr_ = ::" << this->interface_name_
01270 << "::_duplicate (p.ptr ());"; ps_si->nl ();
01271 *ps_si << "return *this;";
01272
01273 ps_si->decr_indent (0);
01274 ps_si->nl ();
01275 *ps_si << "}";
01276
01277 ps_si->nl ();
01278 ps_si->nl ();
01279
01280 *ps_si << this->interface_name_ << "_out &"; ps_si->nl ();
01281 *ps_si << this->interface_name_ << "_out::operator= ("
01282 << this->interface_name_ << "_ptr p)"; ps_si->nl ();
01283
01284 *ps_si << "{";
01285 ps_si->incr_indent (0);
01286 ps_si->nl ();
01287
01288 *ps_si << "this->ptr_ = p;"; ps_si->nl ();
01289 *ps_si << "return *this;";
01290
01291 ps_si->decr_indent (0);
01292 ps_si->nl ();
01293 *ps_si << "}";
01294
01295 ps_si->nl ();
01296 ps_si->nl ();
01297
01298 *ps_si << this->interface_name_ << "_out::operator ::"
01299 << this->interface_name_ << "_ptr &() // cast"; ps_si->nl ();
01300
01301 *ps_si << "{";
01302 ps_si->incr_indent (0);
01303 ps_si->nl ();
01304
01305 *ps_si << "return this->ptr_;";
01306
01307 ps_si->decr_indent (0);
01308 ps_si->nl ();
01309 *ps_si << "}";
01310
01311 ps_si->nl ();
01312 ps_si->nl ();
01313
01314 *ps_si << "::" << this->interface_name_ << "_ptr &"; ps_si->nl ();
01315 *ps_si << this->interface_name_ << "_out::ptr (void) // ptr"; ps_si->nl ();
01316
01317 *ps_si << "{";
01318 ps_si->incr_indent (0);
01319 ps_si->nl ();
01320
01321 *ps_si << "return this->ptr_;";
01322
01323 ps_si->decr_indent (0);
01324 ps_si->nl ();
01325 *ps_si << "}";
01326
01327 ps_si->nl ();
01328 ps_si->nl ();
01329
01330 *ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
01331 *ps_si << this->interface_name_ << "_out::operator-> (void)"; ps_si->nl ();
01332
01333 *ps_si << "{";
01334 ps_si->incr_indent (0);
01335 ps_si->nl ();
01336
01337 *ps_si << "return this->ptr_;";
01338
01339 ps_si->decr_indent (0);
01340 ps_si->nl ();
01341 *ps_si << "}";
01342
01343 ps_si->nl ();
01344 ps_si->nl ();
01345 ps_si->nl ();
01346
01347 *ps_si << "#if (TAO_HAS_INTERCEPTORS == 1)"; ps_si->nl ();
01348 *ps_si << "#endif /* TAO_HAS_INTERCEPTORS */";
01349
01350 ps_si->nl ();
01351 ps_si->nl ();
01352
01353 *ps_si << "///////////////////////////////////////////////////////////////"; ps_si->nl ();
01354 *ps_si << "// Base & Remote Proxy Implementation. ";
01355 ps_si->nl ();
01356 *ps_si << "//";
01357
01358 ps_si->nl ();
01359 ps_si->nl ();
01360
01361 *ps_si << "_TAO_" << this->interface_name_ << "_Proxy_Impl::_TAO_"
01362 << this->interface_name_ << "_Proxy_Impl (void)"; ps_si->nl ();
01363 *ps_si << "{}";
01364
01365 ps_si->nl ();
01366 ps_si->nl ();
01367
01368 *ps_si << "_TAO_" << this->interface_name_
01369 << "_Remote_Proxy_Impl::_TAO_" << this->interface_name_
01370 << "_Remote_Proxy_Impl (void)"; ps_si->nl ();
01371 *ps_si << "{}";
01372
01373 ps_si->nl ();
01374 ps_si->nl ();
01375
01376 *ps_si << "// Remote Implementation of the IDL interface methods";
01377 ps_si->nl ();
01378 ps_si->nl ();
01379
01380 *ps_si << "//"; ps_si->nl ();
01381 *ps_si << "// End Base & Remote Proxy Implemeentation. ";
01382 ps_si->nl ();
01383
01384 *ps_si << "///////////////////////////////////////////////////////////////";
01385 ps_si->nl ();
01386 ps_si->nl ();
01387
01388 *ps_si << "///////////////////////////////////////////////////////////////"; ps_si->nl ();
01389 *ps_si << "// Remote & Base Proxy Broker Implementation";
01390 ps_si->nl ();
01391 *ps_si << "//";
01392
01393 ps_si->nl ();
01394 ps_si->nl ();
01395
01396 *ps_si << "_TAO_" << this->interface_name_ << "_Proxy_Broker::_TAO_"
01397 << this->interface_name_ << "_Proxy_Broker (void)"; ps_si->nl ();
01398 *ps_si << "{"; ps_si->nl ();
01399 *ps_si << "}";
01400
01401 ps_si->nl ();
01402 ps_si->nl ();
01403
01404 *ps_si << "_TAO_" << this->interface_name_ << "_Proxy_Broker::~_TAO_"
01405 << this->interface_name_ << "_Proxy_Broker (void)"; ps_si->nl ();
01406 *ps_si << "{"; ps_si->nl ();
01407 *ps_si << "}";
01408
01409 ps_si->nl ();
01410 ps_si->nl ();
01411
01412 *ps_si << "_TAO_" << this->interface_name_
01413 << "_Proxy_Broker * (*_TAO_"
01414 << this->interface_name_
01415 << "_Proxy_Broker_Factory_function_pointer) (";
01416
01417 ps_si->incr_indent (0);
01418 ps_si->nl ();
01419 *ps_si << "CORBA::Object_ptr obj";
01420
01421 ps_si->nl ();
01422 *ps_si << ") = 0;";
01423
01424 ps_si->decr_indent (0);
01425
01426 ps_si->nl ();
01427 ps_si->nl ();
01428
01429 *ps_si << "// Factory Member function Implementation."; ps_si->nl ();
01430 *ps_si << "_TAO_" << this->interface_name_ << "_Remote_Proxy_Broker *";
01431 ps_si->nl ();
01432 *ps_si << "_TAO_" << this->interface_name_
01433 << "_Remote_Proxy_Broker::the_TAO_"
01434 << this->interface_name_
01435 << "_Remote_Proxy_Broker (void)"; ps_si->nl ();
01436
01437 *ps_si << "{";
01438 ps_si->incr_indent (0);
01439 ps_si->nl ();
01440
01441 *ps_si << "static ::_TAO_" << this->interface_name_
01442 << "_Remote_Proxy_Broker remote_proxy_broker;"; ps_si->nl ();
01443 *ps_si << "return &remote_proxy_broker;";
01444
01445 ps_si->decr_indent (0);
01446 ps_si->nl ();
01447 *ps_si << "}";
01448
01449 ps_si->nl ();
01450 ps_si->nl ();
01451
01452 *ps_si << "_TAO_" << this->interface_name_
01453 << "_Remote_Proxy_Broker::_TAO_"
01454 << this->interface_name_ << "_Remote_Proxy_Broker (void)"; ps_si->nl ();
01455 *ps_si << "{"; ps_si->nl ();
01456 *ps_si << "}";
01457
01458 ps_si->nl ();
01459 ps_si->nl ();
01460
01461 *ps_si << "_TAO_" << this->interface_name_
01462 << "_Remote_Proxy_Broker::~_TAO_"
01463 << this->interface_name_ << "_Remote_Proxy_Broker (void)"; ps_si->nl ();
01464 *ps_si << "{"; ps_si->nl ();
01465 *ps_si << "}";
01466
01467 ps_si->nl ();
01468 ps_si->nl ();
01469
01470 *ps_si << "_TAO_" << this->interface_name_ << "_Proxy_Impl&"; ps_si->nl ();
01471 *ps_si << "_TAO_" << this->interface_name_
01472 << "_Remote_Proxy_Broker::select_proxy (";
01473
01474 ps_si->incr_indent (0);
01475 ps_si->nl ();
01476 *ps_si << "::" << this->interface_name_ << " *"; ps_si->nl ();
01477 *ps_si << ""; ps_si->nl ();
01478 *ps_si << ")";
01479 ps_si->decr_indent (0);
01480 ps_si->nl ();
01481
01482 *ps_si << "{";
01483 ps_si->incr_indent (0);
01484 ps_si->nl ();
01485
01486 *ps_si << "return this->remote_proxy_impl_;";
01487
01488 ps_si->decr_indent (0);
01489 ps_si->nl ();
01490 *ps_si << "}";
01491
01492 ps_si->nl ();
01493 ps_si->nl ();
01494 ps_si->nl ();
01495
01496 *ps_si << "//"; ps_si->nl ();
01497 *ps_si << "// End Remote & Base Proxy Broker Implementation"; ps_si->nl ();
01498 *ps_si << "///////////////////////////////////////////////////////////////"; ps_si->nl ();
01499 ps_si->nl ();
01500 ps_si->nl ();
01501
01502 *ps_si << this->interface_name_ << "::"
01503 << this->interface_name_ << " (int collocated)"; ps_si->nl ();
01504
01505 *ps_si << "{";
01506 ps_si->incr_indent (0);
01507 ps_si->nl ();
01508
01509 *ps_si << "this->" << this->interface_name_
01510 << "_setup_collocation (collocated);";
01511
01512 ps_si->decr_indent (0);
01513 ps_si->nl ();
01514 *ps_si << "}";
01515
01516 ps_si->nl ();
01517 ps_si->nl ();
01518
01519 *ps_si << this->interface_name_ << "::~"
01520 << this->interface_name_ << " (void)"; ps_si->nl ();
01521 *ps_si << "{}";
01522
01523 ps_si->nl ();
01524 ps_si->nl ();
01525
01526 *ps_si << "void"; ps_si->nl ();
01527 *ps_si << this->interface_name_ << "::"
01528 << this->interface_name_
01529 << "_setup_collocation (int collocated)"; ps_si->nl ();
01530
01531 *ps_si << "{";
01532 ps_si->incr_indent (0);
01533 ps_si->nl ();
01534
01535 *ps_si << "if (collocated)";
01536 ps_si->incr_indent (0);
01537 ps_si->nl ();
01538
01539 *ps_si << "this->the_TAO_"
01540 << this->interface_name_ << "_Proxy_Broker_ =";
01541
01542 ps_si->incr_indent (0);
01543 ps_si->nl ();
01544
01545 *ps_si << "::_TAO_" << this->interface_name_
01546 << "_Proxy_Broker_Factory_function_pointer (this);";
01547
01548 ps_si->decr_indent (0);
01549 ps_si->decr_indent (0);
01550 ps_si->nl ();
01551
01552 *ps_si << "else";
01553 ps_si->incr_indent (0);
01554 ps_si->nl ();
01555 *ps_si << "this->the_TAO_"
01556 << this->interface_name_
01557 << "_Proxy_Broker_ =";
01558
01559 ps_si->incr_indent (0);
01560 ps_si->nl ();
01561
01562 *ps_si << "::_TAO_" << this->interface_name_
01563 << "_Remote_Proxy_Broker::the_TAO_"
01564 << this->interface_name_
01565 << "_Remote_Proxy_Broker ();";
01566
01567 ps_si->decr_indent (0);
01568 ps_si->decr_indent (0);
01569 ps_si->decr_indent (0);
01570 ps_si->decr_indent (0);
01571
01572 ps_si->nl ();
01573 *ps_si << "}";
01574
01575 ps_si->nl ();
01576 ps_si->nl ();
01577
01578 *ps_si << "void " << this->interface_name_
01579 << "::_tao_any_destructor (void *_tao_void_pointer)"; ps_si->nl ();
01580
01581 *ps_si << "{";
01582 ps_si->incr_indent (0);
01583 ps_si->nl ();
01584
01585 *ps_si << this->interface_name_
01586 << " *tmp = ACE_static_cast ("
01587 << this->interface_name_ << "*, _tao_void_pointer);"; ps_si->nl ();
01588 *ps_si << "CORBA::release (tmp);";
01589
01590 ps_si->decr_indent (0);
01591 ps_si->nl ();
01592 *ps_si << "}";
01593
01594 ps_si->nl ();
01595 ps_si->nl ();
01596
01597 *ps_si << this->interface_name_ << "_ptr "
01598 << this->interface_name_ << "::_narrow (";
01599
01600 ps_si->incr_indent (0);
01601 ps_si->nl ();
01602 *ps_si << "CORBA::Object_ptr obj"; ps_si->nl ();
01603 *ps_si << "";
01604
01605 ps_si->decr_indent (0);
01606 ps_si->nl ();
01607 *ps_si << ")";
01608 ps_si->nl ();
01609
01610 *ps_si << "{";
01611 ps_si->incr_indent (0);
01612 ps_si->nl ();
01613
01614 *ps_si << "if (CORBA::is_nil (obj))";
01615 ps_si->incr_indent (0);
01616 ps_si->nl ();
01617
01618 *ps_si << "return " << this->interface_name_ << "::_nil ();";
01619
01620 ps_si->decr_indent (0);
01621 ps_si->nl ();
01622 ps_si->nl ();
01623
01624 *ps_si << "if (! obj->_is_local ())";
01625 ps_si->incr_indent (0);
01626 ps_si->nl ();
01627 *ps_si << "{";
01628 ps_si->incr_indent (0);
01629 ps_si->nl ();
01630
01631 *ps_si << "CORBA::Boolean is_a = obj->_is_a (\"IDL:"
01632 << this->interface_name_ << ":1.0\");";
01633 ps_si->nl ();
01634
01635 *ps_si << "if (is_a == 0)";
01636 ps_si->incr_indent (0);
01637 ps_si->nl ();
01638 *ps_si << "return " << this->interface_name_ << "::_nil ();";
01639
01640 ps_si->decr_indent (0);
01641 ps_si->decr_indent (0);
01642 ps_si->nl ();
01643 *ps_si << "}";
01644 ps_si->decr_indent (0);
01645 ps_si->nl ();
01646
01647 *ps_si << "return " << this->interface_name_
01648 << "::_unchecked_narrow (obj);";
01649
01650 ps_si->decr_indent (0);
01651 ps_si->nl ();
01652 *ps_si << "}";
01653
01654 ps_si->nl ();
01655 ps_si->nl ();
01656
01657 *ps_si << this->interface_name_ << "_ptr "; ps_si->nl ();
01658 *ps_si << this->interface_name_ << "::_unchecked_narrow (";
01659
01660 ps_si->incr_indent (0);
01661 ps_si->nl ();
01662 *ps_si << "CORBA::Object_ptr obj"; ps_si->nl ();
01663 *ps_si << ""; ps_si->nl ();
01664 *ps_si << ")";
01665
01666 ps_si->decr_indent (0);
01667 ps_si->nl ();
01668
01669 *ps_si << "{";
01670
01671 ps_si->incr_indent (0);
01672 ps_si->nl ();
01673 *ps_si << "if (CORBA::is_nil (obj))";
01674 ps_si->incr_indent (0);
01675 ps_si->nl ();
01676
01677 *ps_si << "return " << this->interface_name_ << "::_nil ();";
01678
01679 ps_si->decr_indent (0);
01680 ps_si->nl ();
01681
01682 *ps_si << "if (! obj->_is_local ())"; ps_si->nl ();
01683 *ps_si << "{";
01684 ps_si->incr_indent (0);
01685 ps_si->nl ();
01686 *ps_si << "TAO_Stub* stub = obj->_stubobj ();"; ps_si->nl ();
01687
01688 *ps_si << "if (stub)";
01689 ps_si->incr_indent (0);
01690 ps_si->nl ();
01691
01692 *ps_si << " stub->_incr_refcnt ();";
01693
01694 ps_si->decr_indent (0);
01695 ps_si->nl ();
01696
01697 *ps_si << this->interface_name_ << "_ptr default_proxy = "
01698 << this->interface_name_ << "::_nil ();"; ps_si->nl ();
01699 ps_si->nl ();
01700 *ps_si << "if (";
01701 ps_si->incr_indent (0);
01702 ps_si->nl ();
01703 *ps_si << "!CORBA::is_nil (stub->servant_orb_var ().ptr ()) &&"; ps_si->nl ();
01704 *ps_si << "stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects () &&"; ps_si->nl ();
01705 *ps_si << "obj->_is_collocated () &&"; ps_si->nl ();
01706 *ps_si << "_TAO_" << this->interface_name_
01707 << "_Proxy_Broker_Factory_function_pointer != 0"; ps_si->nl ();
01708 *ps_si << ")";
01709 ps_si->decr_indent (0);
01710 ps_si->nl ();
01711
01712 *ps_si << " {";
01713 ps_si->incr_indent (0);
01714 ps_si->nl ();
01715
01716 *ps_si << " ACE_NEW_RETURN (";
01717 ps_si->incr_indent (0);
01718 ps_si->nl ();
01719
01720 *ps_si << "default_proxy,"; ps_si->nl ();
01721 *ps_si << "::" << this->interface_name_ << " (";
01722 ps_si->incr_indent (0);
01723 ps_si->incr_indent (0);
01724 ps_si->nl ();
01725
01726 *ps_si << "stub,"; ps_si->nl ();
01727 *ps_si << "1,"; ps_si->nl ();
01728 *ps_si << "obj->_servant ()"; ps_si->nl ();
01729 *ps_si << "),";
01730 ps_si->decr_indent (0);
01731 ps_si->decr_indent (0);
01732 ps_si->nl ();
01733 *ps_si << this->interface_name_ << "::_nil ()"; ps_si->nl ();
01734
01735 *ps_si << ");";
01736 ps_si->decr_indent (0);
01737 ps_si->decr_indent (0);
01738 ps_si->nl ();
01739 *ps_si << " }";
01740
01741 ps_si->nl ();
01742 ps_si->nl ();
01743
01744 *ps_si << "if (CORBA::is_nil (default_proxy))";
01745 ps_si->incr_indent (0);
01746 ps_si->nl ();
01747 *ps_si << "{";
01748
01749 ps_si->incr_indent (0);
01750 ps_si->nl ();
01751
01752 *ps_si << "ACE_NEW_RETURN (";
01753 ps_si->incr_indent (0);
01754 ps_si->nl ();
01755
01756 *ps_si << "default_proxy,"; ps_si->nl ();
01757
01758 *ps_si << "::" << this->interface_name_ << " (";
01759 ps_si->incr_indent (0);
01760 ps_si->incr_indent (0);
01761 ps_si->nl ();
01762
01763 *ps_si << "stub,"; ps_si->nl ();
01764 *ps_si << "0,"; ps_si->nl ();
01765 *ps_si << "obj->_servant ()"; ps_si->nl ();
01766 *ps_si << "),";
01767
01768 ps_si->decr_indent (0);
01769 ps_si->decr_indent (0);
01770 ps_si->nl ();
01771
01772 *ps_si << this->interface_name_ << "::_nil ()"; ps_si->nl ();
01773 *ps_si << ");";
01774 ps_si->decr_indent (0);
01775 ps_si->nl ();
01776
01777 *ps_si << " }";
01778 ps_si->decr_indent (0);
01779 ps_si->nl ();
01780
01781 *ps_si << "return default_proxy;";
01782 ps_si->decr_indent (0);
01783 ps_si->nl ();
01784
01785 *ps_si << "}"; ps_si->nl ();
01786 *ps_si << "else";
01787 ps_si->incr_indent (0);
01788 ps_si->nl ();
01789 *ps_si << "return";
01790
01791 ps_si->incr_indent (0);
01792 ps_si->nl ();
01793
01794 *ps_si << "ACE_reinterpret_cast"; ps_si->nl ();
01795 *ps_si << "(";
01796 ps_si->incr_indent (0);
01797 ps_si->nl ();
01798 *ps_si << this->interface_name_ << "_ptr,"; ps_si->nl ();
01799 *ps_si << "obj->_tao_QueryInterface"; ps_si->nl ();
01800 *ps_si << "(";
01801 ps_si->incr_indent (0);
01802 ps_si->nl ();
01803
01804 *ps_si << "ACE_reinterpret_cast"; ps_si->nl ();
01805 *ps_si << "(";
01806 ps_si->incr_indent (0);
01807 ps_si->nl ();
01808 *ps_si << "ptrdiff_t,"; ps_si->nl ();
01809 *ps_si << "&" << this->interface_name_ << "::_tao_class_id";
01810 ps_si->nl ();
01811
01812 *ps_si << ")";
01813 ps_si->decr_indent (0);
01814 ps_si->nl ();
01815
01816 *ps_si << ")";
01817 ps_si->decr_indent (0);
01818 ps_si->decr_indent (0);
01819 ps_si->nl ();
01820
01821 *ps_si << " );";
01822 ps_si->decr_indent (0);
01823 ps_si->decr_indent (0);
01824 ps_si->decr_indent (0);
01825 ps_si->decr_indent (0);
01826 ps_si->decr_indent (0);
01827 ps_si->decr_indent (0);
01828 ps_si->nl ();
01829
01830 *ps_si << "}";
01831
01832 ps_si->nl ();
01833 ps_si->nl ();
01834
01835 *ps_si << this->interface_name_ << "_ptr"; ps_si->nl ();
01836 *ps_si << this->interface_name_ << "::_duplicate ("
01837 << this->interface_name_ << "_ptr obj)"; ps_si->nl ();
01838 *ps_si << "{";
01839 ps_si->incr_indent (0);
01840 ps_si->nl ();
01841 *ps_si << "if (!CORBA::is_nil (obj))";
01842 ps_si->incr_indent (0);
01843 ps_si->nl ();
01844 *ps_si << "obj->_add_ref ();";
01845
01846 ps_si->decr_indent (0);
01847 ps_si->nl ();
01848
01849 *ps_si << "return obj;";
01850
01851 ps_si->decr_indent (0);
01852 ps_si->nl ();
01853 *ps_si << "}";
01854
01855 ps_si->nl ();
01856 ps_si->nl ();
01857
01858 *ps_si << "CORBA::Boolean " << this->interface_name_
01859 << "::_is_a (const CORBA::Char *value)"; ps_si->nl ();
01860
01861 *ps_si << "{";
01862 ps_si->incr_indent (0);
01863 ps_si->nl ();
01864
01865 *ps_si << "if (";
01866 ps_si->incr_indent (0);
01867 ps_si->nl ();
01868
01869 *ps_si << "(!ACE_OS::strcmp ((char *)value, \"IDL:"
01870 << this->interface_name_ << ":1.0\")) ||"; ps_si->nl ();
01871 *ps_si << "(!ACE_OS::strcmp ((char *)value,"
01872 << "\"IDL:omg.org/CORBA/Object:1.0\")))"; ps_si->nl ();
01873
01874 *ps_si << "return 1; // success using local knowledge";
01875
01876 ps_si->decr_indent (0);
01877 ps_si->nl ();
01878 *ps_si << "else";
01879
01880 ps_si->incr_indent (0);
01881 ps_si->nl ();
01882 *ps_si << "return this->Object::_is_a (value);";
01883 ps_si->decr_indent (0);
01884 ps_si->decr_indent (0);
01885 ps_si->nl ();
01886 *ps_si << "}";
01887
01888 ps_si->nl ();
01889 ps_si->nl ();
01890
01891 *ps_si << "void *" << this->interface_name_
01892 << "::_tao_QueryInterface (ptrdiff_t type)"; ps_si->nl ();
01893 *ps_si << "{";
01894 ps_si->incr_indent (0);
01895 ps_si->nl ();
01896 *ps_si << "void *retv = 0;"; ps_si->nl ();
01897 *ps_si << "if (type == ACE_reinterpret_cast";
01898 ps_si->incr_indent (0);
01899 ps_si->nl ();
01900 *ps_si << "(ptrdiff_t,"; ps_si->nl ();
01901 *ps_si << "&" << this->interface_name_ << "::_tao_class_id))"; ps_si->nl ();
01902 *ps_si << "retv = reinterpret_cast<void*> (this);";
01903 ps_si->decr_indent (0);
01904 ps_si->nl ();
01905
01906 *ps_si << "else if (type == ACE_reinterpret_cast "
01907 << "(ptrdiff_t, &CORBA::Object::_tao_class_id))";
01908
01909 ps_si->incr_indent (0);
01910 ps_si->nl ();
01911
01912 *ps_si << "retv = ACE_reinterpret_cast (void *,";
01913 ps_si->incr_indent (0);
01914 ps_si->nl ();
01915 *ps_si << "static_cast<CORBA::Object_ptr> (this));";
01916
01917 ps_si->decr_indent (0);
01918 ps_si->decr_indent (0);
01919
01920 ps_si->nl ();
01921 ps_si->nl ();
01922 *ps_si << "if (retv)";
01923 ps_si->incr_indent (0);
01924 ps_si->nl ();
01925 *ps_si << "this->_add_ref ();";
01926
01927 ps_si->decr_indent (0);
01928 ps_si->nl ();
01929
01930 *ps_si << "return retv;";
01931
01932 ps_si->decr_indent (0);
01933 ps_si->nl ();
01934 *ps_si << "}";
01935
01936 ps_si->nl ();
01937 ps_si->nl ();
01938
01939 *ps_si << "const char* " << this->interface_name_
01940 << "::_interface_repository_id (void) const"; ps_si->nl ();
01941
01942 *ps_si << "{";
01943 ps_si->incr_indent (0);
01944 ps_si->nl ();
01945 *ps_si << "return \"IDL:" << this->interface_name_ << ":1.0\";";
01946 ps_si->decr_indent (0);
01947 ps_si->nl ();
01948
01949 *ps_si << "}";
01950
01951 ps_si->nl ();
01952 ps_si->nl ();
01953
01954 *ps_si << "static const CORBA::Long _oc_"
01955 << this->interface_name_ << "[] ="; ps_si->nl ();
01956 *ps_si << "{"; ps_si->nl ();
01957 *ps_si << "// typecode related information goes here";
01958
01959 ps_si->nl ();
01960 *ps_si << "};";
01961
01962 ps_si->nl ();
01963 ps_si->nl ();
01964
01965
01966 *ps_si << "static CORBA::TypeCode _tc_TAO_tc_"
01967 << this->interface_name_ << " (";
01968
01969 ps_si->incr_indent (0);
01970 ps_si->incr_indent (0);
01971 ps_si->nl ();
01972
01973 *ps_si << "CORBA::tk_objref,"; ps_si->nl ();
01974 *ps_si << "sizeof (_oc_" << this->interface_name_ << "),"; ps_si->nl ();
01975 *ps_si << "(char *) &_oc_" << this->interface_name_ << ","; ps_si->nl ();
01976 *ps_si << "0,"; ps_si->nl ();
01977 *ps_si << "sizeof (" << this->interface_name_ << ")";
01978 ps_si->decr_indent (0);
01979 ps_si->nl ();
01980 *ps_si << ");";
01981
01982 ps_si->decr_indent (0);
01983 ps_si->nl ();
01984 ps_si->nl ();
01985
01986 *ps_si << "::CORBA::TypeCode_ptr _tc_" << this->interface_name_ << " =";
01987 ps_si->decr_indent (0);
01988 ps_si->nl ();
01989 *ps_si << "&_tc_TAO_tc_" << this->interface_name_ << ";";
01990 ps_si->decr_indent (0);
01991
01992 ps_si->nl ();
01993 ps_si->nl ();
01994
01995 *ps_si << "void operator<<= (";
01996 ps_si->incr_indent (0);
01997 ps_si->incr_indent (0);
01998 ps_si->nl ();
01999
02000 *ps_si << "CORBA::Any &_tao_any,"; ps_si->nl ();
02001 *ps_si << this->interface_name_ << "_ptr _tao_elem";
02002 ps_si->decr_indent (0);
02003 ps_si->nl ();
02004
02005 *ps_si << ")";
02006 ps_si->decr_indent (0);
02007 ps_si->nl ();
02008
02009 *ps_si << "{";
02010 ps_si->incr_indent (0);
02011 ps_si->nl ();
02012
02013 *ps_si << "TAO_OutputCDR stream;";
02014 ps_si->nl ();
02015 ps_si->nl ();
02016
02017 *ps_si << "if (stream << _tao_elem)";
02018 ps_si->incr_indent (0);
02019 ps_si->nl ();
02020
02021 *ps_si << "{";
02022 ps_si->incr_indent (0);
02023 ps_si->nl ();
02024
02025 *ps_si << "_tao_any._tao_replace (";
02026 ps_si->incr_indent (0);
02027 ps_si->incr_indent (0);
02028 ps_si->nl ();
02029
02030 *ps_si << "_tc_" << this->interface_name_ << ", "; ps_si->nl ();
02031 *ps_si << "TAO_ENCAP_BYTE_ORDER,"; ps_si->nl ();
02032 *ps_si << "stream.begin (),"; ps_si->nl ();
02033 *ps_si << "1,"; ps_si->nl ();
02034 *ps_si << this->interface_name_ << "::_duplicate (_tao_elem),"; ps_si->nl ();
02035 *ps_si << this->interface_name_ << "::_tao_any_destructor";
02036 ps_si->decr_indent (0);
02037 ps_si->nl ();
02038 *ps_si << ");";
02039
02040 ps_si->decr_indent (0);
02041 ps_si->decr_indent (0);
02042 ps_si->nl ();
02043 *ps_si << "}";
02044
02045 ps_si->decr_indent (0);
02046 ps_si->decr_indent (0);
02047 ps_si->nl ();
02048 *ps_si << "}";
02049
02050 ps_si->nl ();
02051 ps_si->nl ();
02052
02053 *ps_si << "void operator<<= (";
02054 ps_si->incr_indent (0);
02055 ps_si->nl ();
02056 *ps_si << "CORBA::Any &_tao_any,"; ps_si->nl ();
02057 *ps_si << this->interface_name_ << "_ptr *_tao_elem";
02058 ps_si->nl ();
02059
02060 *ps_si << ")";
02061 ps_si->decr_indent (0);
02062 ps_si->nl ();
02063
02064 *ps_si << "{";
02065 ps_si->incr_indent (0);
02066 ps_si->nl ();
02067
02068 *ps_si << "TAO_OutputCDR stream;";
02069 ps_si->nl ();
02070 ps_si->nl ();
02071
02072 *ps_si << "if (stream << *_tao_elem)";
02073 ps_si->incr_indent (0);
02074 ps_si->nl ();
02075
02076 *ps_si << "{";
02077 ps_si->incr_indent (0);
02078 ps_si->nl ();
02079
02080 *ps_si << "_tao_any._tao_replace (";
02081 ps_si->incr_indent (0);
02082 ps_si->nl ();
02083 *ps_si << "_tc_" << this->interface_name_ << ", "; ps_si->nl ();
02084 *ps_si << "TAO_ENCAP_BYTE_ORDER,"; ps_si->nl ();
02085 *ps_si << "stream.begin (),"; ps_si->nl ();
02086 *ps_si << "1,"; ps_si->nl ();
02087 *ps_si << "*_tao_elem,"; ps_si->nl ();
02088 *ps_si << this->interface_name_ << "::_tao_any_destructor";
02089
02090 ps_si->decr_indent (0);
02091 ps_si->nl ();
02092 *ps_si << ");";
02093
02094 ps_si->decr_indent (0);
02095 ps_si->nl ();
02096 *ps_si << "}";
02097
02098 ps_si->decr_indent (0);
02099 ps_si->decr_indent (0);
02100 ps_si->nl ();
02101 *ps_si << "}";
02102
02103 ps_si->nl ();
02104 ps_si->nl ();
02105
02106 *ps_si << "CORBA::Boolean operator>>= (";
02107 ps_si->incr_indent (0);
02108 ps_si->incr_indent (0);
02109 ps_si->nl ();
02110 *ps_si << "const CORBA::Any &_tao_any,"; ps_si->nl ();
02111 *ps_si << this->interface_name_ << "_ptr &_tao_elem";
02112
02113 ps_si->decr_indent (0);
02114 ps_si->nl ();
02115 *ps_si << ")";
02116
02117 ps_si->decr_indent (0);
02118 ps_si->nl ();
02119
02120 *ps_si << "{";
02121 ps_si->incr_indent (0);
02122 ps_si->nl ();
02123
02124 *ps_si << "ACE_TRY_NEW_ENV"; ps_si->nl ();
02125 *ps_si << "{";
02126 ps_si->incr_indent (0);
02127 ps_si->nl ();
02128
02129 *ps_si << "_tao_elem = " << this->interface_name_ << "::_nil ();";
02130 ps_si->nl ();
02131 *ps_si << "CORBA::TypeCode_var type = _tao_any.type ();";
02132 ps_si->nl ();
02133 ps_si->nl ();
02134
02135 *ps_si << "CORBA::Boolean result =";
02136 ps_si->incr_indent (0);
02137 ps_si->nl ();
02138
02139 *ps_si << "type->equivalent (";
02140 ps_si->incr_indent (0);
02141 ps_si->incr_indent (0);
02142 ps_si->nl ();
02143 *ps_si << "_tc_" << this->interface_name_ << ""; ps_si->nl ();
02144 *ps_si << "";
02145
02146 ps_si->decr_indent (0);
02147 ps_si->nl ();
02148 *ps_si << ");";
02149
02150 ps_si->decr_indent (0);
02151 ps_si->decr_indent (0);
02152 ps_si->nl ();
02153 ;
02154
02155 ps_si->nl ();
02156 ps_si->nl ();
02157
02158 *ps_si << "if (!result)";
02159 ps_si->incr_indent (0);
02160 ps_si->nl ();
02161
02162 *ps_si << "{";
02163 ps_si->incr_indent (0);
02164 ps_si->nl ();
02165 *ps_si << "return 0; // not equivalent";
02166
02167 ps_si->decr_indent (0);
02168 ps_si->nl ();
02169 *ps_si << "}";
02170
02171 ps_si->decr_indent (0);
02172 ps_si->nl ();
02173 ps_si->nl ();
02174
02175 *ps_si << "TAO_InputCDR stream (";
02176 ps_si->incr_indent (0);
02177 ps_si->incr_indent (0);
02178 ps_si->nl ();
02179
02180 *ps_si << "_tao_any._tao_get_cdr (),";
02181 ps_si->nl ();
02182 *ps_si << "_tao_any._tao_byte_order ()";
02183 ps_si->decr_indent (0);
02184 ps_si->nl ();
02185 *ps_si << ");";
02186
02187 ps_si->decr_indent (0);
02188 ps_si->nl ();
02189 ps_si->nl ();
02190
02191 *ps_si << "if (stream >> _tao_elem)";
02192 ps_si->incr_indent (0);
02193 ps_si->nl ();
02194
02195 *ps_si << "{";
02196 ps_si->incr_indent (0);
02197 ps_si->nl ();
02198
02199 *ps_si << "((CORBA::Any *)&_tao_any)->_tao_replace (";
02200 ps_si->incr_indent (0);
02201 ps_si->incr_indent (0);
02202 ps_si->nl ();
02203
02204 *ps_si << "_tc_" << this->interface_name_ << ","; ps_si->nl ();
02205 *ps_si << "1,"; ps_si->nl ();
02206 *ps_si << "_tao_elem,"; ps_si->nl ();
02207 *ps_si << this->interface_name_ << "::_tao_any_destructor";
02208
02209 ps_si->decr_indent (0);
02210 ps_si->nl ();
02211 *ps_si << ");";
02212
02213 ps_si->decr_indent (0);
02214 ps_si->nl ();
02215 ps_si->nl ();
02216 *ps_si << "return 1;";
02217
02218 ps_si->decr_indent (0);
02219 ps_si->nl ();
02220 *ps_si << "}";
02221
02222 ps_si->decr_indent (0);
02223 ps_si->decr_indent (0);
02224 ps_si->nl ();
02225 *ps_si << "}";
02226 ps_si->nl ();
02227
02228 *ps_si << "ACE_CATCHANY";
02229 ps_si->incr_indent (0);
02230 ps_si->nl ();
02231 *ps_si << "{"; ps_si->nl ();
02232 *ps_si << "}";
02233 ps_si->decr_indent (0);
02234 ps_si->nl ();
02235 *ps_si << "ACE_ENDTRY;";
02236
02237 ps_si->nl ();
02238 ps_si->nl ();
02239
02240 *ps_si << "_tao_elem = " << this->interface_name_ << "::_nil ();";
02241 ps_si->nl ();
02242 *ps_si << "return 0;";
02243
02244 ps_si->decr_indent (0);
02245 ps_si->nl ();
02246 *ps_si << "}";
02247
02248 ps_si->nl ();
02249 ps_si->nl ();
02250
02251 *ps_si << "CORBA::Boolean operator<< (";
02252
02253 ps_si->incr_indent (0);
02254 ps_si->incr_indent (0);
02255 ps_si->nl ();
02256
02257 *ps_si << "TAO_OutputCDR &strm,"; ps_si->nl ();
02258 *ps_si << "const " << this->interface_name_ << "_ptr _tao_objref";
02259
02260 ps_si->decr_indent (0);
02261 ps_si->nl ();
02262 *ps_si << ")";
02263 ps_si->decr_indent (0);
02264 ps_si->nl ();
02265
02266 *ps_si << "{";
02267 ps_si->incr_indent (0);
02268 ps_si->nl ();
02269
02270 *ps_si << "CORBA::Object_ptr _tao_corba_obj = _tao_objref;"; ps_si->nl ();
02271 *ps_si << "return (strm << _tao_corba_obj);";
02272
02273 ps_si->decr_indent (0);
02274 ps_si->nl ();
02275 *ps_si << "}";
02276
02277 ps_si->nl ();
02278 ps_si->nl ();
02279
02280 *ps_si << "CORBA::Boolean operator>> (";
02281 ps_si->incr_indent (0);
02282 ps_si->incr_indent (0);
02283 ps_si->nl ();
02284
02285 *ps_si << "TAO_InputCDR &strm,"; ps_si->nl ();
02286 *ps_si << this->interface_name_ << "_ptr &_tao_objref";
02287
02288 ps_si->decr_indent (0);
02289 ps_si->nl ();
02290 *ps_si << ")";
02291
02292 ps_si->decr_indent (0);
02293 ps_si->nl ();
02294
02295 *ps_si << "{";
02296 ps_si->incr_indent (0);
02297 ps_si->nl ();
02298
02299 *ps_si << "ACE_TRY_NEW_ENV"; ps_si->nl ();
02300 *ps_si << "{";
02301 ps_si->incr_indent (0);
02302 ps_si->nl ();
02303
02304 *ps_si << "CORBA::Object_var obj;"; ps_si->nl ();
02305 *ps_si << "if ((strm >> obj.inout ()) == 0)";
02306
02307 ps_si->incr_indent (0);
02308 ps_si->nl ();
02309 *ps_si << "return 0;";
02310 ps_si->decr_indent (0);
02311 ps_si->nl ();
02312
02313 *ps_si << "// narrow to the right type"; ps_si->nl ();
02314 *ps_si << "_tao_objref =";
02315 ps_si->incr_indent (0);
02316 ps_si->nl ();
02317 *ps_si << this->interface_name_ << "::_unchecked_narrow (";
02318
02319 ps_si->incr_indent (0);
02320 ps_si->incr_indent (0);
02321 ps_si->nl ();
02322
02323 *ps_si << "obj.in ()"; ps_si->nl ();
02324 *ps_si << "";
02325
02326 ps_si->decr_indent (0);
02327 ps_si->nl ();
02328
02329 *ps_si << ");";
02330
02331 ps_si->decr_indent (0);
02332 ps_si->decr_indent (0);
02333 ps_si->nl ();
02334
02335 ; ps_si->nl ();
02336 *ps_si << "return 1;";
02337
02338 ps_si->decr_indent (0);
02339 ps_si->nl ();
02340 *ps_si << "}";
02341
02342 ps_si->nl ();
02343 *ps_si << "ACE_CATCHANY"; ps_si->nl ();
02344 *ps_si << "{";
02345
02346 ps_si->incr_indent (0);
02347 ps_si->nl ();
02348 *ps_si << "// do nothing";
02349
02350 ps_si->decr_indent (0);ps_si->nl ();
02351 *ps_si << "}";
02352
02353 ps_si->nl ();
02354 *ps_si << "ACE_ENDTRY;"; ps_si->nl ();
02355 *ps_si << "return 0;";
02356
02357 ps_si->decr_indent (0);
02358 ps_si->nl ();
02359
02360 *ps_si << "}";
02361
02362 ps_si->nl ();
02363 ps_si->nl ();
02364
02365 }