32 #include <Ice/Object.h>
33 #include <Ice/Proxy.h>
34 #include <Ice/Properties.h>
36 #include <IceUtil/Handle.h>
37 #include <IceUtil/Shared.h>
47 class ConnectionRefusedException;
107 public IceUtil::Shared,
129 std::string name =
"",
const std::string topicSuffix =
"");
151 void removeObject(
const std::string& objectName);
161 template <
class ProxyType>
163 const std::string& endpoints = std::string())
165 std::string proxyString = name;
167 if (!endpoints.empty())
169 proxyString += std::string(
":") + endpoints;
172 std::string proxyTypedId =
179 return ProxyType::uncheckedCast(implGetCheckedProxy(proxyTypedId));
181 catch (std::out_of_range& uncheckedProxiesException)
185 Ice::ObjectPrx base = communicator_stringToProxy(proxyString);
191 proxy = ProxyType::checkedCast(base);
192 implSetCheckedProxy(proxyTypedId, proxy);
194 catch (
const Ice::ConnectionRefusedException&)
196 std::stringstream exceptionText;
197 exceptionText <<
"Connection refused for proxy of type '" << GetTypeString<ProxyType>()
198 <<
"': " << name <<
" ProxyString: " << proxyString <<
" Endpoints: " << endpoints << std::endl;
199 throwUserException(exceptionText.str());
204 std::stringstream exceptionText;
205 exceptionText <<
"Invalid Proxy. Searched for: " << name <<
" ProxyString: " << proxyString <<
" Endpoints: " << endpoints << std::endl;
206 throwUserException(exceptionText.str());
212 void throwUserException(std::string
const&
message);
221 template <
class ProxyType>
223 const std::string& endpoints = std::string())
225 return removeProxyFromCache(name,
typeid(
ProxyType).name(), endpoints);
228 bool removeProxyFromCache(
const std::string& name,
229 const std::string& typeName,
230 const std::string& endpoints = std::string());
239 bool removeProxyFromCache(
const Ice::ObjectPrx& proxy);
257 template <
class TopicProxy>
258 TopicProxy
getTopic(
const std::string& topicName,
bool useUDP =
false)
260 Ice::ObjectPrx pub = __getTopic(topicName, useUDP);
261 TopicProxy castTopic = TopicProxy::uncheckedCast(pub);
279 void subscribeTopic(Ice::ObjectPrx subscriber,
280 const std::string& topicName,
bool orderedPublishing =
false);
282 const std::string& topicName,
bool orderedPublishing =
false);
290 void unsubscribeTopic(Ice::ObjectPrx subscriberProxy,
291 const std::string& topicName);
303 void registerObjectDependency(
304 const std::string& registrantName,
305 const std::string& dependencyObjectName);
314 void registerDelayedTopicSubscription(
315 const std::string& registrantName,
316 const std::string& topicName);
324 void registerDelayedTopicRetrieval(
325 const std::string& registrantName,
326 const std::string& topicName);
334 bool isObjectReachable(std::string objectName);
342 template <
typename ProxyType>
343 bool isObjectReachable(std::string objectName);
370 void setName(std::string name);
381 void waitForShutdown();
396 std::string getTopicSuffix()
const;
400 Ice::ObjectPrx communicator_stringToProxy(std::string
const& proxyString);
402 Ice::ObjectPrx __getTopic(
const std::string& topicName,
bool useUDP =
false);
406 struct DependencyObjectEntry:
public IceUtil::Shared
408 DependencyObjectEntry(std::string name, Ice::ObjectPrx proxy) :
417 Ice::ObjectPrx proxy;
424 using TopicList = std::vector<std::string>;
430 void subscribeTopics(Ice::ObjectPrx subscriber,
431 const TopicList& topics,
bool orderedPublishing =
false);
436 void retrieveTopics(
const TopicList& topics);
443 void resolveObjectDependencies();
453 ObjectEntryPtr getOrCreateObjectEntry(
const std::string& objectName);
484 Ice::ObjectPrx implGetCheckedProxy(std::string
const& proxyTypedId);
485 void implSetCheckedProxy(std::string
const& proxyTypedId, Ice::ObjectPrx
const& proxy);
489 std::unique_ptr<Impl> impl;
493 template <
typename ProxyType>
498 ProxyType prx = getProxy<ProxyType>(objectName);
499 prx->ice_timeout(500)->ice_ping();