LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
treebank_file_error.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 <string>
46
47// lal includes
48#include <lal/io/treebank_file_error_type.hpp>
49
50namespace lal {
51namespace io {
52
65public:
67 treebank_file_error() noexcept = default;
68
71 (const std::string& msg, const treebank_file_error_type& tet)
72 noexcept
73 :
74 m_error_msg(msg),
75 m_error_type(tet)
76 { }
77
80
83 m_error_msg(te.m_error_msg),
84 m_error_type(te.m_error_type)
85 { }
86
89 m_error_msg(std::move(te.m_error_msg)),
90 m_error_type(te.m_error_type)
91 { }
92
93 /* ASSIGNMENT OPERATOR */
94
97 noexcept
98 {
100 m_error_type = te.m_error_type;
101 return *this;
102 }
103
106 m_error_msg = std::move(te.m_error_msg);
107 m_error_type = te.m_error_type;
108 return *this;
109 }
110
111 /* COMPARISON OPERATOR */
112
114 [[nodiscard]] bool operator== (const treebank_file_error_type& tet) const noexcept
115 { return m_error_type == tet; }
117 [[nodiscard]] bool operator!= (const treebank_file_error_type& tet) const noexcept
118 { return m_error_type != tet; }
119
120 /* GETTERS */
121
123 [[nodiscard]] const std::string& get_error_message() const noexcept
124 { return m_error_msg; }
125
127 [[nodiscard]] treebank_file_error_type get_error_type() const noexcept
128 { return m_error_type; }
129
131 [[nodiscard]] bool is_error() const noexcept
133
134private:
136 std::string m_error_msg;
139};
140
141} // -- namespace io
142} // -- namespace lal
Treebank file error report class.
Definition treebank_file_error.hpp:64
const std::string & get_error_message() const noexcept
Returns the error message.
Definition treebank_file_error.hpp:123
bool is_error() const noexcept
Returns whether or not this is an actual error.
Definition treebank_file_error.hpp:131
~treebank_file_error()=default
Destructor.
treebank_file_error(const treebank_file_error &te) noexcept
Copy constructor.
Definition treebank_file_error.hpp:82
treebank_file_error_type get_error_type() const noexcept
Returns the error type.
Definition treebank_file_error.hpp:127
std::string m_error_msg
Error message.
Definition treebank_file_error.hpp:136
treebank_file_error_type m_error_type
Error type.
Definition treebank_file_error.hpp:138
bool operator==(const treebank_file_error_type &tet) const noexcept
Compares the treebank error with a treebank error type.
Definition treebank_file_error.hpp:114
bool operator!=(const treebank_file_error_type &tet) const noexcept
Compares the treebank error with a treebank error type.
Definition treebank_file_error.hpp:117
treebank_file_error & operator=(const treebank_file_error &te) noexcept
Copy assignment operator.
Definition treebank_file_error.hpp:96
treebank_file_error() noexcept=default
Default constructor.
treebank_file_error(treebank_file_error &&te) noexcept
Move constructor.
Definition treebank_file_error.hpp:88
treebank_file_error_type
Possible errors that can arise while processing a collection.
Definition treebank_file_error_type.hpp:54
Main namespace of the library.
Definition basic_types.hpp:48