winss
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
winss::ServiceProcessTmpl< TProcess > Class Template Reference

A template for a service process. More...

#include <service_process.hpp>

Public Member Functions

 ServiceProcessTmpl ()
 The default service process template constructor. More...
 
 ServiceProcessTmpl (fs::path service_dir)
 Initializes the service process with the service directory. More...
 
 ServiceProcessTmpl (const ServiceProcessTmpl &)=delete
 No copy. More...
 
 ServiceProcessTmpl (ServiceProcessTmpl &&p)
 Creates a new service process and moves it from an old one. More...
 
virtual const fs::path & GetServiceDir () const
 Gets the path of the service directory. More...
 
virtual bool IsCreated () const
 Gets the service process is created. More...
 
virtual void Start (const ServicePipes &pipes, bool consumer)
 Starts the service process. More...
 
virtual void Close ()
 Closes the service process. More...
 
ServiceProcessTmploperator= (const ServiceProcessTmpl &)=delete
 No copy. More...
 
ServiceProcessTmploperator= (ServiceProcessTmpl &&p)
 Moves the service process object to this object. More...
 
virtual ~ServiceProcessTmpl ()
 Service process destructor which will close the process. More...
 

Static Public Attributes

static constexpr const char kSuperviseExe [16] = "winss-supervise"
 The supervisor name. More...
 

Protected Attributes

fs::path service_dir
 The service directory. More...
 
TProcess proc
 The supervisor process. More...
 

Detailed Description

template<typename TProcess>
class winss::ServiceProcessTmpl< TProcess >

A template for a service process.

Models a service process which would be either the main service or the log service. Log services should be started with a consumer pipe to the pipes of the main service.

Template Parameters
TMutexThe process implementation type.

Constructor & Destructor Documentation

template<typename TProcess >
winss::ServiceProcessTmpl< TProcess >::ServiceProcessTmpl ( )
inline

The default service process template constructor.

template<typename TProcess >
winss::ServiceProcessTmpl< TProcess >::ServiceProcessTmpl ( fs::path  service_dir)
inlineexplicit

Initializes the service process with the service directory.

Parameters
service_dirThe path to the service directory.
template<typename TProcess >
winss::ServiceProcessTmpl< TProcess >::ServiceProcessTmpl ( const ServiceProcessTmpl< TProcess > &  )
delete

No copy.

template<typename TProcess >
winss::ServiceProcessTmpl< TProcess >::ServiceProcessTmpl ( ServiceProcessTmpl< TProcess > &&  p)
inline

Creates a new service process and moves it from an old one.

Parameters
pThe previous service process.
template<typename TProcess >
virtual winss::ServiceProcessTmpl< TProcess >::~ServiceProcessTmpl ( )
inlinevirtual

Service process destructor which will close the process.

Member Function Documentation

template<typename TProcess >
virtual void winss::ServiceProcessTmpl< TProcess >::Close ( )
inlinevirtual

Closes the service process.

template<typename TProcess >
virtual const fs::path& winss::ServiceProcessTmpl< TProcess >::GetServiceDir ( ) const
inlinevirtual

Gets the path of the service directory.

Returns
The service directory path.
template<typename TProcess >
virtual bool winss::ServiceProcessTmpl< TProcess >::IsCreated ( ) const
inlinevirtual

Gets the service process is created.

Returns
True if the service process is created otherwise false.
template<typename TProcess >
ServiceProcessTmpl& winss::ServiceProcessTmpl< TProcess >::operator= ( const ServiceProcessTmpl< TProcess > &  )
delete

No copy.

template<typename TProcess >
ServiceProcessTmpl& winss::ServiceProcessTmpl< TProcess >::operator= ( ServiceProcessTmpl< TProcess > &&  p)
inline

Moves the service process object to this object.

Parameters
pThe previous service process.
Returns
This service process.
template<typename TProcess >
virtual void winss::ServiceProcessTmpl< TProcess >::Start ( const ServicePipes pipes,
bool  consumer 
)
inlinevirtual

Starts the service process.

Parameters
[in]pipesThe redirected pipes.
[in]consumerThe process is a consumer of the pipes.

References winss::ProcessParams::stdin_pipe, winss::ServicePipes::stdin_pipe, winss::ServicePipes::stdout_pipe, and SUFFIX.

Member Data Documentation

template<typename TProcess >
constexpr const char winss::ServiceProcessTmpl< TProcess >::kSuperviseExe[16] = "winss-supervise"
static

The supervisor name.

template<typename TProcess >
TProcess winss::ServiceProcessTmpl< TProcess >::proc
protected

The supervisor process.

template<typename TProcess >
fs::path winss::ServiceProcessTmpl< TProcess >::service_dir
protected

The service directory.


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