API Documentation
Loading...
Searching...
No Matches
LogStream.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: LogStream
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/BaseValues.h>
35#include <NDEVR/ProgressInfo.h>
36#include <NDEVR/Buffer.h>
37#include <NDEVR/LogMessage.h>
38namespace NDEVR
39{
40 class LogMessage;
42 {
43 public:
44 virtual ~LogStream()
45 {
46 clearLinks();
47 }
48 virtual void attach(ProgressInfo* stream)
49 {
50 m_linked_logs.add(stream);
51 }
52 virtual void detach(ProgressInfo* stream)
53 {
54 m_linked_logs.removeElement(stream);
55 }
56 virtual void allowCancel(bool) {}
57 virtual void setProgress(fltp04 progress) = 0;
58 virtual void addMessage(const LogMessage& message) = 0;
59 virtual void addMessages(const Buffer<LogMessage>& messages)
60 {
61 for (uint04 i = 0; i < messages.size(); i++)
62 {
63 addMessage(messages[i]);
64 }
65 }
67 {
68 for (uint04 i = 0; i < m_linked_logs.size(); i++)
69 {
70 m_linked_logs[i]->removeStream(this);
71 }
72 m_linked_logs.clear();
73 }
74 void setIgnoreMessages(bool ignore)
75 {
76 m_ignore_message = ignore;
77 }
78 bool ignoringMessages() const
79 {
80 return m_ignore_message;
81 }
82 protected:
84 bool m_ignore_message = false;
85 };
86}
87
#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
constexpr t_index_type size() const
Definition Buffer.hpp:1461
Definition LogMessage.h:40
Definition LogStream.h:42
virtual void addMessages(const Buffer< LogMessage > &messages)
Definition LogStream.h:59
virtual void attach(ProgressInfo *stream)
Definition LogStream.h:48
virtual void allowCancel(bool)
Definition LogStream.h:56
void setIgnoreMessages(bool ignore)
Definition LogStream.h:74
void clearLinks()
Definition LogStream.h:66
virtual void setProgress(fltp04 progress)=0
virtual ~LogStream()
Definition LogStream.h:44
virtual void detach(ProgressInfo *stream)
Definition LogStream.h:52
virtual void addMessage(const LogMessage &message)=0
Buffer< ProgressInfo * > m_linked_logs
Definition LogStream.h:83
bool ignoringMessages() const
Definition LogStream.h:78
Definition ProgressInfo.hpp:43
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120