winss
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
winss::PipeClient< TInstance, TListener > Class Template Reference

Base named pipe client. More...

#include <pipe_client.hpp>

Collaboration diagram for winss::PipeClient< TInstance, TListener >:
Collaboration graph
[legend]

Public Member Functions

 PipeClient (const PipeClientConfig &config)
 Creates a pipe client with the given config. More...
 
 PipeClient (const PipeClient &)=delete
 No copy. More...
 
 PipeClient (PipeClient &&)=delete
 No move. More...
 
virtual void AddListener (winss::NotOwningPtr< TListener > listener)
 Add a listener to the client. More...
 
virtual bool IsStopping () const
 Gets if the pipe client is stopping. More...
 
virtual void Connect ()
 Start the connection process to the pipe server. More...
 
virtual void Stop ()
 Stop the pipe client. More...
 
PipeClientoperator= (const PipeClient &)=delete
 No copy. More...
 
PipeClientoperator= (PipeClient &&)=delete
 No move. More...
 
virtual ~PipeClient ()
 Close the pipe client and notify listeners. More...
 

Protected Member Functions

virtual void Triggered ()
 Called when an event is triggered. More...
 
virtual void Connected ()
 Called when the client is connected. More...
 
void TellAll (const std::function< bool(TListener &)> &func)
 Call a function against all listeners. More...
 
void Triggered (const winss::HandleWrapper &handle)
 Event handler for the pipe client. More...
 

Protected Attributes

bool stopping = false
 
TInstance instance
 Marked if stopping the client. More...
 
winss::PipeName pipe_name
 The pipe instance. More...
 
winss::NotOwningPtr< winss::WaitMultiplexermultiplexer
 The event multiplexer for the pipe client. More...
 
std::vector< winss::NotOwningPtr< TListener > > listeners
 Listeners for the pipe client. More...
 

Detailed Description

template<typename TInstance, typename TListener>
class winss::PipeClient< TInstance, TListener >

Base named pipe client.

This class should be specialized as a inbound or outbound pipe client.

Template Parameters
TInstanceThe named pipe instance implementation.
TListenerThe type of pipe listener.

Constructor & Destructor Documentation

template<typename TInstance, typename TListener>
winss::PipeClient< TInstance, TListener >::PipeClient ( const PipeClientConfig config)
inlineexplicit

Creates a pipe client with the given config.

Parameters
configThe pipe client confog.
template<typename TInstance, typename TListener>
winss::PipeClient< TInstance, TListener >::PipeClient ( const PipeClient< TInstance, TListener > &  )
delete

No copy.

template<typename TInstance, typename TListener>
winss::PipeClient< TInstance, TListener >::PipeClient ( PipeClient< TInstance, TListener > &&  )
delete

No move.

template<typename TInstance, typename TListener>
virtual winss::PipeClient< TInstance, TListener >::~PipeClient ( )
inlinevirtual

Close the pipe client and notify listeners.

Member Function Documentation

template<typename TInstance, typename TListener>
virtual void winss::PipeClient< TInstance, TListener >::AddListener ( winss::NotOwningPtr< TListener >  listener)
inlinevirtual

Add a listener to the client.

Parameters
listenerThe pipe client listener.

Referenced by winss::InboundControlItem::InboundControlItem(), and winss::OutboundControlItem::OutboundControlItem().

template<typename TInstance, typename TListener>
virtual void winss::PipeClient< TInstance, TListener >::Connect ( )
inlinevirtual

Start the connection process to the pipe server.

template<typename TInstance, typename TListener>
virtual void winss::PipeClient< TInstance, TListener >::Connected ( )
inlineprotectedvirtual

Called when the client is connected.

template<typename TInstance, typename TListener>
virtual bool winss::PipeClient< TInstance, TListener >::IsStopping ( ) const
inlinevirtual

Gets if the pipe client is stopping.

Returns
True if the pipe client is stopping otherwise false.
template<typename TInstance, typename TListener>
PipeClient& winss::PipeClient< TInstance, TListener >::operator= ( const PipeClient< TInstance, TListener > &  )
delete

No copy.

template<typename TInstance, typename TListener>
PipeClient& winss::PipeClient< TInstance, TListener >::operator= ( PipeClient< TInstance, TListener > &&  )
delete

No move.

template<typename TInstance, typename TListener>
virtual void winss::PipeClient< TInstance, TListener >::Stop ( )
inlinevirtual

Stop the pipe client.

template<typename TInstance, typename TListener>
void winss::PipeClient< TInstance, TListener >::TellAll ( const std::function< bool(TListener &)> &  func)
inlineprotected

Call a function against all listeners.

Parameters
funcThe function to invoke against all listeners.
template<typename TInstance, typename TListener>
virtual void winss::PipeClient< TInstance, TListener >::Triggered ( )
inlineprotectedvirtual

Called when an event is triggered.

template<typename TInstance, typename TListener>
void winss::PipeClient< TInstance, TListener >::Triggered ( const winss::HandleWrapper handle)
inlineprotected

Event handler for the pipe client.

Parameters
handleThe handle which triggered the event.

Member Data Documentation

template<typename TInstance, typename TListener>
TInstance winss::PipeClient< TInstance, TListener >::instance
protected

Marked if stopping the client.

template<typename TInstance, typename TListener>
std::vector<winss::NotOwningPtr<TListener> > winss::PipeClient< TInstance, TListener >::listeners
protected

Listeners for the pipe client.

template<typename TInstance, typename TListener>
winss::NotOwningPtr<winss::WaitMultiplexer> winss::PipeClient< TInstance, TListener >::multiplexer
protected

The event multiplexer for the pipe client.

template<typename TInstance, typename TListener>
winss::PipeName winss::PipeClient< TInstance, TListener >::pipe_name
protected

The pipe instance.

template<typename TInstance, typename TListener>
bool winss::PipeClient< TInstance, TListener >::stopping = false
protected

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