AMPS C/C++ Client Class Reference AMPS C/C++ Client Version 5.3.5.7

Public Member Functions | List of all members
AMPS::ServerChooserImpl Class Referenceabstract

Abstract base class for choosing amongst multiple URIs for both the initial connection and reconnection. More...

`#include <ServerChooserImpl.hpp>`

Inheritance diagram for AMPS::ServerChooserImpl:

## Public Member Functions
virtual std::string | getCurrentURI ()=0
| Returns the current URI. More...
virtual Authenticator & | getCurrentAuthenticator ()=0
| Returns the Authenticator instance associated with the current URI. More...
virtual void | reportFailure (const AMPSException &exception_, const ConnectionInfo &info_)=0
| Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on. More...
virtual std::string | getError ()
| Called by HAClient when no servers are available to provide detailed error message in exception message. More...
virtual void | reportSuccess (const ConnectionInfo &info_)=0
| Called by the HAClient when successfully connected and logged on to the current instance. More...
virtual void | add (const std::string &uri_)=0
| Add a server to a server chooser if its policy permits. More...
virtual void | remove (const std::string &uri_)=0
| Remove a server from a server chooser if its policy permits. More...

## Detailed Description

Abstract base class for choosing amongst multiple URIs for both the initial connection and reconnection.

Used by HAClient to pick an initial server and also to pick a server if there is a failure.

## Member Function Documentation

## ◆ add()

virtual void AMPS::ServerChooserImpl::add | ( | const std::string & | uri_ | ) |
| pure virtual

Add a server to a server chooser if its policy permits.

Parameters

  uri_ | The URI of the server to add

Implemented in AMPS::DefaultServerChooser.

## ◆ getCurrentAuthenticator()

virtual Authenticator& AMPS::ServerChooserImpl::getCurrentAuthenticator | ( |  | ) |
| pure virtual

Returns the Authenticator instance associated with the current URI.

Returns
  An Authenticator or NULL if none is required for logon.

Implemented in AMPS::DefaultServerChooser.

## ◆ getCurrentURI()

virtual std::string AMPS::ServerChooserImpl::getCurrentURI | ( |  | ) |
| pure virtual

Returns the current URI.

Returns
  The current URI or empty string if no server is available.

Implemented in AMPS::DefaultServerChooser.

## ◆ getError()

virtual std::string AMPS::ServerChooserImpl::getError | ( |  | ) |
| inline virtual

Called by HAClient when no servers are available to provide detailed error message in exception message.

Returns
  The detailed error message.

Reimplemented in AMPS::DefaultServerChooser.

## ◆ remove()

virtual void AMPS::ServerChooserImpl::remove | ( | const std::string & | uri_ | ) |
| pure virtual

Remove a server from a server chooser if its policy permits.

Parameters

  uri_ | The URI of the server to remove

Implemented in AMPS::DefaultServerChooser.

## ◆ reportFailure()

virtual void AMPS::ServerChooserImpl::reportFailure | ( | const AMPSException & | exception_,
|  | const ConnectionInfo & | info_
| ) |  |
| pure virtual

Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on.

Implementors will likely advance the current URI to the next one in a list, or choose to stay with the current one, based on the exception type.

Parameters

  exception_ | The exception associated with the failure.
  info_ | The information about the connection that failed.

Implemented in AMPS::DefaultServerChooser.

## ◆ reportSuccess()

virtual void AMPS::ServerChooserImpl::reportSuccess | ( | const ConnectionInfo & | info_ | ) |
| pure virtual

Called by the HAClient when successfully connected and logged on to the current instance.

Parameters

  info_ | The information about the connection that failed.

Implemented in AMPS::DefaultServerChooser.

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

- include/amps/ServerChooserImpl.hpp