supplier.cpp
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 87 行
CPP
87 行
/* -*- C++ -*- */
// Supplier.cpp,v 1.3 2002/01/29 20:20:46 okellogg Exp
#include "Supplier.h"
void
Supplier::open (CosEventChannelAdmin::EventChannel_ptr event_channel
ACE_ENV_ARG_DECL)
{
// = Connect as a consumer.
this->supplier_admin_ =
event_channel->for_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
}
void
Supplier::close (ACE_ENV_SINGLE_ARG_DECL)
{
this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->supplier_admin_ =
CosEventChannelAdmin::SupplierAdmin::_nil ();
}
void
Supplier::connect (ACE_ENV_SINGLE_ARG_DECL)
{
if (CORBA::is_nil (this->supplier_admin_.in ()))
return;
this->consumer_proxy_ =
this->supplier_admin_->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
CosEventComm::PushSupplier_var objref = this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->consumer_proxy_->connect_push_supplier (objref.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
}
void
Supplier::disconnect (ACE_ENV_SINGLE_ARG_DECL)
{
if (CORBA::is_nil (this->consumer_proxy_.in ())
|| CORBA::is_nil (this->supplier_admin_.in ()))
return;
this->consumer_proxy_->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->consumer_proxy_ =
CosEventChannelAdmin::ProxyPushConsumer::_nil ();
}
void
Supplier::send_event (const CORBA::Any & data
ACE_ENV_ARG_DECL)
{
this->consumer_proxy_->push (data ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
}
void
Supplier::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((
CORBA::SystemException
))
{
// Deactivate this object.
PortableServer::POA_var poa =
this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
PortableServer::ObjectId_var id =
poa->servant_to_id (this
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
poa->deactivate_object (id.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?