API Documentation
Loading...
Searching...
No Matches
Log.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: Log
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/LogMessage.h>
35#include <NDEVR/LogStream.h>
36#include <NDEVR/ProgressInfo.h>
37#include <NDEVR/LogMessage.h>
38#include <mutex>
39namespace NDEVR
40{
41 class String;
42 class Log final : public ProgressInfo, public Buffer<LogMessage>
43 {
44 friend class LogManager;
45 public:
46 NDEVR_BASE_API explicit Log(uint08 id = 0);
47 NDEVR_BASE_API Log(const Log& log);
48 NDEVR_BASE_API virtual ~Log();
49 public:
50 NDEVR_BASE_API void addStream(LogStream* stream, bool add_all) final override;
51 NDEVR_BASE_API void removeStream(LogStream* stream) final override;
52 NDEVR_BASE_API bool addMessage(const LogMessage& message) override;
53 NDEVR_BASE_API bool addMessage(const String& message, uint01 log_level = 10) override;
54 NDEVR_BASE_API bool addMessage(const char* const message, uint01 log_level = 10) final override;
55 NDEVR_BASE_API bool addMessage(const TranslatedString& message, uint01 log_level = 10) override;
56 NDEVR_BASE_API void insertMessages(uint04 index, const Buffer<LogMessage>& messages);
57 bool cancelRequested() const override { return m_request_cancel; }
58 void setCancelRequest(bool cancel) override {
59 m_request_cancel = cancel;
60 }
61
62 NDEVR_BASE_API void concatenate(const Log& log);
65 NDEVR_BASE_API void allowCancel(bool cancel) override;
66 NDEVR_BASE_API bool setProgress(fltp04 percent) final override;
67 protected:
70 private:
71 static constexpr fltp08 s_progress_epsilon = 0.001f;
72 Buffer<LogStream*> m_streams;
73 std::mutex m_mtx;
74 };
75}
76
#define NDEVR_BASE_API
Definition DLLInfo.h:78
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Log.h:43
NDEVR_BASE_API void sortMessagesByTime()
Definition Log.cpp:109
fltp04 m_progress
Definition Log.h:69
NDEVR_BASE_API void concatenate(const Log &log)
Definition Log.cpp:88
virtual NDEVR_BASE_API ~Log()
Definition Log.cpp:19
bool cancelRequested() const override
Definition Log.h:57
NDEVR_BASE_API Log(uint08 id=0)
Definition Log.cpp:25
NDEVR_BASE_API bool setProgress(fltp04 percent) final override
Definition Log.cpp:121
void setCancelRequest(bool cancel) override
Definition Log.h:58
NDEVR_BASE_API void sortMessagesByPriority()
Definition Log.cpp:99
bool m_request_cancel
Definition Log.h:68
NDEVR_BASE_API void allowCancel(bool cancel) override
Definition Log.cpp:114
NDEVR_BASE_API void insertMessages(uint04 index, const Buffer< LogMessage > &messages)
Definition Log.cpp:71
NDEVR_BASE_API bool addMessage(const LogMessage &message) override
Definition Log.cpp:77
NDEVR_BASE_API void addStream(LogStream *stream, bool add_all) final override
Definition Log.cpp:35
NDEVR_BASE_API void removeStream(LogStream *stream) final override
Definition Log.cpp:49
Definition LogManager.h:10
Definition LogMessage.h:40
Definition LogStream.h:42
Definition ProgressInfo.hpp:43
Definition String.h:40
Definition TranslatedString.h:9
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer -Can represent exact integer values 0 thro...
Definition BaseValues.hpp:132
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181