channel_impl.cc

来自「MICO2.3.13 corba 环境平台」· CC 代码 · 共 65 行

CC
65
字号
#include <iostream.h>#include "channel.h"#include "message_impl.h"class MyEventChannel_impl : virtual public MyEventChannel{private:  CCM_EventChannel_Context_var _ctx;  bool active;public:  MyEventChannel_impl ()    {      active = false;    }    void push_incoming (Message * msg)    {      if (active) {	_ctx->push_outgoing (msg);      }    }  void set_session_context (Components::SessionContext_ptr ctx)    {      _ctx = CCM_EventChannel_Context::_narrow (ctx);    }  void ccm_activate ()    {      cout << "Event Channel is active." << endl;      active = true;    }  void ccm_passivate ()    {      cout << "Event Channel is passive." << endl;      active = false;    }  void ccm_remove ()    {      cout << "Event Channel is being removed." << endl;    }};class MyEventChannelHome_impl : virtual public CCM_EventChannelHome {public:  Components::EnterpriseComponent_ptr create ()    {      return new MyEventChannel_impl;    }};extern "C" {  Components::HomeExecutorBase_ptr  create_EventChannelHome (CORBA::ORB_ptr orb)  {    CORBA::ValueFactoryBase_var f = new MessageFactory;    orb->register_value_factory ("IDL:Message:1.0", f);    return new MyEventChannelHome_impl;  }}

⌨️ 快捷键说明

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