summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/TopicI.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceStorm/TopicI.h')
-rw-r--r--cpp/src/IceStorm/TopicI.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/cpp/src/IceStorm/TopicI.h b/cpp/src/IceStorm/TopicI.h
index 9597fb62558..0bc37d3ae01 100644
--- a/cpp/src/IceStorm/TopicI.h
+++ b/cpp/src/IceStorm/TopicI.h
@@ -17,25 +17,25 @@ namespace IceStorm
// Forward declarations
class PersistentInstance;
-typedef IceUtil::Handle<PersistentInstance> PersistentInstancePtr;
-
class Subscriber;
-typedef IceUtil::Handle<Subscriber> SubscriberPtr;
-class TopicImpl : public IceUtil::Shared
+class TopicImpl
{
public:
- TopicImpl(const PersistentInstancePtr&, const std::string&, const Ice::Identity&, const SubscriberRecordSeq&);
+ static std::shared_ptr<TopicImpl> create(std::shared_ptr<PersistentInstance>,
+ const std::string&,
+ const Ice::Identity&,
+ const SubscriberRecordSeq&);
std::string getName() const;
- Ice::ObjectPrx getPublisher() const;
- Ice::ObjectPrx getNonReplicatedPublisher() const;
- Ice::ObjectPrx subscribeAndGetPublisher(const QoS&, const Ice::ObjectPrx&);
- void unsubscribe(const Ice::ObjectPrx&);
- TopicLinkPrx getLinkProxy();
- void link(const TopicPrx&, Ice::Int);
- void unlink(const TopicPrx&);
+ std::shared_ptr<Ice::ObjectPrx> getPublisher() const;
+ std::shared_ptr<Ice::ObjectPrx> getNonReplicatedPublisher() const;
+ std::shared_ptr<Ice::ObjectPrx> subscribeAndGetPublisher(QoS, std::shared_ptr<Ice::ObjectPrx>);
+ void unsubscribe(const std::shared_ptr<Ice::ObjectPrx>&);
+ std::shared_ptr<TopicLinkPrx> getLinkProxy();
+ void link(const std::shared_ptr<TopicPrx>&, int);
+ void unlink(const std::shared_ptr<TopicPrx>&);
LinkInfoSeq getLinkInfoSeq() const;
Ice::IdentitySeq getSubscribers() const;
void reap(const Ice::IdentitySeq&);
@@ -48,7 +48,7 @@ public:
// Internal methods
bool destroyed() const;
Ice::Identity id() const;
- TopicPrx proxy() const;
+ std::shared_ptr<TopicPrx> proxy() const;
void shutdown();
void publish(bool, const EventDataSeq&);
@@ -57,33 +57,35 @@ public:
void observerRemoveSubscriber(const IceStormElection::LogUpdate&, const Ice::IdentitySeq&);
void observerDestroyTopic(const IceStormElection::LogUpdate&);
- Ice::ObjectPtr getServant() const;
+ std::shared_ptr<Ice::Object> getServant() const;
void updateObserver();
void updateSubscriberObservers();
private:
+ TopicImpl(std::shared_ptr<PersistentInstance>, const std::string&, const Ice::Identity&, const SubscriberRecordSeq&);
+
IceStormElection::LogUpdate destroyInternal(const IceStormElection::LogUpdate&, bool);
void removeSubscribers(const Ice::IdentitySeq&);
//
// Immutable members.
//
- const Ice::ObjectPrx _publisherReplicaProxy;
- const PersistentInstancePtr _instance;
+ const std::shared_ptr<Ice::ObjectPrx> _publisherReplicaProxy;
+ const std::shared_ptr<PersistentInstance> _instance;
const std::string _name; // The topic name
const Ice::Identity _id; // The topic identity
IceInternal::ObserverHelperT<IceStorm::Instrumentation::TopicObserver> _observer;
- /*const*/ Ice::ObjectPrx _publisherPrx; // The actual publisher proxy.
- /*const*/ TopicLinkPrx _linkPrx; // The link proxy.
+ std::shared_ptr<Ice::ObjectPrx> _publisherPrx; // The actual publisher proxy.
+ std::shared_ptr<TopicLinkPrx> _linkPrx; // The link proxy.
- Ice::ObjectPtr _servant; // The topic implementation servant.
+ std::shared_ptr<Ice::Object> _servant; // The topic implementation servant.
// Mutex protecting the subscribers.
- IceUtil::Mutex _subscribersMutex;
+ mutable std::mutex _subscribersMutex;
//
// We keep a vector of subscribers since the optimized behaviour
@@ -92,7 +94,7 @@ private:
// vector/list/map and although there was little difference vector
// was the fastest of the three.
//
- std::vector<SubscriberPtr> _subscribers;
+ std::vector<std::shared_ptr<Subscriber>> _subscribers;
bool _destroyed; // Has this Topic been destroyed?
@@ -100,8 +102,6 @@ private:
SubscriberMap _subscriberMap;
};
-typedef IceUtil::Handle<TopicImpl> TopicImplPtr;
-
} // End namespace IceStorm
#endif