TransientTopicI.h
Go to the documentation of this file.
1// **********************************************************************
2//
3// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
4//
5// This copy of Ice is licensed to you under the terms described in the
6// ICE_LICENSE file included in this distribution.
7//
8// **********************************************************************
9
10#ifndef TRANSIENT_TOPIC_I_H
11#define TRANSIENT_TOPIC_I_H
12
14
15namespace IceStorm
16{
17
18 // Forward declarations.
19 class Instance;
20 typedef IceUtil::Handle<Instance> InstancePtr;
21
22 class Subscriber;
23 typedef IceUtil::Handle<Subscriber> SubscriberPtr;
24
25 class TransientTopicImpl : public TopicInternal, public IceUtil::Mutex
26 {
27 public:
28 TransientTopicImpl(const InstancePtr&, const std::string&, const Ice::Identity&);
30
31 virtual std::string getName(const Ice::Current&) const;
32 virtual Ice::ObjectPrx getPublisher(const Ice::Current&) const;
33 virtual Ice::ObjectPrx getNonReplicatedPublisher(const Ice::Current&) const;
34 virtual void subscribe(const QoS&, const Ice::ObjectPrx&, const Ice::Current&);
35 virtual Ice::ObjectPrx
36 subscribeAndGetPublisher(const QoS&, const Ice::ObjectPrx&, const Ice::Current&);
37 virtual void unsubscribe(const Ice::ObjectPrx&, const Ice::Current&);
38 virtual TopicLinkPrx getLinkProxy(const Ice::Current&);
39 virtual void link(const TopicPrx&, Ice::Int, const Ice::Current&);
40 virtual void unlink(const TopicPrx&, const Ice::Current&);
41 virtual LinkInfoSeq getLinkInfoSeq(const Ice::Current&) const;
42 virtual Ice::IdentitySeq getSubscribers(const Ice::Current&) const;
43 virtual void destroy(const Ice::Current&);
44 virtual void reap(const Ice::IdentitySeq&, const Ice::Current&);
45
46 // Internal methods
47 bool destroyed() const;
48 Ice::Identity id() const;
49 void publish(bool, const EventDataSeq&);
50
51 void shutdown();
52
53 private:
54 //
55 // Immutable members.
56 //
57 const InstancePtr _instance;
58 const std::string _name; // The topic name
59 const Ice::Identity _id; // The topic identity
60
61 /*const*/ Ice::ObjectPrx _publisherPrx;
62 /*const*/ TopicLinkPrx _linkPrx;
63
64 //
65 // We keep a vector of subscribers since the optimized behaviour
66 // should be publishing events, not searching through the list of
67 // subscribers for a particular subscriber. I tested
68 // vector/list/map and although there was little difference vector
69 // was the fastest of the three.
70 //
71 std::vector<SubscriberPtr> _subscribers;
72
73 bool _destroyed; // Has this Topic been destroyed?
74 };
75
77
78} // End namespace IceStorm
79
80#endif
Internal operations for a topic.
idempotent TopicLink * getLinkProxy()
Retrieve a proxy to the TopicLink interface.
virtual Ice::ObjectPrx subscribeAndGetPublisher(const QoS &, const Ice::ObjectPrx &, const Ice::Current &)
void publish(bool, const EventDataSeq &)
virtual Ice::ObjectPrx getPublisher(const Ice::Current &) const
virtual std::string getName(const Ice::Current &) const
virtual void link(const TopicPrx &, Ice::Int, const Ice::Current &)
virtual Ice::ObjectPrx getNonReplicatedPublisher(const Ice::Current &) const
virtual void subscribe(const QoS &, const Ice::ObjectPrx &, const Ice::Current &)
virtual void unlink(const TopicPrx &, const Ice::Current &)
virtual void destroy(const Ice::Current &)
virtual void reap(const Ice::IdentitySeq &, const Ice::Current &)
virtual Ice::IdentitySeq getSubscribers(const Ice::Current &) const
virtual void unsubscribe(const Ice::ObjectPrx &, const Ice::Current &)
TransientTopicImpl(const InstancePtr &, const std::string &, const Ice::Identity &)
virtual LinkInfoSeq getLinkInfoSeq(const Ice::Current &) const
IceUtil::Handle< Subscriber > SubscriberPtr
Definition Subscriber.h:26
::IceInternal::ProxyHandle<::IceProxy::IceStorm::Topic > TopicPrx
Definition IceManager.h:70
std::deque<::IceStorm::EventDataPtr > EventDataSeq
A sequence of EventData.
::IceInternal::ProxyHandle<::IceProxy::IceStorm::TopicLink > TopicLinkPrx
IceUtil::Handle< Instance > InstancePtr
Definition Instance.h:128
IceUtil::Handle< TransientTopicImpl > TransientTopicImplPtr