Patronum
Loading...
Searching...
No Matches
PService.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2025 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8#ifndef PSERVICE_H
9#define PSERVICE_H
10#include "Patronum_global.h"
11#include "PFeature.h"
12#include <IPService.h>
13#include "PServiceBase.h"
14#include <QCoreApplication>
15#include <quasarapp.h>
16
17namespace Patronum {
18
19template<class Application>
87class Service : public ServiceBase
88{
89public:
97 Service(int argc, char *argv[])
98 : ServiceBase(argc, argv) {
99
100 _argc = argc;
101 _argv = argv;
102
103 }
104
105 ~Service() override {
106 }
107// IService interface
108protected:
109
113 void createApplication() override {
114 static_assert (std::is_base_of<Application, QCoreApplication>::value,
115 "the Application type must be QCoreApplication");
116 setCore(new Application(_argc, _argv));
117 }
118
119private:
120 int _argc = 0;
121 char **_argv = 0;
122};
123
124}
125
126
127#endif // PSERVICE_H
The ServiceBase class This is Base service class. Please for create your own services use the Patronu...
void setCore(QCoreApplication *core)
setCore This method sets new object of the core application.
The Service class it is class for create a services from daemons.
Definition PService.h:88
void createApplication() override
createApplication default implementation create a Application object.
Definition PService.h:113
Service(int argc, char *argv[])
Service This is main constructor of the service object.
Definition PService.h:97
~Service() override
Definition PService.h:105
The Patronum namespace - It is main name space of Patronum Library. The Patronum library support the ...