GCC Code Coverage Report


Directory: libimgdoc2/
File: libimgdoc2/inc/IEnvironment.h
Date: 2025-02-03 12:41:04
Exec Total Coverage
Lines: 2 2 100.0%
Functions: 2 2 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // SPDX-FileCopyrightText: 2023 Carl Zeiss Microscopy GmbH
2 //
3 // SPDX-License-Identifier: MIT
4
5 #pragma once
6
7 namespace imgdoc2
8 {
9 /// In this class functionality "to be provided by a hosting environment" ist gathered.
10 /// The prime example is "debug logging", which is a cross-cutting concern, and it is allowed
11 /// to route debug print to the hosting environment.
12 class IHostingEnvironment
13 {
14 public:
15 /// This method is used for debug output. It may be called concurrently.
16 /// For possible values of the log level, see the constants "LogLevel".
17 ///
18 /// \param level The log level (c.f. constants "LogLevel..." for possible values).
19 /// \param message The message text (in UTF8-encoding).
20 virtual void Log(int level, const char* message) = 0;
21
22 /// Queries if the specified log level is active. This method may be called concurrently.
23 /// For possible values of the log level, see the constants "LogLevel".
24 /// \param level The log level.
25 /// \returns True if the log level is active, false if not.
26 virtual bool IsLogLevelActive(int level) = 0;
27
28 /// Report fatal error and terminate the application. This is to be used for fatal error,
29 /// where no recovery is possible. Obviously, this should be the last resort.
30 /// \param message The message.
31 virtual void ReportFatalErrorAndExit(const char* message) = 0;
32
33 544 virtual ~IHostingEnvironment() = default;
34 public:
35 // no copy and no move
36 272 IHostingEnvironment() = default;
37 IHostingEnvironment(const IHostingEnvironment&) = delete; // copy constructor
38 IHostingEnvironment& operator=(const IHostingEnvironment&) = delete; // copy assignment
39 IHostingEnvironment(IHostingEnvironment&&) = delete; // move constructor
40 IHostingEnvironment& operator=(IHostingEnvironment&&) = delete; // move assignment
41 };
42 }
43