UTILLib 2.0
Common C++ library with utilities.
Loading...
Searching...
No Matches
util::UtilFactory Class Reference

Implements creators for most interface classes.

#include "util/utilfactory.h"

Static Public Member Functions

static std::unique_ptr< syslog::ISyslogServerCreateSyslogServer (syslog::SyslogServerType type)
 Creates different types of syslog servers.
static std::unique_ptr< log::ILoggerCreateLogger (log::LogType type, const std::vector< std::string > &arg_list)
 Creates a pre-defined log source.
static std::unique_ptr< log::IListenCreateListen (const std::string &type, const std::string &share_name)
 Creates a listen object.
static std::unique_ptr< log::IListenCreateListen (log::TypeOfListen type, const std::string &share_name)
 Creates a listen object.
static std::unique_ptr< log::IListenClientCreateListenClient (const std::string &host, uint16_t port)
 Creates a listen client.
static std::unique_ptr< supervise::ISuperviseMasterCreateSuperviseMaster (supervise::TypeOfSuperviseMaster type)
 Create a supervise master object.

Member Function Documentation

◆ CreateListen() [1/2]

std::unique_ptr< log::IListen > util::UtilFactory::CreateListen ( const std::string & type,
const std::string & share_name )
static

Creates a listen object. It only exist 3 basic objects to create.

The 'ListenProxy' object sends messages through a shared memory to a common server object. This type of listen object is normal when several executable should share a listen 'channel'. Typically is when debugging database calls.

The 'ListenServer' shall be used when the application want its own listen 'channel'. This is typically used for protocol drivers.

The 'ListenConsole' logs the message onto a console window (std::cout). It shall be used when putting messages from a proxy onto a console window. This object is mainly used for testing.

Parameters
typeSelect between 'ListenProxy','ListenServer' or 'ListenConsole'
share_nameUnique share name or empty string.
Returns
A smart pointer to a listen object.

◆ CreateListen() [2/2]

std::unique_ptr< log::IListen > util::UtilFactory::CreateListen ( log::TypeOfListen type,
const std::string & share_name )
static

Creates a listen (server) object. A listen object is an abstract object that is used to debug inside application. This enables simple debugging in delivered system. The user simply generates debug text lines that the Listen object forward to a Listen Window. The Listen Window (listenviewer.exe) GUI present the debug text lines. The trick is that when no Listen Window is open, the Listen object goes into idle mode not disturbing or delaying the application software. It exist 3 basic objects to create.

The ListenProxyType object sends messages through a shared memory to a common server object. This type of listen object is normal when several executable should share a listen 'channel'. Typical application is when debugging database calls.

The 'ListenServer' shall be used when the application want its own listen 'channel'. Typical application is when protocol drivers.

The 'ListenConsole' logs the message onto a console window (std::cout). It shall be used when putting messages from a proxy onto a console window. This object is mainly used for testing.

Parameters
typeSelect between ListenProxyType,ListenServerType' or ListenConsoleType
share_nameUnique share name or empty string.
Returns
A smart pointer to a listen object.

◆ CreateListenClient()

std::unique_ptr< log::IListenClient > util::UtilFactory::CreateListenClient ( const std::string & host,
uint16_t port )
static

Creates a TCP/IP listen client object.

Parameters
hostHost name
portTCP/IP port to connect to.
Returns
Smart pointer to a IListenClient.

◆ CreateLogger()

std::unique_ptr< log::ILogger > util::UtilFactory::CreateLogger ( log::LogType type,
const std::vector< std::string > & arg_list )
static

Creates a pre-defined log source. Choose between console, file, listen or syslog sources. The file source requires a base name (no path or extension) as input argument. The syslog require 2 arguments, remote host name and port.

Parameters
typeType of log source.
arg_listExtra arguments
Returns
Smart pointer to a log source.

◆ CreateSuperviseMaster()

std::unique_ptr< supervise::ISuperviseMaster > util::UtilFactory::CreateSuperviseMaster ( supervise::TypeOfSuperviseMaster type)
static

Creates a supervise

Parameters
type
Returns

◆ CreateSyslogServer()

std::unique_ptr< syslog::ISyslogServer > util::UtilFactory::CreateSyslogServer ( syslog::SyslogServerType type)
static

Creates a syslog server. Choose between UDP, TLS or TCP servers.

Parameters
typeType of syslog protocol-
Returns
Smart pointer to a syslog server.

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