Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
logfile.h
1/*
2** Copyright 2007-2024, RTE (https://www.rte-france.com)
3** See AUTHORS.txt
4** SPDX-License-Identifier: MPL-2.0
5** This file is part of Antares-Simulator,
6** Adequacy and Performance assessment for interconnected energy networks.
7**
8** Antares_Simulator is free software: you can redistribute it and/or modify
9** it under the terms of the Mozilla Public Licence 2.0 as published by
10** the Mozilla Foundation, either version 2 of the License, or
11** (at your option) any later version.
12**
13** Antares_Simulator is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16** Mozilla Public Licence 2.0 for more details.
17**
18** You should have received a copy of the Mozilla Public Licence 2.0
19** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20*/
21#ifndef __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_MC_PLAYLIST_H__
22#define __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_MC_PLAYLIST_H__
23
24#include "../renderer.h"
25#include "../../../../application/study.h"
26#include <memory>
27#include <vector>
28
29namespace Antares
30{
31namespace Component
32{
33namespace Datagrid
34{
35namespace Renderer
36{
38{
39public:
41 using Vector = std::vector<LogEntry*>;
44 {
45 vtInfo,
46 vtNotice,
47 vtCheckpoint,
48 vtWarning,
49 vtError,
50 vtDebug
51 };
52
53public:
54 LogEntry();
55
56 bool isWarningError() const
57 {
58 return (verbosityType == vtWarning || verbosityType == vtError);
59 }
60
61 void assignVerbosity(const AnyString& pS);
62
63public:
67 uint line;
68 // The most of the time, we will prefer customstring to consume less
69 // memory for large logfiles
71 Yuni::CString<32, false> date;
73 Yuni::CString<32, false> application;
75 Yuni::CString<16, false> verbosity;
77 wxString message;
80};
81
83{
84public:
86 using Ptr = std::shared_ptr<LogEntryContainer>;
87
88public:
90 {
91 }
93
94public:
96 YString filename;
98 YString barefilename;
100 uint lines;
102 uint64_t size;
109};
110
111class LogFile : public IRenderer
112{
113public:
114 LogFile();
115 virtual ~LogFile();
116
117 virtual int width() const
118 {
119 return 3;
120 }
121 virtual int height() const;
122
123 virtual wxString columnCaption(int colIndx) const;
124
125 virtual wxString rowCaption(int rowIndx) const;
126
127 virtual wxString cellValue(int x, int y) const;
128
129 virtual double cellNumericValue(int x, int y) const;
130
131 virtual bool cellValue(int x, int y, const Yuni::String& value);
132
133 virtual void resetColors(int, int, wxColour&, wxColour&) const
134 {
135 // Do nothing
136 }
137
138 virtual bool valid() const
139 {
140 return !(!logs);
141 }
142
143 virtual uint maxWidthResize() const
144 {
145 return 0;
146 }
147 virtual IRenderer::CellStyle cellStyle(int col, int row) const;
148
149 virtual wxColour cellBackgroundColor(int, int) const;
150 virtual wxColour cellTextColor(int, int) const;
151
152 virtual wxColour verticalBorderColor(int x, int y) const;
153
154 void control(wxWindow* control)
155 {
156 pControl = control;
157 }
158
159 virtual int cellAlignment(int x, int y) const;
160
161 virtual int columnWidthCustom(int x) const;
162
163 virtual void hintForColumnWidth(int x, wxString& out) const;
164
165public:
168
169protected:
170 wxWindow* pControl;
171
172}; // class LogFile
173
174} // namespace Renderer
175} // namespace Datagrid
176} // namespace Component
177} // namespace Antares
178
179#endif // __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_MC_PLAYLIST_H__
Data provider for Datagrids.
Definition renderer.h:53
YString filename
Full filename.
Definition logfile.h:96
uint lines
The total number of lines.
Definition logfile.h:100
uint longestLine
The longest line.
Definition logfile.h:106
uint64_t size
Size.
Definition logfile.h:102
std::shared_ptr< LogEntryContainer > Ptr
The most suitable smart pointer for the class.
Definition logfile.h:86
YString barefilename
The bare filename.
Definition logfile.h:98
LogEntry::Vector entries
All entries.
Definition logfile.h:104
uint maxCharForALine
The maximum number of char found for a single line.
Definition logfile.h:108
Yuni::CString< 32, false > application
Application.
Definition logfile.h:73
wxString message
The message itself.
Definition logfile.h:77
Yuni::CString< 32, false > date
Date.
Definition logfile.h:71
bool highlight
Highlight.
Definition logfile.h:79
Yuni::CString< 16, false > verbosity
Verbosity.
Definition logfile.h:75
VerbosityType
Verbosity type.
Definition logfile.h:44
uint line
Line in the file.
Definition logfile.h:67
std::vector< LogEntry * > Vector
Vector of log entries.
Definition logfile.h:41
VerbosityType verbosityType
Type of the verbosity.
Definition logfile.h:65
virtual int cellAlignment(int x, int y) const
Get the alignment of a cell (-1: left, 0: center, +1: right)
Definition logfile.cpp:228
virtual wxString rowCaption(int rowIndx) const
Get the caption of a row.
Definition logfile.cpp:125
virtual wxString cellValue(int x, int y) const
Get the string representation of a Cell.
Definition logfile.cpp:146
virtual wxString columnCaption(int colIndx) const
Get the caption of a column.
Definition logfile.cpp:110
virtual void hintForColumnWidth(int x, wxString &out) const
String to use.
Definition logfile.cpp:244
virtual int width() const
The effective width of the grid.
Definition logfile.h:117
virtual int columnWidthCustom(int x) const
Get how the a column must resize (0: auto, >0: specific width, <0: use custom string)
Definition logfile.cpp:233
virtual double cellNumericValue(int x, int y) const
Get the floating value of a Cell.
Definition logfile.cpp:141
LogEntryContainer::Ptr logs
Logs.
Definition logfile.h:167
virtual wxColour verticalBorderColor(int x, int y) const
Get the color of the vertical right border.
Definition logfile.cpp:216
virtual int height() const
The effective height of the grid.
Definition logfile.cpp:105
virtual uint maxWidthResize() const
The most suitable column count.
Definition logfile.h:143