⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 psdl_struct_visitor.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
📖 第 1 页 / 共 3 页
字号:

  ps_sin->incr_indent (0);
  ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0);
  ps_sin->nl ();

  *ps_sin << this->struct_name_ << " *deep_copy =";
  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "new " << this->struct_name_ << " (*p.ptr_);";

  ps_sin->decr_indent (0);ps_sin->nl ();

  ps_sin->nl ();

  *ps_sin << "if (deep_copy != 0)";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << this->struct_name_ << " *tmp = deep_copy;"; ps_sin->nl ();
  *ps_sin << "deep_copy = this->ptr_;"; ps_sin->nl ();
  *ps_sin << "this->ptr_ = tmp;"; ps_sin->nl ();
  *ps_sin << "delete deep_copy;";

  ps_sin->decr_indent (0);ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->decr_indent (0);
  ps_sin->decr_indent (0);ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->decr_indent (0);
  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "return *this;";

  ps_sin->decr_indent (0);
  ps_sin->decr_indent (0);
  ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE const ::" << this->struct_name_ << " *"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::operator-> (void) const"; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE ::" << this->struct_name_ << " *"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::operator-> (void)"; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::operator const ::" << this->struct_name_ << " &() const // cast"; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return *this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::operator ::" << this->struct_name_ << " &() // cast "; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return *this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::operator ::" << this->struct_name_ << " &() const // cast "; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return *this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "// variable-size types only"; ps_sin->nl ();
  *ps_sin << "ACE_INLINE"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::operator ::" << this->struct_name_ << " *&() // cast "; ps_sin->nl ();
  *ps_sin << "{";
  ps_sin->incr_indent (0); ps_sin->nl ();

  *ps_sin << "return this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE const ::" << this->struct_name_ << " &"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::in (void) const"; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return *this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE ::" << this->struct_name_ << " &"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::inout (void)"; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return *this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "// mapping for variable size "; ps_sin->nl ();
  *ps_sin << "ACE_INLINE ::" << this->struct_name_ << " *&"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::out (void)"; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "delete this->ptr_;"; ps_sin->nl ();
  *ps_sin << "this->ptr_ = 0;"; ps_sin->nl ();
  *ps_sin << "return this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE ::" << this->struct_name_ << " *"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::_retn (void)"; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();

  *ps_sin << "::" << this->struct_name_ << " *tmp = this->ptr_;"; ps_sin->nl ();
  *ps_sin << "this->ptr_ = 0;"; ps_sin->nl ();
  *ps_sin << "return tmp;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE ::" << this->struct_name_ << " *"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_var::ptr (void) const"; ps_sin->nl ();

  *ps_sin << "{";
  ps_sin->incr_indent (0); ps_sin->nl ();

  *ps_sin << "return this->ptr_;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "// ************************************************************";
  ps_sin->nl ();
  *ps_sin << "// Inline operations for class " << this->struct_name_ << "_out";
  ps_sin->nl ();
  *ps_sin << "// ************************************************************"; ps_sin->nl ();

  ps_sin->nl ();

  *ps_sin << "ACE_INLINE"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_out::" << this->struct_name_ << "_out (::" << this->struct_name_ << " *&p)";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << ": ptr_ (p)";
  ps_sin->decr_indent (0); ps_sin->nl ();

  *ps_sin << "{";
  ps_sin->incr_indent (0); ps_sin->nl ();

  *ps_sin << "this->ptr_ = 0;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_out::" << this->struct_name_ << "_out (" << this->struct_name_ << "_var &p) // constructor from _var";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << ": ptr_ (p.out ())";
  ps_sin->decr_indent (0); ps_sin->nl ();

  *ps_sin << "{";
  ps_sin->incr_indent (0);ps_sin->nl ();

  *ps_sin << "delete this->ptr_;"; ps_sin->nl ();
  *ps_sin << "this->ptr_ = 0;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_out::" << this->struct_name_ << "_out (const ::" << this->struct_name_ << "_out &p) // copy constructor";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << ": ptr_ (ACE_const_cast (" << this->struct_name_ << "_out&, p).ptr_)";
  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "{}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE " << this->struct_name_ << "_out &"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_out::operator= (const ::" << this->struct_name_ << "_out &p)"; ps_sin->nl ();

  *ps_sin << "{";
  ps_sin->incr_indent (0);ps_sin->nl ();

  *ps_sin << "this->ptr_ = ACE_const_cast (" << this->struct_name_ << "_out&, p).ptr_;"; ps_sin->nl ();
  *ps_sin << "return *this;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE " << this->struct_name_ << "_out &"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_out::operator= (" << this->struct_name_ << " *p)"; ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "this->ptr_ = p;"; ps_sin->nl ();
  *ps_sin << "return *this;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_out::operator ::" << this->struct_name_ << " *&() // cast"; ps_sin->nl ();
  *ps_sin << "{";
  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return this->ptr_;";
  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE ::" << this->struct_name_ << " *&"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_out::ptr (void) // ptr"; ps_sin->nl ();
  *ps_sin << "{";
  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return this->ptr_;";
  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE ::" << this->struct_name_ << " *"; ps_sin->nl ();
  *ps_sin << this->struct_name_ << "_out::operator-> (void)"; ps_sin->nl ();
  *ps_sin << "{";
  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return this->ptr_;";
  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE CORBA::Boolean operator<< "
          << "(TAO_OutputCDR &strm, const " << this->struct_name_ << " &_tao_aggregate)";
  ps_sin->nl ();
  *ps_sin << "{";

  ps_sin->incr_indent (0); ps_sin->nl ();

  *ps_sin << "if (";
  ps_sin->incr_indent (0); ps_sin->nl ();

  *ps_sin << "(strm << _tao_aggregate.name.in ()) &&"; ps_sin->nl ();
  *ps_sin << "(strm << _tao_aggregate.obj_ref.in ())";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << ")";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return 1;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "else";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return 0;";


  ps_sin->decr_indent (0);
  ps_sin->decr_indent (0);ps_sin->nl ();
  *ps_sin << "}";

  ps_sin->nl ();
  ps_sin->nl ();

  *ps_sin << "ACE_INLINE CORBA::Boolean operator>> "
          << "(TAO_InputCDR &strm, " << this->struct_name_ << " &_tao_aggregate)";
  ps_sin->nl ();

  *ps_sin << "{";
  ps_sin->incr_indent (0); ps_sin->nl ();

  *ps_sin << "if (";
  ps_sin->incr_indent (0);ps_sin->nl ();

  *ps_sin << "(strm >> _tao_aggregate.name.out ()) &&"; ps_sin->nl ();
  *ps_sin << "(strm >> _tao_aggregate.obj_ref.out ())";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << ")";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return 1;";

  ps_sin->decr_indent (0); ps_sin->nl ();
  *ps_sin << "else";

  ps_sin->incr_indent (0); ps_sin->nl ();
  *ps_sin << "return 0;";

  ps_sin->decr_indent (0);
  ps_sin->decr_indent (0);
  ps_sin->nl ();

  *ps_sin << "}";

  ps_sin->nl ();

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -