IceManager Class Reference

The IceManager class provides simplified access to commonly used Ice features. More...

#include <ArmarXCore/core/IceManager.h>

+ Inheritance diagram for IceManager:

Classes

struct  Impl
 
struct  ObjectEntry
 

Public Member Functions

void destroy ()
 Destroys the communicator. More...
 
const Ice::CommunicatorPtrgetCommunicator ()
 Short helper method to return the Ice Communicator. More...
 
IceGrid::RegistryPrx getIceGridRegistry ()
 Provides access to the IceGrid Registry. More...
 
const armarx::IceGridAdminPtrgetIceGridSession ()
 Provides access to the IceGrid AdminSession via IceGridAdmin. More...
 
template<class ProxyType >
ProxyType getProxy (const std::string &name, const std::string &endpoints=std::string())
 Retrieves a proxy object. More...
 
template<class TopicProxy >
TopicProxy getTopic (const std::string &topicName, bool useUDP=false)
 Gets an Ice Storm topic for publishing messages. More...
 
IceStorm::TopicManagerPrx getTopicManager ()
 Provides access to the Ice Storm Topic Manager. More...
 
std::string getTopicSuffix () const
 Get the suffix that is appended to all topics. More...
 
 IceManager (const Ice::CommunicatorPtr &communicator, std::string name="", const std::string topicSuffix="")
 Set up an instance of this class with a preexisting communicator. More...
 
bool isObjectReachable (std::string objectName)
 creates a proxy to the object specified with parameter objectName and tries to ping it. More...
 
template<typename ProxyType >
bool isObjectReachable (std::string objectName)
 creates a proxy to the object specified with parameter objectName and tries to ping it. More...
 
bool isShutdown ()
 Determines whether the communicator is shutdown. More...
 
void registerAndSubscribeTopic (Ice::ObjectPtr subscriber, const std::string &topicName, bool orderedPublishing=false)
 
void registerDelayedTopicRetrieval (const std::string &registrantName, const std::string &topicName)
 Registers a delayed topic retrieval. More...
 
void registerDelayedTopicSubscription (const std::string &registrantName, const std::string &topicName)
 Registers a delayed topic subscription. More...
 
ObjectHandles registerObject (const Ice::ObjectPtr &object, const std::string &objectName, const Ice::ObjectAdapterPtr &adapterToAddTo=nullptr)
 Register an object with Ice for being accessed through IceGrid. More...
 
void registerObjectDependency (const std::string &registrantName, const std::string &dependencyObjectName)
 Registers a specified object that is required before activating the endpoints. More...
 
void removeObject (const std::string &objectName)
 Removes an object from the IceGrid. More...
 
bool removeProxyFromCache (const Ice::ObjectPrx &proxy)
 This functions removes the given proxy from the proxy cache. More...
 
template<class ProxyType >
bool removeProxyFromCache (const std::string &name, const std::string &endpoints=std::string())
 This functions removes the given proxy from the proxy cache. More...
 
bool removeProxyFromCache (const std::string &name, const std::string &typeName, const std::string &endpoints=std::string())
 
void setName (std::string name)
 Sets the session name. More...
 
void shutdown ()
 Removes all component objects and topics and shuts down the communicator. More...
 
void subscribeTopic (Ice::ObjectPrx subscriber, const std::string &topicName, bool orderedPublishing=false)
 Subscribe an object to a particular Ice Storm topic. More...
 
void throwUserException (std::string const &message)
 
void unsubscribeTopic (Ice::ObjectPrx subscriberProxy, const std::string &topicName)
 Unsubscribe a given subscriber from a given topic. More...
 
void waitForShutdown ()
 Waits until all invoked operation has been processed. More...
 
 ~IceManager () override
 
- Public Member Functions inherited from Logging
SpamFilterDataPtr deactivateSpam (float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
 disables the logging for the current line for the given amount of seconds. More...
 
MessageTypeT getEffectiveLoggingLevel () const
 
 Logging ()
 
void setLocalMinimumLoggingLevel (MessageTypeT level)
 With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set. More...
 
void setTag (const LogTag &tag)
 
void setTag (const std::string &tagName)
 
virtual ~Logging ()
 

Static Public Member Functions

static IceStorm::TopicManagerPrx GetTopicManager (Ice::CommunicatorPtr communicator)
 

Friends

class Component
 

Additional Inherited Members

- Protected Member Functions inherited from Logging
bool checkLogLevel (MessageTypeT level) const
 
const LogSenderPtrgetLogSender () const
 Retrieve log sender. More...
 
LogSenderPtr loghelper (const char *file, int line, const char *function) const
 
- Protected Attributes inherited from Logging
MessageTypeT minimumLoggingLevel
 
SpamFilterDataPtr spamFilter
 
LogTag tag
 

Detailed Description

The IceManager class provides simplified access to commonly used Ice features.

See also
Logging

Definition at line 106 of file IceManager.h.

Constructor & Destructor Documentation

◆ IceManager()

IceManager ( const Ice::CommunicatorPtr communicator,
std::string  name = "",
const std::string  topicSuffix = "" 
)

Set up an instance of this class with a preexisting communicator.

This is useful for creating an instance from within an Ice::Application. If you do not have a communicator yet you can use one of the static factory methods instead.

Parameters
communicatorAn Ice communicator
nameA unique name, e.g. the base component's name. This name is used to create IceGridObservers, which must have a unique name.
topicSuffixSuffix appended to all topic names.

Definition at line 59 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ ~IceManager()

~IceManager ( )
override

Definition at line 69 of file IceManager.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ destroy()

void destroy ( )

Destroys the communicator.

Definition at line 409 of file IceManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCommunicator()

const Ice::CommunicatorPtr & getCommunicator ( )

Short helper method to return the Ice Communicator.

Uses static communicator() method

Definition at line 639 of file IceManager.cpp.

+ Here is the caller graph for this function:

◆ getIceGridRegistry()

IceGrid::RegistryPrx getIceGridRegistry ( )

Provides access to the IceGrid Registry.

A proxy is created if necessary.

Returns
A proxy of the IceGrid Registy.

Definition at line 658 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ getIceGridSession()

const IceGridAdminPtr & getIceGridSession ( )

Provides access to the IceGrid AdminSession via IceGridAdmin.

Returns
The IceGrid AdminSession.

Definition at line 645 of file IceManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProxy()

ProxyType getProxy ( const std::string &  name,
const std::string &  endpoints = std::string() 
)
inline

Retrieves a proxy object.

Parameters
nameProxy name, e.g. Log
endpointsThe endpoints, e.g. tcp ‑p 10002
Returns
A proxy of the remote instance.

Definition at line 162 of file IceManager.h.

◆ getTopic()

TopicProxy getTopic ( const std::string &  topicName,
bool  useUDP = false 
)
inline

Gets an Ice Storm topic for publishing messages.

Parameters
topicNameThe name of the topic to publish on.
Returns
A proxy of the topic's remote instance.

Definition at line 258 of file IceManager.h.

◆ getTopicManager()

IceStorm::TopicManagerPrx getTopicManager ( )

Provides access to the Ice Storm Topic Manager.

A proxy is created if necessary.

Returns
A proxy of the IceStorm TopicManager.

Definition at line 251 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ GetTopicManager()

IceStorm::TopicManagerPrx GetTopicManager ( Ice::CommunicatorPtr  communicator)
static

Definition at line 263 of file IceManager.cpp.

+ Here is the caller graph for this function:

◆ getTopicSuffix()

std::string getTopicSuffix ( ) const

Get the suffix that is appended to all topics.

Definition at line 419 of file IceManager.cpp.

◆ isObjectReachable() [1/2]

bool isObjectReachable ( std::string  objectName)

creates a proxy to the object specified with parameter objectName and tries to ping it.

Parameters
objectNameName of the object that should be checked
Returns
true, if reachable

Definition at line 684 of file IceManager.cpp.

+ Here is the caller graph for this function:

◆ isObjectReachable() [2/2]

bool isObjectReachable ( std::string  objectName)

creates a proxy to the object specified with parameter objectName and tries to ping it.

Parameters
objectNameName of the object that should be checked
Returns
true, if reachable

Definition at line 494 of file IceManager.h.

◆ isShutdown()

bool isShutdown ( )

Determines whether the communicator is shutdown.

Definition at line 403 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ registerAndSubscribeTopic()

void registerAndSubscribeTopic ( Ice::ObjectPtr  subscriber,
const std::string &  topicName,
bool  orderedPublishing = false 
)

Definition at line 312 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ registerDelayedTopicRetrieval()

void registerDelayedTopicRetrieval ( const std::string &  registrantName,
const std::string &  topicName 
)

Registers a delayed topic retrieval.

Parameters
registrantNameRegistrant object name
topicNameThe topic name

Definition at line 598 of file IceManager.cpp.

◆ registerDelayedTopicSubscription()

void registerDelayedTopicSubscription ( const std::string &  registrantName,
const std::string &  topicName 
)

Registers a delayed topic subscription.

Parameters
registrantNameRegistrant object name
topicNameThe topic name that should be subscribed later on

Definition at line 586 of file IceManager.cpp.

◆ registerObject()

ObjectHandles registerObject ( const Ice::ObjectPtr &  object,
const std::string &  objectName,
const Ice::ObjectAdapterPtr adapterToAddTo = nullptr 
)

Register an object with Ice for being accessed through IceGrid.

Parameters
objectThe object to be registered, implementing an Ice interface.
objectNameThe name this object should be available as.
Returns
The registered object proxy.

Definition at line 99 of file IceManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerObjectDependency()

void registerObjectDependency ( const std::string &  registrantName,
const std::string &  dependencyObjectName 
)

Registers a specified object that is required before activating the endpoints.

Parameters
registrantNameObject that has a dependency
dependecyObjectNameDependecy object name
Exceptions
ObjectAlreadyActiveException

Definition at line 495 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ removeObject()

void removeObject ( const std::string &  objectName)

Removes an object from the IceGrid.

Parameters
objectNameThe name of the object that should be removed

Definition at line 145 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ removeProxyFromCache() [1/3]

bool removeProxyFromCache ( const Ice::ObjectPrx &  proxy)

This functions removes the given proxy from the proxy cache.

This is useful if the cached proxy became invalid.

Parameters
nameProxy name, e.g. Log
endpointsThe endpoints, e.g. tcp ‑p 10002
Returns
True, if the proxy was found and removed.

Definition at line 233 of file IceManager.cpp.

◆ removeProxyFromCache() [2/3]

bool removeProxyFromCache ( const std::string &  name,
const std::string &  endpoints = std::string() 
)
inline

This functions removes the given proxy from the proxy cache.

This is useful if the cached proxy became invalid.

Parameters
nameProxy name, e.g. Log
endpointsThe endpoints, e.g. tcp ‑p 10002
Returns
True, if the proxy was found and removed.

Definition at line 222 of file IceManager.h.

◆ removeProxyFromCache() [3/3]

bool removeProxyFromCache ( const std::string &  name,
const std::string &  typeName,
const std::string &  endpoints = std::string() 
)

Definition at line 215 of file IceManager.cpp.

◆ setName()

void setName ( std::string  name)

Sets the session name.

Definition at line 633 of file IceManager.cpp.

◆ shutdown()

void shutdown ( )

Removes all component objects and topics and shuts down the communicator.

Definition at line 389 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ subscribeTopic()

void subscribeTopic ( Ice::ObjectPrx  subscriber,
const std::string &  topicName,
bool  orderedPublishing = false 
)

Subscribe an object to a particular Ice Storm topic.

If the object is already subscribed to the topic, it will be unsubscribed before. This is necessary to circumvent the usage from outdated subscriptions due to unproper exits.

Parameters
subcriberA proxy of the object to be subscribed, implementing the interface for listening on this topic
topicNameThe topic's name
orderedPublishingIf true, the order of topic calls is ensured. This might decrease performance.

Definition at line 271 of file IceManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ throwUserException()

void throwUserException ( std::string const &  message)

Definition at line 210 of file IceManager.cpp.

+ Here is the call graph for this function:

◆ unsubscribeTopic()

void unsubscribeTopic ( Ice::ObjectPrx  subscriberProxy,
const std::string &  topicName 
)

Unsubscribe a given subscriber from a given topic.

Parameters
subscriberProxyof the subscriber
topicNameThe name of the subscribed topic.

Definition at line 318 of file IceManager.cpp.

+ Here is the caller graph for this function:

◆ waitForShutdown()

void waitForShutdown ( )

Waits until all invoked operation has been processed.

Definition at line 397 of file IceManager.cpp.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ Component

friend class Component
friend

Definition at line 110 of file IceManager.h.


The documentation for this class was generated from the following files: