winss
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
winss::PipeServer< TPipeInstance > Class Template Reference

Base named pipe server. More...

#include <pipe_server.hpp>

Inheritance diagram for winss::PipeServer< TPipeInstance >:
Inheritance graph
[legend]
Collaboration diagram for winss::PipeServer< TPipeInstance >:
Collaboration graph
[legend]

Public Member Functions

 PipeServer (const PipeServerConfig &config)
 Create a new pipe instance with the given config. More...
 
 PipeServer (const PipeServer &)=delete
 No copy. More...
 
 PipeServer (PipeServer &&)=delete
 No move. More...
 
virtual bool IsAccepting () const
 Gets if the pipe server is accepting a new connection. More...
 
virtual bool IsStopping () const
 Gets if the pipe server is stopping. More...
 
virtual size_t InstanceCount () const
 Gets the current instance count. More...
 
PipeServeroperator= (const PipeServer &)=delete
 No copy. More...
 
PipeServeroperator= (PipeServer &&)=delete
 No move. More...
 
virtual ~PipeServer ()
 Disconnect all clients and close all connections. More...
 

Protected Member Functions

void StartClient ()
 Open a new named pipe for a new client to connect to. More...
 
void Stop ()
 Stop the pipe server. More...
 
void Triggered (const winss::HandleWrapper &handle)
 The event handler for the pipe server. More...
 
virtual void Connected (TPipeInstance *instance)
 Called when a client is connected. More...
 
virtual void Triggered (TPipeInstance *instance)
 Called when an event is triggered. More...
 

Protected Attributes

bool stopping = false
 Flag if the server is stopping. More...
 
bool open = false
 Flag if the server is open for connections. More...
 
std::map< winss::HandleWrapper, TPipeInstance > instances
 A mapping of handles to instances. More...
 
winss::NotOwningPtr< winss::WaitMultiplexermultiplexer
 The event multiplexer for the named pipe server. More...
 
winss::PipeName pipe_name
 The name of the pipe. More...
 

Detailed Description

template<typename TPipeInstance>
class winss::PipeServer< TPipeInstance >

Base named pipe server.

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

Template Parameters
TPipeInstanceThe named pipe instance implementation.

Constructor & Destructor Documentation

template<typename TPipeInstance >
winss::PipeServer< TPipeInstance >::PipeServer ( const PipeServerConfig config)
inlineexplicit

Create a new pipe instance with the given config.

Parameters
configThe pipe server config.

References winss::WaitMultiplexer::AddInitCallback(), and winss::WaitMultiplexer::AddStopCallback().

template<typename TPipeInstance >
winss::PipeServer< TPipeInstance >::PipeServer ( const PipeServer< TPipeInstance > &  )
delete

No copy.

template<typename TPipeInstance >
winss::PipeServer< TPipeInstance >::PipeServer ( PipeServer< TPipeInstance > &&  )
delete

No move.

template<typename TPipeInstance >
virtual winss::PipeServer< TPipeInstance >::~PipeServer ( )
inlinevirtual

Disconnect all clients and close all connections.

Member Function Documentation

template<typename TPipeInstance >
virtual void winss::PipeServer< TPipeInstance >::Connected ( TPipeInstance *  instance)
inlineprotectedvirtual

Called when a client is connected.

Parameters
instanceThe associated client instance.
template<typename TPipeInstance >
virtual size_t winss::PipeServer< TPipeInstance >::InstanceCount ( ) const
inlinevirtual

Gets the current instance count.

Returns
The number of instances managed by the server.
template<typename TPipeInstance >
virtual bool winss::PipeServer< TPipeInstance >::IsAccepting ( ) const
inlinevirtual

Gets if the pipe server is accepting a new connection.

Returns
True if the pipe server is accepting otherwise false.
template<typename TPipeInstance >
virtual bool winss::PipeServer< TPipeInstance >::IsStopping ( ) const
inlinevirtual

Gets if the pipe server is stopping.

Returns
True if the pipe server is stopping otherwise false.
template<typename TPipeInstance >
PipeServer& winss::PipeServer< TPipeInstance >::operator= ( const PipeServer< TPipeInstance > &  )
delete

No copy.

template<typename TPipeInstance >
PipeServer& winss::PipeServer< TPipeInstance >::operator= ( PipeServer< TPipeInstance > &&  )
delete

No move.

template<typename TPipeInstance >
void winss::PipeServer< TPipeInstance >::StartClient ( )
inlineprotected

Open a new named pipe for a new client to connect to.

References winss::WaitMultiplexer::AddTriggeredCallback().

template<typename TPipeInstance >
void winss::PipeServer< TPipeInstance >::Stop ( )
inlineprotected

Stop the pipe server.

template<typename TPipeInstance >
void winss::PipeServer< TPipeInstance >::Triggered ( const winss::HandleWrapper handle)
inlineprotected

The event handler for the pipe server.

Parameters
handleThe handle that triggered the event.

References winss::WaitMultiplexer::AddTriggeredCallback(), winss::REMOVE, and winss::SKIP.

template<typename TPipeInstance >
virtual void winss::PipeServer< TPipeInstance >::Triggered ( TPipeInstance *  instance)
inlineprotectedvirtual

Called when an event is triggered.

Parameters
instanceThe associated client instance.

Member Data Documentation

template<typename TPipeInstance >
std::map<winss::HandleWrapper, TPipeInstance> winss::PipeServer< TPipeInstance >::instances
protected

A mapping of handles to instances.

template<typename TPipeInstance >
winss::NotOwningPtr<winss::WaitMultiplexer> winss::PipeServer< TPipeInstance >::multiplexer
protected

The event multiplexer for the named pipe server.

template<typename TPipeInstance >
bool winss::PipeServer< TPipeInstance >::open = false
protected

Flag if the server is open for connections.

template<typename TPipeInstance >
winss::PipeName winss::PipeServer< TPipeInstance >::pipe_name
protected

The name of the pipe.

template<typename TPipeInstance >
bool winss::PipeServer< TPipeInstance >::stopping = false
protected

Flag if the server is stopping.


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