LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
treebank_collection_report.hpp
1/*********************************************************************
2 *
3 * Linear Arrangement Library - A library that implements a collection
4 * algorithms for linear arrangments of graphs.
5 *
6 * Copyright (C) 2019 - 2024
7 *
8 * This file is part of Linear Arrangement Library. The full code is available
9 * at:
10 * https://github.com/LAL-project/linear-arrangement-library.git
11 *
12 * Linear Arrangement Library is free software: you can redistribute it
13 * and/or modify it under the terms of the GNU Affero General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * Linear Arrangement Library is distributed in the hope that it will be
18 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Affero General Public License for more details.
21 *
22 * You should have received a copy of the GNU Affero General Public License
23 * along with Linear Arrangement Library. If not, see <http://www.gnu.org/licenses/>.
24 *
25 * Contact:
26 *
27 * LluĂ­s Alemany Puig (lluis.alemany.puig@upc.edu)
28 * LQMC (Quantitative, Mathematical, and Computational Linguisitcs)
29 * CQL (Complexity and Quantitative Linguistics Lab)
30 * Jordi Girona St 1-3, Campus Nord UPC, 08034 Barcelona. CATALONIA, SPAIN
31 * Webpage: https://cqllab.upc.edu/people/lalemany/
32 *
33 * Ramon Ferrer i Cancho (rferrericancho@cs.upc.edu)
34 * LQMC (Quantitative, Mathematical, and Computational Linguisitcs)
35 * CQL (Complexity and Quantitative Linguistics Lab)
36 * Office 220, Omega building
37 * Jordi Girona St 1-3, Campus Nord UPC, 08034 Barcelona. CATALONIA, SPAIN
38 * Webpage: https://cqllab.upc.edu/people/rferrericancho/
39 *
40 ********************************************************************/
41
42#pragma once
43
44// C++ includes
45#include <cstdint>
46#include <vector>
47
48// lal includes
49#include <lal/io/treebank_file_report.hpp>
50#include <lal/io/treebank_file_error.hpp>
51#include <lal/io/treebank_collection_report_location.hpp>
52
53namespace lal {
54namespace io {
55
68public:
69
71 typedef std::vector<treebank_collection_report_location> error_list;
72
73public:
75 treebank_collection_report() noexcept = default;
80
87 m_treebank_error = std::move(err);
88 }
89
91 ~treebank_collection_report() noexcept = default;
92
93 /* ASSIGNMENT OPERATORS */
94
96 treebank_collection_report& operator= (const treebank_collection_report&) noexcept = default;
98 treebank_collection_report& operator= (treebank_collection_report&&) noexcept = default;
99
100 /* MODIFIERS */
101
104 const uint64_t line_number,
105 const std::string& treebank_file_name,
106 const std::string& treebank_id,
107 const treebank_file_report& err
108 )
109 noexcept
110 {
111 m_reports.emplace_back(
112 line_number,
113 treebank_file_name,
114 treebank_id,
115 err
116 );
117 }
120 const uint64_t line_number,
121 std::string&& treebank_file_name,
122 std::string&& treebank_id,
124 )
125 noexcept
126 {
127 m_reports.emplace_back(
128 line_number,
129 std::move(treebank_file_name),
130 std::move(treebank_id),
131 std::move(err)
132 );
133 }
134
136 void set_treebank_error(const treebank_file_error& err) noexcept {
137 m_treebank_error = err;
138 }
141 m_treebank_error = std::move(err);
142 }
143
144 /* GETTERS */
145
147 [[nodiscard]] std::size_t get_num_errors() const noexcept {
148 std::size_t c =
150
151 for (const auto& rep : m_reports) {
152 c += rep.report.get_num_errors();
153 }
154 return c;
155 }
156
162 [[nodiscard]] const error_list& get_treebank_reports() const noexcept
163 { return m_reports; }
164
170 [[nodiscard]] const treebank_file_error& get_treebank_error() const noexcept
171 { return m_treebank_error; }
172
173private:
176
179};
180
181} // -- namespace io
182} // -- namespace lal
Report on a treebank collection.
Definition treebank_collection_report.hpp:67
std::vector< treebank_collection_report_location > error_list
The list of reports of errors of the treebanks within the collection.
Definition treebank_collection_report.hpp:71
treebank_collection_report(treebank_file_error &&err) noexcept
Constructor with a single head vector error.
Definition treebank_collection_report.hpp:86
void set_treebank_error(const treebank_file_error &err) noexcept
Sets the error concerning the main file of the collection.
Definition treebank_collection_report.hpp:136
const error_list & get_treebank_reports() const noexcept
Returns the list of error reports for every treebank file.
Definition treebank_collection_report.hpp:162
void add_report(const uint64_t line_number, const std::string &treebank_file_name, const std::string &treebank_id, const treebank_file_report &err) noexcept
Adds a report on a treebank file.
Definition treebank_collection_report.hpp:103
~treebank_collection_report() noexcept=default
Default destructor.
error_list m_reports
The error in the head vector and the line number where it happened.
Definition treebank_collection_report.hpp:175
const treebank_file_error & get_treebank_error() const noexcept
Returns the only treebank error concerning the file (if any).
Definition treebank_collection_report.hpp:170
std::size_t get_num_errors() const noexcept
Returns the number of errors in this report.
Definition treebank_collection_report.hpp:147
treebank_collection_report() noexcept=default
Default constructor.
void add_report(const uint64_t line_number, std::string &&treebank_file_name, std::string &&treebank_id, treebank_file_report &&err) noexcept
Adds a report on a treebank file.
Definition treebank_collection_report.hpp:119
void set_treebank_error(treebank_file_error &&err) noexcept
Sets the error concerning the main file of the collection.
Definition treebank_collection_report.hpp:140
treebank_file_error m_treebank_error
A treebank error.
Definition treebank_collection_report.hpp:178
Treebank file error report class.
Definition treebank_file_error.hpp:64
treebank_file_error_type get_error_type() const noexcept
Returns the error type.
Definition treebank_file_error.hpp:127
Report on a treebank file.
Definition treebank_file_report.hpp:69
Main namespace of the library.
Definition basic_types.hpp:48