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

A template for a service. More...

#include <service.hpp>

Public Member Functions

 ServiceTmpl ()
 The default service template constructor. More...
 
 ServiceTmpl (const std::string &name)
 Initializes the service with the name and directory. More...
 
 ServiceTmpl (const ServiceTmpl &)=delete
 No copy. More...
 
 ServiceTmpl (ServiceTmpl &&s)
 Creates a new service and moves it from an old one. More...
 
virtual const std::string & GetName () const
 Gets the name of the service. More...
 
virtual bool IsFlagged () const
 Gets if the service is flagged or not. More...
 
virtual void Reset ()
 Resets the service. More...
 
virtual void Check ()
 Checks the service is running. More...
 
virtual bool Close (bool ignore_flagged)
 Close the service. More...
 
ServiceTmploperator= (const ServiceTmpl &)=delete
 No copy. More...
 
ServiceTmploperator= (ServiceTmpl &&s)
 Moves the service object to this object. More...
 

Static Public Attributes

static constexpr const char kLogDir [4] = "log"
 The log definition. More...
 

Protected Member Functions

winss::ServicePipes CreatePipes ()
 Creates pipes for redirecting STDIN and STDOUT. More...
 

Protected Attributes

std::string name
 The name of the service. More...
 
TServiceProcess main
 The main supervisor. More...
 
TServiceProcess log
 The log supervisor. More...
 
bool flagged = false
 Flagged for removal. More...
 

Detailed Description

template<typename TServiceProcess>
class winss::ServiceTmpl< TServiceProcess >

A template for a service.

Models a service directory and has knowledge about redirecting logs for service directories which include a log definition.

Template Parameters
TServiceProcessThe service process implementation type.

Constructor & Destructor Documentation

template<typename TServiceProcess >
winss::ServiceTmpl< TServiceProcess >::ServiceTmpl ( )
inline

The default service template constructor.

Referenced by winss::ServiceTmpl< TServiceProcess >::ServiceTmpl().

template<typename TServiceProcess >
winss::ServiceTmpl< TServiceProcess >::ServiceTmpl ( const std::string &  name)
inlineexplicit

Initializes the service with the name and directory.

Parameters
nameThe name of the service.

References winss::ServiceTmpl< TServiceProcess >::ServiceTmpl().

template<typename TServiceProcess >
winss::ServiceTmpl< TServiceProcess >::ServiceTmpl ( const ServiceTmpl< TServiceProcess > &  )
delete

No copy.

template<typename TServiceProcess >
winss::ServiceTmpl< TServiceProcess >::ServiceTmpl ( ServiceTmpl< TServiceProcess > &&  s)
inline

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

Parameters
sThe previous service.

Member Function Documentation

template<typename TServiceProcess >
virtual void winss::ServiceTmpl< TServiceProcess >::Check ( )
inlinevirtual
template<typename TServiceProcess >
virtual bool winss::ServiceTmpl< TServiceProcess >::Close ( bool  ignore_flagged)
inlinevirtual

Close the service.

Parameters
[in]ignore_flaggedWill force close the service.
Returns
True if the service is flagged for removal otherwise false.

References winss::ServiceTmpl< TServiceProcess >::flagged, and winss::ServiceTmpl< TServiceProcess >::operator=().

template<typename TServiceProcess >
winss::ServicePipes winss::ServiceTmpl< TServiceProcess >::CreatePipes ( )
inlineprotected

Creates pipes for redirecting STDIN and STDOUT.

Returns
One input pipe and one output pipe.

References WINDOWS.

Referenced by winss::ServiceTmpl< TServiceProcess >::Check().

template<typename TServiceProcess >
virtual const std::string& winss::ServiceTmpl< TServiceProcess >::GetName ( ) const
inlinevirtual

Gets the name of the service.

Returns
The name of the service as a string.

References winss::ServiceTmpl< TServiceProcess >::name.

template<typename TServiceProcess >
virtual bool winss::ServiceTmpl< TServiceProcess >::IsFlagged ( ) const
inlinevirtual

Gets if the service is flagged or not.

Returns
True if flagged or false if not.

References winss::ServiceTmpl< TServiceProcess >::flagged.

template<typename TServiceProcess >
ServiceTmpl& winss::ServiceTmpl< TServiceProcess >::operator= ( const ServiceTmpl< TServiceProcess > &  )
delete
template<typename TServiceProcess >
ServiceTmpl& winss::ServiceTmpl< TServiceProcess >::operator= ( ServiceTmpl< TServiceProcess > &&  s)
inline

Moves the service object to this object.

Parameters
sThe previous service.
Returns
This service.
template<typename TServiceProcess >
virtual void winss::ServiceTmpl< TServiceProcess >::Reset ( )
inlinevirtual

Resets the service.

Member Data Documentation

template<typename TServiceProcess >
bool winss::ServiceTmpl< TServiceProcess >::flagged = false
protected
template<typename TServiceProcess >
constexpr const char winss::ServiceTmpl< TServiceProcess >::kLogDir[4] = "log"
static

The log definition.

template<typename TServiceProcess >
TServiceProcess winss::ServiceTmpl< TServiceProcess >::log
protected

The log supervisor.

template<typename TServiceProcess >
TServiceProcess winss::ServiceTmpl< TServiceProcess >::main
protected

The main supervisor.

template<typename TServiceProcess >
std::string winss::ServiceTmpl< TServiceProcess >::name
protected

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