Ice 3.7 C++11 API Reference
Public Member Functions | List of all members
Ice::CommunicatorHolder Class Reference

A helper class that uses Resource Acquisition Is Initialization (RAII) to initialize and hold a communicator instance, and automatically destroy the communicator when the holder goes out of scope. More...

#include <Ice/Ice.h>

Public Member Functions

const CommunicatorPtr & communicator () const
 Obtains the communicator instance. More...
 
 CommunicatorHolder ()
 The holder's initial state is empty. More...
 
 CommunicatorHolder (CommunicatorHolder &&)=default
 
 CommunicatorHolder (const CommunicatorHolder &)=delete
 
 CommunicatorHolder (std::shared_ptr< Communicator > communicator)
 Adopts the given communicator. More...
 
template<class... T>
 CommunicatorHolder (T &&... args)
 Calls initialize to create a communicator with the provided arguments. More...
 
 operator bool () const
 Determines whether the holder contains an instance. More...
 
const CommunicatorPtr & operator-> () const
 Obtains the communicator instance. More...
 
CommunicatorHolderoperator= (CommunicatorHolder &&holder) noexcept
 Adopts the communicator in the given holder. More...
 
CommunicatorHolderoperator= (std::shared_ptr< Communicator > communicator)
 Adopts the given communicator. More...
 
CommunicatorPtr release ()
 Obtains the communicator instance and clears the reference held by the holder. More...
 
 ~CommunicatorHolder ()
 

Detailed Description

A helper class that uses Resource Acquisition Is Initialization (RAII) to initialize and hold a communicator instance, and automatically destroy the communicator when the holder goes out of scope.

Constructor & Destructor Documentation

◆ CommunicatorHolder() [1/5]

Ice::CommunicatorHolder::CommunicatorHolder ( )

The holder's initial state is empty.

◆ CommunicatorHolder() [2/5]

template<class... T>
Ice::CommunicatorHolder::CommunicatorHolder ( T &&...  args)
inlineexplicit

Calls initialize to create a communicator with the provided arguments.

This constructor accepts all of the same overloaded argument styles as initialize.

◆ CommunicatorHolder() [3/5]

Ice::CommunicatorHolder::CommunicatorHolder ( std::shared_ptr< Communicator communicator)

Adopts the given communicator.

Parameters
communicatorThe new communicator instance to hold.

◆ CommunicatorHolder() [4/5]

Ice::CommunicatorHolder::CommunicatorHolder ( const CommunicatorHolder )
delete

◆ CommunicatorHolder() [5/5]

Ice::CommunicatorHolder::CommunicatorHolder ( CommunicatorHolder &&  )
default

◆ ~CommunicatorHolder()

Ice::CommunicatorHolder::~CommunicatorHolder ( )

Member Function Documentation

◆ communicator()

const CommunicatorPtr& Ice::CommunicatorHolder::communicator ( ) const

Obtains the communicator instance.

Returns
The communicator held by this holder, or nil if the holder is empty.

◆ operator bool()

Ice::CommunicatorHolder::operator bool ( ) const
explicit

Determines whether the holder contains an instance.

Returns
True if the holder currently holds an instance, false otherwise.

◆ operator->()

const CommunicatorPtr& Ice::CommunicatorHolder::operator-> ( ) const

Obtains the communicator instance.

Returns
The communicator held by this holder, or nil if the holder is empty.

◆ operator=() [1/2]

CommunicatorHolder& Ice::CommunicatorHolder::operator= ( CommunicatorHolder &&  holder)
noexcept

Adopts the communicator in the given holder.

If this holder currently holds a communicator, it will be destroyed.

Parameters
holderThe holder from which to adopt a communicator.

◆ operator=() [2/2]

CommunicatorHolder& Ice::CommunicatorHolder::operator= ( std::shared_ptr< Communicator communicator)

Adopts the given communicator.

If this holder currently holds a communicator, it will be destroyed.

Parameters
communicatorThe new communicator instance to hold.

◆ release()

CommunicatorPtr Ice::CommunicatorHolder::release ( )

Obtains the communicator instance and clears the reference held by the holder.

Returns
The communicator held by this holder, or nil if the holder is empty.

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