Intra2net AG

libt2n::T2nSingletonWrapper< Client > Class Template Reference

wrap calls to server-side-functions with different error-handling strategies More...

#include <client_wrapper.hxx>

Inheritance diagram for libt2n::T2nSingletonWrapper< Client >:
Inheritance graph
[legend]

List of all members.

Static Public Member Functions

static void set_connection (std::auto_ptr< ConnectionWrapper > wrappedConnection)
 tell the wrapper which connection to use
static ConnectionWrapperget_connection_wrapper (void)
 return a pointer to the ConnectionWrapper currently in use
static void ensure_singleton_there (void)
 manually establish the connection without actually executing a call

Static Protected Attributes

static const char * NotInitializedMessage = "T2nSingletonWrapper used before setting initializing connection"

Private Member Functions

 T2nSingletonWrapper (std::auto_ptr< Client > stub)

Static Private Member Functions

static void init ()
template<typename R >
static detail::TypeWrap< R >::type real_exec (boost::function< R(Client *) > f)

Private Attributes

std::auto_ptr< Client > Stub

Static Private Attributes

static std::auto_ptr
< T2nSingletonWrapper
SingletonObject
static std::auto_ptr
< ConnectionWrapper
WrappedConnection

Detailed Description

template<class Client>
class libt2n::T2nSingletonWrapper< Client >

wrap calls to server-side-functions with different error-handling strategies

Template class to access a process-wide singleton server-connection and to wrap all calls using this connection with an error-handling strategy (e.g. to reconnect when the connection broke). The source looks very complicated due to heavy use of templates, look at the 3rd codegen example to see how to use it.

Example
Calling remote methods is usually done via t2n_exec, this saves you from always specifying which T2nSingletonWrapper-template to use when calling T2nSingletonWrapper::exec
    t2n_exec(&cmd_group_t2nexample_client::testfunc)("the answer is %d",42)

Constructor & Destructor Documentation

template<class Client >
libt2n::T2nSingletonWrapper< Client >::T2nSingletonWrapper ( std::auto_ptr< Client >  stub  )  [inline, private]

Member Function Documentation

template<class Client >
static void libt2n::T2nSingletonWrapper< Client >::ensure_singleton_there ( void   )  [inline, static]
template<class Client >
static ConnectionWrapper* libt2n::T2nSingletonWrapper< Client >::get_connection_wrapper ( void   )  [inline, static]

return a pointer to the ConnectionWrapper currently in use

References libt2n::T2nSingletonWrapper< Client >::WrappedConnection.

template<class Client >
static void libt2n::T2nSingletonWrapper< Client >::init (  )  [inline, static, private]
template<class Client >
template<typename R >
static detail::TypeWrap<R>::type libt2n::T2nSingletonWrapper< Client >::real_exec ( boost::function< R(Client *) >  f  )  [inline, static, private]
template<class Client >
static void libt2n::T2nSingletonWrapper< Client >::set_connection ( std::auto_ptr< ConnectionWrapper wrappedConnection  )  [inline, static]

tell the wrapper which connection to use

Parameters:
wrappedConnection the connection to establish when needed

References libt2n::T2nSingletonWrapper< Client >::SingletonObject, and libt2n::T2nSingletonWrapper< Client >::WrappedConnection.


Member Data Documentation

const char * libt2n::T2nSingletonWrapperMessages::NotInitializedMessage = "T2nSingletonWrapper used before setting initializing connection" [static, protected, inherited]
template<class Client >
std::auto_ptr<T2nSingletonWrapper> libt2n::T2nSingletonWrapper< Client >::SingletonObject [static, private]
template<class Client >
std::auto_ptr<Client> libt2n::T2nSingletonWrapper< Client >::Stub [private]
template<class Client >
std::auto_ptr<ConnectionWrapper> libt2n::T2nSingletonWrapper< Client >::WrappedConnection [static, private]

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

Generated on 13 May 2015 by  doxygen 1.6.1
© Intra2net AG 2024 | Legal | Contact