3#ifndef ICE_COMMUNICATOR_H
4#define ICE_COMMUNICATOR_H
6#include "CommunicatorF.h"
10#include "ImplicitContext.h"
11#include "Initialize.h"
14#include "Properties.h"
16#include "SSL/ServerAuthenticationOptions.h"
34 class ICE_API Communicator final :
public std::enable_shared_from_this<Communicator>
84 template<typename Prx =
ObjectPrx, std::enable_if_t<std::is_base_of_v<
ObjectPrx, Prx>,
bool> = true>
87 auto reference = _stringToProxy(str);
90 return Prx::_fromReference(reference);
110 template<
typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>,
bool> = true>
113 auto reference = _propertyToProxy(property);
116 return Prx::_fromReference(reference);
150 std::optional<SSL::ServerAuthenticationOptions> serverAuthenticationOptions = std::nullopt);
167 std::string_view endpoints,
168 std::optional<SSL::ServerAuthenticationOptions> serverAuthenticationOptions = std::nullopt);
270 std::function<
void(std::exception_ptr)> exception,
271 std::function<
void(
bool)> sent =
nullptr);
319 template<typename T =
Object, std::enable_if_t<std::is_base_of_v<
Object, T>,
bool> = true>
322 return std::dynamic_pointer_cast<T>(_findAdminFacet(facet));
331 Communicator() =
default;
336 void finishSetup(
int&,
const char*[]);
338 [[nodiscard]] IceInternal::ReferencePtr _stringToProxy(std::string_view str)
const;
339 [[nodiscard]] IceInternal::ReferencePtr _propertyToProxy(std::string_view property)
const;
340 [[nodiscard]]
ObjectPtr _findAdminFacet(std::string_view facet);
347 friend ICE_API_FRIEND IceInternal::InstancePtr IceInternal::getInstance(
const Ice::CommunicatorPtr&);
348 friend ICE_API_FRIEND IceInternal::TimerPtr IceInternal::getInstanceTimer(
const Ice::CommunicatorPtr&);
350 const IceInternal::InstancePtr _instance;
392 explicit operator bool() const noexcept {
return _communicator !=
nullptr; }
CommunicatorHolder(CommunicatorHolder &&other)=default
Move constructor.
CommunicatorHolder & operator=(CommunicatorHolder &&holder) noexcept
Move assignment operator.
const CommunicatorPtr & operator->() const noexcept
Gets the communicator.
CommunicatorHolder & operator=(CommunicatorPtr communicator) noexcept
Assignment operator.
CommunicatorPtr release() noexcept
Gets the communicator and clears the reference held by the holder.
CommunicatorHolder()=default
Default constructor.
CommunicatorHolder(T &&... args)
Constructs a CommunicatorHolder for a new communicator created using an Ice::initialize overload.
CommunicatorHolder(CommunicatorPtr communicator) noexcept
Constructs a CommunicatorHolder that adopts an existing communicator.
const CommunicatorPtr & communicator() const noexcept
Gets the communicator.
A helper class that uses Resource Acquisition Is Initialization (RAII) to hold a communicator instanc...
void waitForShutdown() noexcept
Waits for shutdown to complete.
void setDefaultLocator(const std::optional< LocatorPrx > &loc)
Sets the default locator of this communicator.
ObjectAdapterPtr createObjectAdapter(std::string name, std::optional< SSL::ServerAuthenticationOptions > serverAuthenticationOptions=std::nullopt)
Creates a new object adapter.
void setDefaultObjectAdapter(ObjectAdapterPtr adapter)
Sets the object adapter that will be associated with new outgoing connections created by this communi...
std::optional< Ice::LocatorPrx > getDefaultLocator() const
Gets the default locator of this communicator.
std::string identityToString(const Identity &ident) const
Converts an identity into a string.
std::string proxyToString(const std::optional< ObjectPrx > &obj) const
Converts a proxy into a string.
void flushBatchRequests(CompressBatch compress)
Flushes any pending batch requests of this communicator.
ObjectAdapterPtr getDefaultObjectAdapter() const
Gets the object adapter that is associated by default with new outgoing connections created by this c...
PluginManagerPtr getPluginManager() const
Gets the plug-in manager of this communicator.
void waitForShutdownAsync(std::function< void()> completed) noexcept
Waits until this communicator is shut down.
std::function< void()> flushBatchRequestsAsync(CompressBatch compress, std::function< void(std::exception_ptr)> exception, std::function< void(bool)> sent=nullptr)
Flushes any pending batch requests of this communicator.
ObjectAdapterPtr createObjectAdapterWithEndpoints(std::string name, std::string_view endpoints, std::optional< SSL::ServerAuthenticationOptions > serverAuthenticationOptions=std::nullopt)
Creates a new object adapter with endpoints.
std::shared_ptr< T > findAdminFacet(std::string_view facet)
Returns a facet of the Admin object.
ObjectPrx createAdmin(const ObjectAdapterPtr &adminAdapter, const Identity &adminId)
Adds the Admin object with all its facets to the provided object adapter.
FacetMap findAllAdminFacets()
Returns a map of all facets of the Admin object.
ObjectPtr removeAdminFacet(std::string_view facet)
Removes a facet from the Admin object.
std::optional< RouterPrx > getDefaultRouter() const
Gets the default router of this communicator.
Instrumentation::CommunicatorObserverPtr getObserver() const noexcept
Gets the observer object of this communicator.
ObjectAdapterPtr createObjectAdapterWithRouter(std::string name, RouterPrx rtr)
Creates a new object adapter with a router.
PropertyDict proxyToProperty(const std::optional< ObjectPrx > &proxy, std::string property) const
Converts a proxy into a set of proxy properties.
void shutdown() noexcept
Shuts down this communicator.
std::optional< Prx > propertyToProxy(std::string_view property) const
Converts a set of proxy properties into a proxy.
void destroyAsync(std::function< void()> completed) noexcept
Destroys this communicator asynchronously.
std::optional< Prx > stringToProxy(std::string_view str) const
Converts a stringified proxy into a proxy.
std::optional< ObjectPrx > getAdmin() const
Gets a proxy to the main facet of the Admin object.
ImplicitContextPtr getImplicitContext() const noexcept
Gets the implicit context associated with this communicator.
void addSliceLoader(SliceLoaderPtr loader) noexcept
Adds a Slice loader to this communicator, after the Slice loader set in InitializationData (if any) a...
void addAdminFacet(ObjectPtr servant, std::string facet)
Adds a new facet to the Admin object.
void setDefaultRouter(const std::optional< RouterPrx > &rtr)
Sets the default router of this communicator.
PropertiesPtr getProperties() const noexcept
Gets the properties of this communicator.
void destroy() noexcept
Destroys this communicator.
bool isShutdown() const noexcept
Checks whether or not shutdown was called on this communicator.
LoggerPtr getLogger() const noexcept
Gets the logger of this communicator.
Client applications use the Locator object to resolve Ice indirect proxies.
The base class for all Ice proxies.
The base class for servants.
Represents an intermediary object that routes requests and replies between clients and Ice objects th...
Observers for objects created by the Ice runtime.
std::shared_ptr< Communicator > CommunicatorPtr
A shared pointer to a Communicator.
std::shared_ptr< ObjectAdapter > ObjectAdapterPtr
A shared pointer to an ObjectAdapter.
std::shared_ptr< Properties > PropertiesPtr
A shared pointer to a Properties.
std::shared_ptr< SliceLoader > SliceLoaderPtr
A shared pointer to a SliceLoader.
std::shared_ptr< PluginManager > PluginManagerPtr
A shared pointer to a PluginManager.
std::shared_ptr< Logger > LoggerPtr
A shared pointer to a Logger.
std::shared_ptr< Object > ObjectPtr
A shared pointer to an Object.
std::shared_ptr< ImplicitContext > ImplicitContextPtr
A shared pointer to an ImplicitContext.
CommunicatorPtr initialize(int &argc, const char *argv[], InitializationData initData={})
Creates a new communicator.
std::map< std::string, std::string, std::less<> > PropertyDict
A simple collection of properties, represented as a dictionary of key/value pairs.
CompressBatch
Represents batch compression options when flushing queued batch requests.
std::map< std::string, ObjectPtr, std::less<> > FacetMap
A mapping from facet name to servant.
Represents the identity of an Ice object.
Represents a set of options that you can specify when initializing a communicator.