Ice 3.7 C++98 API Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
Ice::Communicator Class Referenceabstract

The central object in Ice. More...

#include <Ice/Ice.h>

Inheritance diagram for Ice::Communicator:
Inheritance graph
[legend]
Collaboration diagram for Ice::Communicator:
Collaboration graph
[legend]

Public Types

typedef CommunicatorPtr PointerType
 

Public Member Functions

virtual void addAdminFacet (const ObjectPtr &servant, const ::std::string &facet)=0
 Add a new facet to the Admin object. More...
 
virtual void addObjectFactory (const ObjectFactoryPtr &factory, const ::std::string &id)=0
 Add an object factory to this communicator. More...
 
virtual AsyncResultPtr begin_flushBatchRequests (CompressBatch compress)=0
 Flush any pending batch requests for this communicator. More...
 
virtual AsyncResultPtr begin_flushBatchRequests (CompressBatch compress, const Callback_Communicator_flushBatchRequestsPtr &cb, const LocalObjectPtr &cookie=0)=0
 Flush any pending batch requests for this communicator. More...
 
virtual AsyncResultPtr begin_flushBatchRequests (CompressBatch compress, const CallbackPtr &cb, const LocalObjectPtr &cookie=0)=0
 Flush any pending batch requests for this communicator. More...
 
virtual ObjectPrx createAdmin (const ObjectAdapterPtr &adminAdapter, const Identity &adminId)=0
 Add the Admin object with all its facets to the provided object adapter. More...
 
virtual ObjectAdapterPtr createObjectAdapter (const ::std::string &name)=0
 Create a new object adapter. More...
 
virtual ObjectAdapterPtr createObjectAdapterWithEndpoints (const ::std::string &name, const ::std::string &endpoints)=0
 Create a new object adapter with endpoints. More...
 
virtual ObjectAdapterPtr createObjectAdapterWithRouter (const ::std::string &name, const RouterPrx &rtr)=0
 Create a new object adapter with a router. More...
 
virtual void destroy ()=0 throw ()
 Destroy the communicator. More...
 
virtual void end_flushBatchRequests (const AsyncResultPtr &result)=0
 Flush any pending batch requests for this communicator. More...
 
virtual ObjectPtr findAdminFacet (const ::std::string &facet)=0
 Returns a facet of the Admin object. More...
 
virtual FacetMap findAllAdminFacets ()=0
 Returns a map of all facets of the Admin object. More...
 
virtual ObjectFactoryPtr findObjectFactory (const ::std::string &id) const =0 throw ()
 Find an object factory registered with this communicator. More...
 
virtual void flushBatchRequests (CompressBatch compress)=0
 Flush any pending batch requests for this communicator. More...
 
virtual ObjectPrx getAdmin () const =0
 Get a proxy to the main facet of the Admin object. More...
 
virtual LocatorPrx getDefaultLocator () const =0
 Get the default locator this communicator. More...
 
virtual RouterPrx getDefaultRouter () const =0
 Get the default router this communicator. More...
 
virtual ImplicitContextPtr getImplicitContext () const =0 throw ()
 Get the implicit context associated with this communicator. More...
 
virtual LoggerPtr getLogger () const =0 throw ()
 Get the logger for this communicator. More...
 
virtual ::Ice::Instrumentation::CommunicatorObserverPtr getObserver () const =0 throw ()
 Get the observer resolver object for this communicator. More...
 
virtual PluginManagerPtr getPluginManager () const =0
 Get the plug-in manager for this communicator. More...
 
virtual PropertiesPtr getProperties () const =0 throw ()
 Get the properties for this communicator. More...
 
virtual ValueFactoryManagerPtr getValueFactoryManager () const =0 throw ()
 Get the value factory manager for this communicator. More...
 
virtual ::std::string identityToString (const Identity &ident) const =0
 Convert an identity into a string. More...
 
virtual bool isShutdown () const =0 throw ()
 Check whether communicator has been shut down. More...
 
virtual ObjectPrx propertyToProxy (const ::std::string &property) const =0
 Convert a set of proxy properties into a proxy. More...
 
virtual PropertyDict proxyToProperty (const ObjectPrx &proxy, const ::std::string &property) const =0
 Convert a proxy to a set of proxy properties. More...
 
virtual ::std::string proxyToString (const ObjectPrx &obj) const =0
 Convert a proxy into a string. More...
 
virtual ObjectPtr removeAdminFacet (const ::std::string &facet)=0
 Remove the following facet to the Admin object. More...
 
virtual void setDefaultLocator (const LocatorPrx &loc)=0
 Set a default Ice locator for this communicator. More...
 
virtual void setDefaultRouter (const RouterPrx &rtr)=0
 Set a default router for this communicator. More...
 
virtual void shutdown ()=0 throw ()
 Shuts down this communicator's server functionality, which includes the deactivation of all object adapters. More...
 
virtual Identity stringToIdentity (const ::std::string &str) const =0
 Convert a string into an identity. More...
 
virtual ObjectPrx stringToProxy (const ::std::string &str) const =0
 Convert a stringified proxy into a proxy. More...
 
virtual void waitForShutdown ()=0 throw ()
 Wait until the application has called shutdown (or destroy). More...
 
virtual ~Communicator ()
 
- Public Member Functions inherited from Ice::LocalObject
virtual bool operator< (const LocalObject &) const
 
virtual bool operator== (const LocalObject &) const
 
- Public Member Functions inherited from IceUtil::Shared
void __clearFlag (unsigned char flag)
 
virtual void __decRef ()
 
virtual int __getRef () const
 
bool __hasFlag (unsigned char flag)
 
virtual void __incRef ()
 
void __setFlag (unsigned char flag)
 
virtual void __setNoDelete (bool)
 
Sharedoperator= (const Shared &)
 
 Shared ()
 
 Shared (const Shared &)
 
virtual ~Shared ()
 

Additional Inherited Members

- Static Public Attributes inherited from IceUtil::Shared
static const unsigned char NoDelete
 
- Protected Attributes inherited from IceUtil::Shared
unsigned char _flags
 
IceUtilInternal::Atomic _ref
 

Detailed Description

The central object in Ice.

One or more communicators can be instantiated for an Ice application. Communicator instantiation is language-specific, and not specified in Slice code.

See also
Logger
ObjectAdapter
Properties
ValueFactory

Member Typedef Documentation

◆ PointerType

Constructor & Destructor Documentation

◆ ~Communicator()

virtual Ice::Communicator::~Communicator ( )
virtual

Member Function Documentation

◆ addAdminFacet()

virtual void Ice::Communicator::addAdminFacet ( const ObjectPtr servant,
const ::std::string &  facet 
)
pure virtual

Add a new facet to the Admin object.

Adding a servant with a facet that is already registered throws AlreadyRegisteredException.

Parameters
servantThe servant that implements the new Admin facet.
facetThe name of the new Admin facet.

◆ addObjectFactory()

virtual void Ice::Communicator::addObjectFactory ( const ObjectFactoryPtr factory,
const ::std::string &  id 
)
pure virtual

Add an object factory to this communicator.

Installing a factory with an id for which a factory is already registered throws AlreadyRegisteredException.

When unmarshaling an Ice object, the Ice run time reads the most-derived type id off the wire and attempts to create an instance of the type using a factory. If no instance is created, either because no factory was found, or because all factories returned nil, the behavior of the Ice run time depends on the format with which the object was marshaled:

If the object uses the "sliced" format, Ice ascends the class hierarchy until it finds a type that is recognized by a factory, or it reaches the least-derived type. If no factory is found that can create an instance, the run time throws NoValueFactoryException.

If the object uses the "compact" format, Ice immediately raises NoValueFactoryException.

The following order is used to locate a factory for a type:

  1. The Ice run-time looks for a factory registered specifically for the type.

  2. If no instance has been created, the Ice run-time looks for the default factory, which is registered with an empty type id.

  3. If no instance has been created by any of the preceding steps, the Ice run-time looks for a factory that may have been statically generated by the language mapping for non-abstract classes.

Parameters
factoryThe factory to add.
idThe type id for which the factory can create instances, or an empty string for the default factory.
See also
findObjectFactory
ObjectFactory
ValueFactoryManager::add
Deprecated:
addObjectFactory() is deprecated, use ValueFactoryManager::add() instead.

◆ begin_flushBatchRequests() [1/3]

virtual AsyncResultPtr Ice::Communicator::begin_flushBatchRequests ( CompressBatch  compress)
pure virtual

Flush any pending batch requests for this communicator.

This means all batch requests invoked on fixed proxies for all connections associated with the communicator. Any errors that occur while flushing a connection are ignored.

Parameters
compressSpecifies whether or not the queued batch requests should be compressed before being sent over the wire.
Returns
The asynchronous result object for the invocation.

◆ begin_flushBatchRequests() [2/3]

virtual AsyncResultPtr Ice::Communicator::begin_flushBatchRequests ( CompressBatch  compress,
const Callback_Communicator_flushBatchRequestsPtr cb,
const LocalObjectPtr cookie = 0 
)
pure virtual

Flush any pending batch requests for this communicator.

This means all batch requests invoked on fixed proxies for all connections associated with the communicator. Any errors that occur while flushing a connection are ignored.

Parameters
compressSpecifies whether or not the queued batch requests should be compressed before being sent over the wire.
cbCallback to be invoked when the invocation completes
cookieExtra data to associate with the invocation.
Returns
The asynchronous result object for the invocation.

◆ begin_flushBatchRequests() [3/3]

virtual AsyncResultPtr Ice::Communicator::begin_flushBatchRequests ( CompressBatch  compress,
const CallbackPtr cb,
const LocalObjectPtr cookie = 0 
)
pure virtual

Flush any pending batch requests for this communicator.

This means all batch requests invoked on fixed proxies for all connections associated with the communicator. Any errors that occur while flushing a connection are ignored.

Parameters
compressSpecifies whether or not the queued batch requests should be compressed before being sent over the wire.
cbCallback to be invoked when the invocation completes
cookieExtra data to associate with the invocation.
Returns
The asynchronous result object for the invocation.

◆ createAdmin()

virtual ObjectPrx Ice::Communicator::createAdmin ( const ObjectAdapterPtr adminAdapter,
const Identity adminId 
)
pure virtual

Add the Admin object with all its facets to the provided object adapter.

If Ice.Admin.ServerId is set and the provided object adapter has a Locator, createAdmin registers the Admin's Process facet with the Locator's LocatorRegistry.

createAdmin must only be called once; subsequent calls raise InitializationException.

Parameters
adminAdapterThe object adapter used to host the Admin object; if null and Ice.Admin.Endpoints is set, create, activate and use the Ice.Admin object adapter.
adminIdThe identity of the Admin object.
Returns
A proxy to the main ("") facet of the Admin object. Never returns a null proxy.
See also
getAdmin

◆ createObjectAdapter()

virtual ObjectAdapterPtr Ice::Communicator::createObjectAdapter ( const ::std::string &  name)
pure virtual

Create a new object adapter.

The endpoints for the object adapter are taken from the property name.Endpoints.

It is legal to create an object adapter with the empty string as its name. Such an object adapter is accessible via bidirectional connections or by collocated invocations that originate from the same communicator as is used by the adapter.

Attempts to create a named object adapter for which no configuration can be found raise InitializationException.

Parameters
nameThe object adapter name.
Returns
The new object adapter.
See also
createObjectAdapterWithEndpoints
ObjectAdapter
Properties

◆ createObjectAdapterWithEndpoints()

virtual ObjectAdapterPtr Ice::Communicator::createObjectAdapterWithEndpoints ( const ::std::string &  name,
const ::std::string &  endpoints 
)
pure virtual

Create a new object adapter with endpoints.

This operation sets the property name.Endpoints, and then calls createObjectAdapter. It is provided as a convenience function.

Calling this operation with an empty name will result in a UUID being generated for the name.

Parameters
nameThe object adapter name.
endpointsThe endpoints for the object adapter.
Returns
The new object adapter.
See also
createObjectAdapter
ObjectAdapter
Properties

◆ createObjectAdapterWithRouter()

virtual ObjectAdapterPtr Ice::Communicator::createObjectAdapterWithRouter ( const ::std::string &  name,
const RouterPrx rtr 
)
pure virtual

Create a new object adapter with a router.

This operation creates a routed object adapter.

Calling this operation with an empty name will result in a UUID being generated for the name.

Parameters
nameThe object adapter name.
rtrThe router.
Returns
The new object adapter.
See also
createObjectAdapter
ObjectAdapter
Properties

◆ destroy()

virtual void Ice::Communicator::destroy ( )
throw (
)
pure virtual

Destroy the communicator.

This operation calls shutdown implicitly. Calling destroy cleans up memory, and shuts down this communicator's client functionality and destroys all object adapters. Subsequent calls to destroy are ignored.

See also
shutdown
ObjectAdapter::destroy

◆ end_flushBatchRequests()

virtual void Ice::Communicator::end_flushBatchRequests ( const AsyncResultPtr result)
pure virtual

Flush any pending batch requests for this communicator.

This means all batch requests invoked on fixed proxies for all connections associated with the communicator. Any errors that occur while flushing a connection are ignored.

Parameters
resultThe asynchronous result object returned by the begin_ method.

◆ findAdminFacet()

virtual ObjectPtr Ice::Communicator::findAdminFacet ( const ::std::string &  facet)
pure virtual

Returns a facet of the Admin object.

Parameters
facetThe name of the Admin facet.
Returns
The servant associated with this Admin facet, or null if no facet is registered with the given name.

◆ findAllAdminFacets()

virtual FacetMap Ice::Communicator::findAllAdminFacets ( )
pure virtual

Returns a map of all facets of the Admin object.

Returns
A collection containing all the facet names and servants of the Admin object.
See also
findAdminFacet

◆ findObjectFactory()

virtual ObjectFactoryPtr Ice::Communicator::findObjectFactory ( const ::std::string &  id) const
throw (
)
pure virtual

Find an object factory registered with this communicator.

Parameters
idThe type id for which the factory can create instances, or an empty string for the default factory.
Returns
The object factory, or null if no object factory was found for the given id.
See also
addObjectFactory
ObjectFactory
ValueFactoryManager::find
Deprecated:
findObjectFactory() is deprecated, use ValueFactoryManager::find() instead.

◆ flushBatchRequests()

virtual void Ice::Communicator::flushBatchRequests ( CompressBatch  compress)
pure virtual

Flush any pending batch requests for this communicator.

This means all batch requests invoked on fixed proxies for all connections associated with the communicator. Any errors that occur while flushing a connection are ignored.

Parameters
compressSpecifies whether or not the queued batch requests should be compressed before being sent over the wire.

◆ getAdmin()

virtual ObjectPrx Ice::Communicator::getAdmin ( ) const
pure virtual

Get a proxy to the main facet of the Admin object.

getAdmin also creates the Admin object and creates and activates the Ice.Admin object adapter to host this Admin object if Ice.Admin.Enpoints is set. The identity of the Admin object created by getAdmin is {value of Ice.Admin.InstanceName}/admin, or {UUID}/admin when Ice.Admin.InstanceName is not set.

If Ice.Admin.DelayCreation is 0 or not set, getAdmin is called by the communicator initialization, after initialization of all plugins.

Returns
A proxy to the main ("") facet of the Admin object, or a null proxy if no Admin object is configured.
See also
createAdmin

◆ getDefaultLocator()

virtual LocatorPrx Ice::Communicator::getDefaultLocator ( ) const
pure virtual

Get the default locator this communicator.

Returns
The default locator for this communicator.
See also
setDefaultLocator
Locator

◆ getDefaultRouter()

virtual RouterPrx Ice::Communicator::getDefaultRouter ( ) const
pure virtual

Get the default router this communicator.

Returns
The default router for this communicator.
See also
setDefaultRouter
Router

◆ getImplicitContext()

virtual ImplicitContextPtr Ice::Communicator::getImplicitContext ( ) const
throw (
)
pure virtual

Get the implicit context associated with this communicator.

Returns
The implicit context associated with this communicator; returns null when the property Ice.ImplicitContext is not set or is set to None.

◆ getLogger()

virtual LoggerPtr Ice::Communicator::getLogger ( ) const
throw (
)
pure virtual

Get the logger for this communicator.

Returns
This communicator's logger.
See also
Logger

◆ getObserver()

virtual ::Ice::Instrumentation::CommunicatorObserverPtr Ice::Communicator::getObserver ( ) const
throw (
)
pure virtual

Get the observer resolver object for this communicator.

Returns
This communicator's observer resolver object.

◆ getPluginManager()

virtual PluginManagerPtr Ice::Communicator::getPluginManager ( ) const
pure virtual

Get the plug-in manager for this communicator.

Returns
This communicator's plug-in manager.
See also
PluginManager

◆ getProperties()

virtual PropertiesPtr Ice::Communicator::getProperties ( ) const
throw (
)
pure virtual

Get the properties for this communicator.

Returns
This communicator's properties.
See also
Properties

◆ getValueFactoryManager()

virtual ValueFactoryManagerPtr Ice::Communicator::getValueFactoryManager ( ) const
throw (
)
pure virtual

Get the value factory manager for this communicator.

Returns
This communicator's value factory manager.
See also
ValueFactoryManager

◆ identityToString()

virtual ::std::string Ice::Communicator::identityToString ( const Identity ident) const
pure virtual

Convert an identity into a string.

Parameters
identThe identity to convert into a string.
Returns
The "stringified" identity.
See also
stringToIdentity

◆ isShutdown()

virtual bool Ice::Communicator::isShutdown ( ) const
throw (
)
pure virtual

Check whether communicator has been shut down.

Returns
True if the communicator has been shut down; false otherwise.
See also
shutdown

◆ propertyToProxy()

virtual ObjectPrx Ice::Communicator::propertyToProxy ( const ::std::string &  property) const
pure virtual

Convert a set of proxy properties into a proxy.

The "base" name supplied in the property argument refers to a property containing a stringified proxy, such as MyProxy=id:tcp -h localhost -p 10000. Additional properties configure local settings for the proxy, such as MyProxy.PreferSecure=1. The "Properties" appendix in the Ice manual describes each of the supported proxy properties.

Parameters
propertyThe base property name.
Returns
The proxy.

◆ proxyToProperty()

virtual PropertyDict Ice::Communicator::proxyToProperty ( const ObjectPrx proxy,
const ::std::string &  property 
) const
pure virtual

Convert a proxy to a set of proxy properties.

Parameters
proxyThe proxy.
propertyThe base property name.
Returns
The property set.

◆ proxyToString()

virtual ::std::string Ice::Communicator::proxyToString ( const ObjectPrx obj) const
pure virtual

Convert a proxy into a string.

Parameters
objThe proxy to convert into a stringified proxy.
Returns
The stringified proxy, or an empty string if obj is nil.
See also
stringToProxy

◆ removeAdminFacet()

virtual ObjectPtr Ice::Communicator::removeAdminFacet ( const ::std::string &  facet)
pure virtual

Remove the following facet to the Admin object.

Removing a facet that was not previously registered throws NotRegisteredException.

Parameters
facetThe name of the Admin facet.
Returns
The servant associated with this Admin facet.

◆ setDefaultLocator()

virtual void Ice::Communicator::setDefaultLocator ( const LocatorPrx loc)
pure virtual

Set a default Ice locator for this communicator.

All newly created proxy and object adapters will use this default locator. To disable the default locator, null can be used. Note that this operation has no effect on existing proxies or object adapters.

You can also set a locator for an individual proxy by calling the operation ice_locator on the proxy, or for an object adapter by calling ObjectAdapter#setLocator on the object adapter.

Parameters
locThe default locator to use for this communicator.
See also
getDefaultLocator
Locator
ObjectAdapter::setLocator

◆ setDefaultRouter()

virtual void Ice::Communicator::setDefaultRouter ( const RouterPrx rtr)
pure virtual

Set a default router for this communicator.

All newly created proxies will use this default router. To disable the default router, null can be used. Note that this operation has no effect on existing proxies.

You can also set a router for an individual proxy by calling the operation ice_router on the proxy.

Parameters
rtrThe default router to use for this communicator.
See also
getDefaultRouter
createObjectAdapterWithRouter
Router

◆ shutdown()

virtual void Ice::Communicator::shutdown ( )
throw (
)
pure virtual

Shuts down this communicator's server functionality, which includes the deactivation of all object adapters.

Attempts to use a deactivated object adapter raise ObjectAdapterDeactivatedException. Subsequent calls to shutdown are ignored.

After shutdown returns, no new requests are processed. However, requests that have been started before shutdown was called might still be active. You can use waitForShutdown to wait for the completion of all requests.

See also
destroy
waitForShutdown
ObjectAdapter::deactivate

◆ stringToIdentity()

virtual Identity Ice::Communicator::stringToIdentity ( const ::std::string &  str) const
pure virtual

Convert a string into an identity.

If the string does not parse correctly, the operation throws IdentityParseException.

Parameters
strThe string to convert into an identity.
Returns
The identity.
See also
identityToString
Deprecated:
stringToIdentity() is deprecated, use the static stringToIdentity() method instead.

◆ stringToProxy()

virtual ObjectPrx Ice::Communicator::stringToProxy ( const ::std::string &  str) const
pure virtual

Convert a stringified proxy into a proxy.

For example, MyCategory/MyObject:tcp -h some_host -p 10000 creates a proxy that refers to the Ice object having an identity with a name "MyObject" and a category "MyCategory", with the server running on host "some_host", port 10000. If the stringified proxy does not parse correctly, the operation throws one of ProxyParseException, EndpointParseException, or IdentityParseException. Refer to the Ice manual for a detailed description of the syntax supported by stringified proxies.

Parameters
strThe stringified proxy to convert into a proxy.
Returns
The proxy, or nil if str is an empty string.
See also
proxyToString

◆ waitForShutdown()

virtual void Ice::Communicator::waitForShutdown ( )
throw (
)
pure virtual

Wait until the application has called shutdown (or destroy).

On the server side, this operation blocks the calling thread until all currently-executing operations have completed. On the client side, the operation simply blocks until another thread has called shutdown or destroy.

A typical use of this operation is to call it from the main thread, which then waits until some other thread calls shutdown. After shut-down is complete, the main thread returns and can do some cleanup work before it finally calls destroy to shut down the client functionality, and then exits the application.

See also
shutdown
destroy
ObjectAdapter::waitForDeactivate

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