X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fclient_wrapper.hxx;h=4bd15406b853e04d099b446704a3658b0a0d15df;hp=0822af073b47e77b978b17e8f7de7908193a9e56;hb=ffbbf9abeb195a4017c1ede383cc9ab906aa4a0c;hpb=0ea6d528901a0eeb0fce1c2a71ae69c277798142 diff --git a/src/client_wrapper.hxx b/src/client_wrapper.hxx index 0822af0..4bd1540 100644 --- a/src/client_wrapper.hxx +++ b/src/client_wrapper.hxx @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -150,14 +149,21 @@ class T2nSingletonWrapper : public T2nSingletonWrapperMessages #undef _GEN_PREP #undef _GEN_ARG - T2nSingletonWrapper() + T2nSingletonWrapper(std::auto_ptr stub) + { + Stub=stub; + } + + static void init() { if (WrappedConnection.get() == NULL) throw std::logic_error(NotInitializedMessage); - Stub=std::auto_ptr(new Client(*(WrappedConnection->get_connection()), + std::auto_ptr stub(new Client(*(WrappedConnection->get_connection()), WrappedConnection->get_command_timeout_usec(), WrappedConnection->get_hello_timeout_usec())); + + SingletonObject=std::auto_ptr(new T2nSingletonWrapper(stub)); } template< typename R > @@ -188,7 +194,7 @@ class T2nSingletonWrapper : public T2nSingletonWrapperMessages static void ensure_singleton_there(void) { if (SingletonObject.get() == NULL) - SingletonObject=std::auto_ptr(new T2nSingletonWrapper()); + init(); } // create an exec-method for each possible number of parameters