Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
Service/Sources/Service.h
1/*
2* Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3*/
4#ifndef _Samples_Service_h_
5#define _Samples_Service_h_ 1
6
7#include "Stroika/Frameworks/StroikaPreComp.h"
8
9#include "Stroika/Frameworks/Service/Main.h"
10
11/**
12*/
13
14namespace Samples {
15 namespace Service {
16
17 using namespace Stroika::Foundation;
18 using namespace Stroika::Frameworks::Service;
19
20/*
21 * Almost always would want to use logger with a service. But demarcate so clear what is 'service' demo
22 * and what is logger demo.
23 *
24 * To test, on many systems, you can do
25 * tail -f /var/log/syslog (in one window - note - depending on your system, the logfile could be elsewhere)
26 * and
27 * Samples_SampleService -start
28 * Samples_SampleService -status
29 * Samples_SampleService -stop
30 * and see the log messages appear in the logfile.
31 */
32#ifndef qUseLogger
33#define qUseLogger 1
34#endif
35
36 /**
37 * This class contains the 'main service loop' - which is how a service is started and shut down (and modules tied together).
38 */
40 SampleAppServiceRep () = default;
41 virtual ~SampleAppServiceRep () = default;
42
43 public:
44 virtual void MainLoop (const std::function<void ()>& startedCB) override;
45
46 public:
47 virtual Main::ServiceDescription GetServiceDescription () const override;
48 };
49 }
50}
51
52/*
53********************************************************************************
54***************************** Implementation Details ***************************
55********************************************************************************
56*/
57#include "Service.inl"
58
59#endif /*_Samples_Service_h_*/