12.07.2015 Views

VisiBroker Edition

VisiBroker Edition

VisiBroker Edition

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

实 例 程 序实 例 程 序使 用 tie 机 制 的 实 例 程 序 的 位 置在 examples/basic/bank_tie 目 录 下 Java 和 C++ 版 <strong>VisiBroker</strong> <strong>Edition</strong> 中 可 以找 到 一 个 使 用 tie 机 制 的 Bank ( 银 行 ) 实 例 。查 看 tie 模 板C++: idl2cpp 编 译 器 会 自 动 生 成 _tie_Account 模 板 类 , 如 下 列 代 码 样 本 所 示 。POA_Bank_Account_tie 类 是 由 对 象 服 务 器 实 例 化 并 通 过 AccountImpl 实 例 初 始 化的 。 POA_Bank_Account_tie 数 据 将 自 己 收 到 的 所 有 操 作 请 求 委 托 给 真 实 实 现 类AccountImpl。 在 该 实 例 中 , AccountImpl 类 不 从 POA_Bank::Account 类 继 承 。...template class POA_Bank_Account_tie :public POA_Bank::Account {private:CORBA::Boolean _rel;PortableServer::POA_ptr _poa;T *_ptr;POA_Bank_Account_tie(const POA_Bank_Account_tie&) {}void operator=(const POA_Bank_Account_tie&) {}public:POA_Bank_Account_tie (T& t):_ptr(&t), _poa(NULL), _rel((CORBA::Boolean)0) {}POA_Bank_Account_tie (T& t, PortableServer::POA_ptr poa):_ptr(&t),_poa(PortableServer::_duplicate(poa)), _rel((CORBA::Boolean)0) {}POA_Bank_Account_tie (T *p, CORBA::Boolean release= 1) :_ptr(p),_poa(NULL), _rel(release) {}POA_Bank_Account_tie (T *p, PortableServer::POA_ptr poa, CORBA::Boolean release=1): _ptr(p), _poa(PortableServer::_duplicate(poa)), _rel(release) {}virtual ~POA_Bank_Account_tie() {CORBA::release(_poa);if (_rel) {delete _ptr;}}T* _tied_object() { return _ptr; }void _tied_object(T& t) {if (_rel) {delete _ptr;}_ptr = &t;_rel = 0;}void _tied_object(T *p, CORBA::Boolean release=1) {if (_rel) {delete _ptr;}_ptr = p;9-2 <strong>VisiBroker</strong> 开 发 者 指 南

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!