📄 psdl_interface_visitor.cpp
字号:
*ps_sh << "static " << this->interface_name_
<< "_ptr _unchecked_narrow ("; ps_sh->nl ();
*ps_sh << "CORBA::Object_ptr obj"; ps_sh->nl ();
*ps_sh << "ACE_ENV_ARG_DECL_WITH_DEFAULTS"; ps_sh->nl ();
*ps_sh << ");"; ps_sh->nl ();
*ps_sh << "static " << this->interface_name_ << "_ptr _nil (void)"; ps_sh->nl ();
*ps_sh << "{"; ps_sh->nl ();
*ps_sh << "return (" << this->interface_name_ << "_ptr)0;";
ps_sh->decr_indent (0);
ps_sh->nl ();
*ps_sh << "}"; ps_sh->nl ();
*ps_sh << "static void _tao_any_destructor (void*);"; ps_sh->nl ();
}
void
TAO_PSDL_Interface_Visitor::print_end_for_interface (void)
{
ACE_CString name_space = TAO_PSDL_Scope::instance ()->get_name_space ();
// Get a pointer to PSDL_Stream of the stub header.
TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
*ps_sh << "virtual CORBA::Boolean _is_a ("; ps_sh->nl ();
*ps_sh << "const CORBA::Char *type_id"; ps_sh->nl ();
*ps_sh << "ACE_ENV_ARG_DECL_WITH_DEFAULTS"; ps_sh->nl ();
*ps_sh << ");"; ps_sh->nl ();
*ps_sh << "virtual void *_tao_QueryInterface (ptrdiff_t type);"; ps_sh->nl ();
*ps_sh << "virtual const char* _interface_repository_id (void) const;"; ps_sh->nl ();
*ps_sh << "private:"; ps_sh->nl ();
*ps_sh << "_TAO_" << this->interface_name_ << "_Proxy_Broker *the_TAO_" << this->interface_name_ << "_Proxy_Broker_;"; ps_sh->nl ();
*ps_sh << "protected:"; ps_sh->nl ();
*ps_sh << this->interface_name_ << "(int collocated = 0);"; ps_sh->nl ();
*ps_sh << "// These methods travese the inheritance tree and set the"; ps_sh->nl ();
*ps_sh << "// parents piece of the given class in the right mode"; ps_sh->nl ();
*ps_sh << "virtual void " << name_space << "_" << this->interface_name_
<< "_setup_collocation (int collocated);"; ps_sh->nl ();
*ps_sh << this->interface_name_ << "("; ps_sh->nl ();
*ps_sh << "TAO_Stub *objref, "; ps_sh->nl ();
*ps_sh << "CORBA::Boolean _tao_collocated = 0,"; ps_sh->nl ();
*ps_sh << "TAO_Abstract_ServantBase *servant = 0"; ps_sh->nl ();
*ps_sh << ");"; ps_sh->nl ();
*ps_sh << "friend class _TAO_" << this->interface_name_ << "_Remote_Proxy_Impl;"; ps_sh->nl ();
*ps_sh << "friend class _TAO_" << this->interface_name_ << "_ThruPOA_Proxy_Impl;"; ps_sh->nl ();
*ps_sh << "friend class _TAO_" << this->interface_name_ << "_Direct_Proxy_Impl;"; ps_sh->nl ();
*ps_sh << "virtual ~" << this->interface_name_ << "(void);"; ps_sh->nl ();
*ps_sh << "private:"; ps_sh->nl ();
*ps_sh << this->interface_name_ << "(const " << this->interface_name_ << "&);"; ps_sh->nl ();
*ps_sh << "void operator= (const " << this->interface_name_ << "&);"; ps_sh->nl ();
*ps_sh << "};"; ps_sh->nl ();
*ps_sh << "// The Proxy Implementations are used by each interface to"; ps_sh->nl ();
*ps_sh << "// perform a call. Each different implementation encapsulate"; ps_sh->nl ();
*ps_sh << "// an invocation logics."; ps_sh->nl ();
*ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
*ps_sh << "// Base Proxy Impl. Declaration"; ps_sh->nl ();
*ps_sh << "//"; ps_sh->nl ();
*ps_sh << "class _TAO_" << this->interface_name_ << "_Proxy_Impl"; ps_sh->nl ();
*ps_sh << ": public virtual TAO_Object_Proxy_Impl"; ps_sh->nl ();
*ps_sh << "{";
ps_sh->nl ();
ps_sh->incr_indent (0);
*ps_sh << "public:"; ps_sh->nl ();
*ps_sh << "virtual ~_TAO_" << this->interface_name_ << "_Proxy_Impl (void) { }"; ps_sh->nl ();
*ps_sh << "protected:"; ps_sh->nl ();
*ps_sh << "_TAO_" << this->interface_name_ << "_Proxy_Impl (void);"; ps_sh->nl ();
*ps_sh << "};"; ps_sh->nl ();
*ps_sh << "//"; ps_sh->nl ();
*ps_sh << "// End Base Proxy Impl. Declaration"; ps_sh->nl ();
*ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
*ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
*ps_sh << "// Remote Proxy Impl. Declaration"; ps_sh->nl ();
*ps_sh << "//"; ps_sh->nl ();
*ps_sh << "class _TAO_" << this->interface_name_ << "_Remote_Proxy_Impl"; ps_sh->nl ();
*ps_sh << ": public virtual _TAO_" << this->interface_name_ << "_Proxy_Impl,"; ps_sh->nl ();
*ps_sh << "public virtual TAO_Remote_Object_Proxy_Impl"; ps_sh->nl ();
*ps_sh << "{";
ps_sh->nl ();
ps_sh->incr_indent (0);
*ps_sh << "public:";
ps_sh->nl ();
*ps_sh << "_TAO_" << this->interface_name_
<< "_Remote_Proxy_Impl (void);";
ps_sh->nl ();
*ps_sh << "virtual ~_TAO_" << this->interface_name_
<< "_Remote_Proxy_Impl (void) { }";
ps_sh->decr_indent (0);
ps_sh->nl ();
*ps_sh << "};"; ps_sh->nl ();
*ps_sh << "//"; ps_sh->nl ();
*ps_sh << "// End Remote Proxy Impl. Declaration"; ps_sh->nl ();
*ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
*ps_sh << "// The Proxy Brokers are used by each interface to get"; ps_sh->nl ();
*ps_sh << "// the right proxy for performing a call. In the new "; ps_sh->nl ();
*ps_sh << "// collocation scheme, the proxy to be used can vary on"; ps_sh->nl ();
*ps_sh << "// a call by call basis."; ps_sh->nl ();
*ps_sh << "///////////////////////////////////////////////////////////////////////"; ps_sh->nl ();
*ps_sh << "// Base Proxy Broker Declaration "; ps_sh->nl ();
*ps_sh << "//"; ps_sh->nl ();
*ps_sh << "class _TAO_" << this->interface_name_ << "_Proxy_Broker";
ps_sh->nl ();
*ps_sh << "{";
ps_sh->incr_indent (0);
ps_sh->nl ();
*ps_sh << "public:";
ps_sh->nl ();
*ps_sh << "virtual ~_TAO_" << this->interface_name_ << "_Proxy_Broker (void);"; ps_sh->nl ();
*ps_sh << "virtual _TAO_" << this->interface_name_ << "_Proxy_Impl &select_proxy ("; ps_sh->nl ();
*ps_sh << this->interface_name_ << "*object"; ps_sh->nl ();
*ps_sh << "ACE_ENV_ARG_DECL_WITH_DEFAULTS"; ps_sh->nl ();
*ps_sh << ") = 0;"; ps_sh->nl ();
*ps_sh << "protected:"; ps_sh->nl ();
*ps_sh << "_TAO_" << this->interface_name_ << "_Proxy_Broker (void);";
ps_sh->nl ();
*ps_sh << "};"; ps_sh->nl ();
*ps_sh << "//"; ps_sh->nl ();
*ps_sh << "// End Base Proxy Broker Declaration "; ps_sh->nl ();
*ps_sh << "///////////////////////////////////////////////////////////////";
ps_sh->nl ();
*ps_sh << "///////////////////////////////////////////////////////////////";
ps_sh->nl ();
*ps_sh << "// Remote Proxy Broker Declaration ";
ps_sh->nl ();
*ps_sh << "//";
ps_sh->nl ();
*ps_sh << "class _TAO_" << this->interface_name_ << "_Remote_Proxy_Broker";
ps_sh->nl ();
*ps_sh << ": public virtual _TAO_" << this->interface_name_
<< "_Proxy_Broker";
ps_sh->nl ();
*ps_sh << "{";
ps_sh->incr_indent (0);
ps_sh->nl ();
*ps_sh << "public: "; ps_sh->nl ();
*ps_sh << "_TAO_" << this->interface_name_ << "_Remote_Proxy_Broker (void);"; ps_sh->nl ();
*ps_sh << "virtual ~_TAO_" << this->interface_name_ << "_Remote_Proxy_Broker (void);"; ps_sh->nl ();
*ps_sh << "virtual _TAO_" << this->interface_name_ << "_Proxy_Impl &select_proxy ("; ps_sh->nl ();
*ps_sh << this->interface_name_ << "*object"; ps_sh->nl ();
*ps_sh << "ACE_ENV_ARG_DECL"; ps_sh->nl ();
*ps_sh << ");"; ps_sh->nl ();
*ps_sh << "private:"; ps_sh->nl ();
*ps_sh << "_TAO_" << this->interface_name_ << "_Remote_Proxy_Impl remote_proxy_impl_;"; ps_sh->nl ();
*ps_sh << "public:"; ps_sh->nl ();
*ps_sh << "// This member function is used to get an handle to the unique instance"; ps_sh->nl ();
*ps_sh << "// of the Remote Proxy Broker that is available for a given"; ps_sh->nl ();
*ps_sh << "// interface."; ps_sh->nl ();
*ps_sh << "static _TAO_" << this->interface_name_ << "_Remote_Proxy_Broker *the_TAO_" << this->interface_name_ << "_Remote_Proxy_Broker (void);"; ps_sh->nl ();
*ps_sh << "};"; ps_sh->nl ();
*ps_sh << "//"; ps_sh->nl ();
*ps_sh << "// End Remote Proxy Broker Declaration "; ps_sh->nl ();
*ps_sh << "//////////////////////////////////////////////////////////////";
ps_sh->nl ();
*ps_sh << "#endif /* end #if !defined */"; ps_sh->nl ();
*ps_sh << "TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_"
<< this->interface_name_ << ";";
ps_sh->nl ();
}
void
TAO_PSDL_Interface_Visitor::gen_code_for_si (void)
{
TAO_PSDL_Stream *ps_si = TAO_PSDL_Scope::instance ()->get_si ();
ps_si->reset ();
ps_si->indent (); // start from current indentation level
*ps_si << "int " << this->interface_name_ << "::_tao_class_id = 0;";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_ptr";
ps_si->nl ();
*ps_si << "tao_" << this->interface_name_ << "_duplicate (";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << this->interface_name_ << "_ptr p";
ps_si->nl ();
*ps_si << ")";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "return " << this->interface_name_ << "::_duplicate (p);";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << "void";
ps_si->nl ();
*ps_si << "tao_" << this->interface_name_ << "_release (";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << this->interface_name_ << "_ptr p";
ps_si->nl ();
*ps_si << ")";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "CORBA::release (p);";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_ptr";
ps_si->nl ();
*ps_si << "tao_" << this->interface_name_ << "_nil (";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "void";
ps_si->nl ();
*ps_si << ")";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "return " << this->interface_name_ << "::_nil ();";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_ptr";
ps_si->nl ();
*ps_si << "tao_" << this->interface_name_ << "_narrow (";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "CORBA::Object *p";
ps_si->nl ();
*ps_si << "ACE_ENV_ARG_DECL"; ps_si->nl ();
*ps_si << ")";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "return " << this->interface_name_
<< "::_narrow (p ACE_ENV_ARG_PARAMETER);";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << "CORBA::Object *"; ps_si->nl ();
*ps_si << "tao_" << this->interface_name_ << "_upcast (";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "void *src"; ps_si->nl ();
*ps_si << ")";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << this->interface_name_ << " **tmp =";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "ACE_static_cast (" << this->interface_name_ << " **, src);";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "return *tmp;";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << "// ***********************************************************";
ps_si->nl ();
*ps_si << "// " << this->interface_name_ << "_var"; ps_si->nl ();
*ps_si << "// ***********************************************************";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_var::"
<< this->interface_name_
<< "_var (void) // default constructor";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << ": ptr_ (" << this->interface_name_ << "::_nil ())";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "{}";
ps_si->nl ();
ps_si->nl ();
*ps_si << "::" << this->interface_name_ << "_ptr"; ps_si->nl ();
*ps_si << this->interface_name_ << "_var::ptr (void) const"; ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "return this->ptr_;";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_var::"
<< this->interface_name_ << "_var (const ::"
<< this->interface_name_ << "_var &p) // copy constructor";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << ": TAO_Base_var (),";
ps_si->incr_indent (0); ps_si->nl ();
*ps_si << "ptr_ (" << this->interface_name_
<< "::_duplicate (p.ptr ()))";
ps_si->decr_indent (0);
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "{}";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_var::~"
<< this->interface_name_ << "_var (void) // destructor";
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "CORBA::release (this->ptr_);";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_var &"; ps_si->nl ();
*ps_si << this->interface_name_ << "_var::operator= ("
<< this->interface_name_ << "_ptr p)";
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "this->ptr_ = p;"; ps_si->nl ();
*ps_si << "return *this;";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_var &"; ps_si->nl ();
*ps_si << this->interface_name_ << "_var::operator= (const ::"
<< this->interface_name_ << "_var &p)";
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "if (this != &p)";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
*ps_si << "CORBA::release (this->ptr_);"; ps_si->nl ();
*ps_si << "this->ptr_ = ::" << this->interface_name_
<< "::_duplicate (p.ptr ());";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "return *this;";
ps_si->decr_indent (0);
ps_si->nl ();
*ps_si << "}";
ps_si->nl ();
ps_si->nl ();
*ps_si << this->interface_name_ << "_var::operator const ::"
<< this->interface_name_ << "_ptr &() const // cast"; ps_si->nl ();
*ps_si << "{";
ps_si->incr_indent (0);
ps_si->nl ();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -