Intra2net AG

libt2n::ConnectionWrapper Class Reference

provide access to client_connection singletons and call-handling function More...

#include <client_wrapper.hxx>

Inheritance diagram for libt2n::ConnectionWrapper:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ConnectionWrapper ()
virtual ~ConnectionWrapper ()
virtual client_connectionget_connection ()=0
 return active connection, create new one if not existing
virtual bool handle (command_client *stubBase, boost::function< void() > f)
 this function is called on every execution of a method on a server
long long get_command_timeout_usec (void)
void set_command_timeout_usec (long long _command_timeout_usec)
long long get_hello_timeout_usec (void)
void set_hello_timeout_usec (long long _hello_timeout_usec)
virtual void set_logging (std::ostream *_logstream, log_level_values _log_level)
 activate logging to the given stream. everything above the given level is logged.
std::ostream * get_logstream (log_level_values level)
 get pointer to logging stream, returns NULL if no logging needed

Protected Member Functions

void set_logging_on_connection (client_connection &c)
 always call this when you got a new connection to transfer logging settings

Protected Attributes

log_level_values log_level
std::ostream * logstream

Private Attributes

long long command_timeout_usec
long long hello_timeout_usec

Detailed Description

provide access to client_connection singletons and call-handling function

This is an abstact base class for use with T2nSingletonWrapper. It provides access to the singleton-client_connection and offers a handle-method which is used for every call to a method on a t2n-server.


Constructor & Destructor Documentation

libt2n::ConnectionWrapper::ConnectionWrapper (  )  [inline]
virtual libt2n::ConnectionWrapper::~ConnectionWrapper (  )  [inline, virtual]

Member Function Documentation

long long libt2n::ConnectionWrapper::get_command_timeout_usec ( void   )  [inline]

References command_timeout_usec.

virtual client_connection* libt2n::ConnectionWrapper::get_connection (  )  [pure virtual]

return active connection, create new one if not existing

Return a pointer to an active client_connection. Use detail-data stored within the derived class to create a new connection if needed, otherwise return an alredy active connection. The derived class has to take care of destroying the connection when not needed anymore.

Implemented in libt2n::BasicSocketWrapper, and libt2n::ReconnectIgnoreFailureSocketWrapper.

long long libt2n::ConnectionWrapper::get_hello_timeout_usec ( void   )  [inline]

References hello_timeout_usec.

std::ostream * libt2n::ConnectionWrapper::get_logstream ( log_level_values  level  ) 

get pointer to logging stream, returns NULL if no logging needed

References log_level, and logstream.

virtual bool libt2n::ConnectionWrapper::handle ( command_client stubBase,
boost::function< void() >  f 
) [inline, virtual]

this function is called on every execution of a method on a server

Parameters:
stubBase pointer to the command_client executing the call
f boost::function object containing the method to call and all parameters
Return values:
true if the call was successful and the original return-value of the called function can be used false if T2nSingletonWrapper has to create a return-value with the default-constructor

T2nSingletonWrapper will call this function on every execution of a server-side method. This version will just call the function without any special treatment. You can overload this function to implement different error handling strategies.

Reimplemented in libt2n::ReconnectSocketWrapper, and libt2n::ReconnectIgnoreFailureSocketWrapper.

void libt2n::ConnectionWrapper::set_command_timeout_usec ( long long  _command_timeout_usec  )  [inline]

References command_timeout_usec.

void libt2n::ConnectionWrapper::set_hello_timeout_usec ( long long  _hello_timeout_usec  )  [inline]

References hello_timeout_usec.

void libt2n::ConnectionWrapper::set_logging ( std::ostream *  _logstream,
log_level_values  _log_level 
) [virtual]

activate logging to the given stream. everything above the given level is logged.

Reimplemented in libt2n::BasicSocketWrapper.

References log_level, and logstream.

void libt2n::ConnectionWrapper::set_logging_on_connection ( client_connection c  )  [protected]

always call this when you got a new connection to transfer logging settings

References log_level, logstream, libt2n::none, and libt2n::client_connection::set_logging().


Member Data Documentation

std::ostream* libt2n::ConnectionWrapper::logstream [protected]

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

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