counteri.cpp
来自「ICE-3.2 一个开源的中间件」· C++ 代码 · 共 53 行
CPP
53 行
// **********************************************************************//// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.//// This copy of Ice is licensed to you under the terms described in the// ICE_LICENSE file included in this distribution.//// **********************************************************************#include <Ice/Ice.h>#include <CounterI.h>using namespace std;using namespace Demo;CounterI::CounterI(const IceStorm::TopicPrx& topic) : _value(0), _topic(topic), _publisher(CounterObserverPrx::uncheckedCast(topic->getPublisher())){}voidCounterI::subscribe(const CounterObserverPrx& observer, const Ice::Current&){ Lock sync(*this); // // Subscribe to the IceStorm topic. This returns a per-subscriber // object which is then used to send the initialize event to just // the given subscriber. // CounterObserverPrx o = CounterObserverPrx::uncheckedCast( _topic->subscribeAndGetPublisher(IceStorm::QoS(), observer)); o->init(_value);}voidCounterI::unsubscribe(const CounterObserverPrx& observer, const Ice::Current&){ _topic->unsubscribe(observer);}voidCounterI::inc(int value, const Ice::Current&){ Lock sync(*this); _value += value; _publisher->inc(value);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?