LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
head_vector_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/head_vector_error_type.hpp>
49
50namespace lal {
51namespace io {
52
65public:
66
68 head_vector_error() noexcept = default;
69
72 (const std::string& msg, const head_vector_error_type& tet)
73 noexcept
74 :
75 m_error_msg(msg),
76 m_error_type(tet)
77 { }
80 (std::string&& msg, const head_vector_error_type& tet)
81 noexcept
82 :
83 m_error_msg(msg),
84 m_error_type(tet)
85 { }
86
89 m_error_msg(te.m_error_msg),
90 m_error_type(te.m_error_type)
91 { }
92
95 m_error_msg(std::move(te.m_error_msg)),
96 m_error_type(te.m_error_type)
97 { }
98
101
102 /* ASSIGNMENT OPERATORS */
103
105 head_vector_error& operator= (const head_vector_error& ) noexcept = default;
108
109 /* COMPARISON OPERATORS */
110
112 [[nodiscard]] bool operator== (const head_vector_error_type& tet) const noexcept
113 { return m_error_type == tet; }
115 [[nodiscard]] bool operator!= (const head_vector_error_type& tet) const noexcept
116 { return m_error_type != tet; }
117
118 /* GETTERS */
119
121 [[nodiscard]] const std::string& get_error_message() const noexcept { return m_error_msg; }
122
124 [[nodiscard]] head_vector_error_type get_error_type() const noexcept
125 { return m_error_type; }
126
127private:
129 std::string m_error_msg;
132};
133
134} // -- namespace io
135} // -- namespace lal
Head vector error report class.
Definition head_vector_error.hpp:64
head_vector_error_type m_error_type
Error type.
Definition head_vector_error.hpp:131
head_vector_error_type get_error_type() const noexcept
Returns the error type.
Definition head_vector_error.hpp:124
head_vector_error(std::string &&msg, const head_vector_error_type &tet) noexcept
Constructor with error message and error type.
Definition head_vector_error.hpp:80
head_vector_error & operator=(const head_vector_error &) noexcept=default
Default copy assignment operator.
const std::string & get_error_message() const noexcept
Returns the error message.
Definition head_vector_error.hpp:121
std::string m_error_msg
Error message.
Definition head_vector_error.hpp:129
~head_vector_error()=default
Destructor.
head_vector_error() noexcept=default
Default constructor.
bool operator!=(const head_vector_error_type &tet) const noexcept
Compares this head vector error with a head vector error type.
Definition head_vector_error.hpp:115
head_vector_error(const head_vector_error &te) noexcept
Copy constructor.
Definition head_vector_error.hpp:88
head_vector_error(head_vector_error &&te) noexcept
Move constructor.
Definition head_vector_error.hpp:94
head_vector_error_type
The different types of errors that can be present in a head vector.
Definition head_vector_error_type.hpp:50
Main namespace of the library.
Definition basic_types.hpp:48