VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Gv::ClientHolder< TFactory, TClient > Class Template Reference

Manages a network client object so that the network client is automatically re-created from a factory when it finishes, or alternatively the event loop is quit()ed. More...

#include <gvclientholder.h>

+ Inheritance diagram for Gv::ClientHolder< TFactory, TClient >:

Public Member Functions

 ClientHolder (TFactory &factory, bool once=false, bool(*quit_test_fn)(std::string)=nullptr, unsigned int reconnect_timeout=1U)
 Constructor that creates a network client object from a factory. More...
 
 ~ClientHolder ()
 Destructor.
 
- Public Member Functions inherited from GNet::TimerBase
virtual ~TimerBase ()
 Destructor.
 
void startTimer (unsigned int interval_s, unsigned int interval_us=0U)
 Starts the timer so that it goes off after the given time interval. More...
 
void startTimer (const G::EpochTime &interval_time)
 Overload for an interval expressed as an G::EpochTime.
 
void cancelTimer ()
 Cancels the timer.
 
bool active () const
 Returns true if the timer is started and not cancelled.
 
bool immediate () const
 Returns true if the timer is active() and zero-length.
 

Additional Inherited Members

- Protected Member Functions inherited from GNet::TimerBase
 TimerBase ()
 Default constructor.
 
- Protected Member Functions inherited from GNet::EventExceptionHandler
virtual ~EventExceptionHandler ()
 Destructor.
 

Detailed Description

template<typename TFactory, typename TClient>
class Gv::ClientHolder< TFactory, TClient >

Manages a network client object so that the network client is automatically re-created from a factory when it finishes, or alternatively the event loop is quit()ed.

Definition at line 40 of file gvclientholder.h.

Constructor & Destructor Documentation

template<typename TFactory , typename TClient >
Gv::ClientHolder< TFactory, TClient >::ClientHolder ( TFactory &  factory,
bool  once = false,
bool(*)(std::string)  quit_test_fn = nullptr,
unsigned int  reconnect_timeout = 1U 
)
explicit

Constructor that creates a network client object from a factory.

The quit-test function should return true if the onDone() reason is a fatal error rather than a retryable connection failure. The default quit-test function is one that always returns false.

If the once flag is true then the onDone() event handler quit()s the event loop if the client was previously successfully connected. Otherwise the onDone() event handler calls the quit-test function. If it returns true then the event loop is quit()ed, otherwise the reconnect timer is started.

Definition at line 78 of file gvclientholder.h.


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