LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
Loading...
Searching...
No Matches
lal::io::treebank_file_report Class Reference

Report on a treebank file. More...

#include <treebank_file_report.hpp>

Public Types

typedef std::vector< std::pair< uint64_t, head_vector_error > > error_list
 The error list for a trebank file.
 

Public Member Functions

 treebank_file_report () noexcept=default
 Default constructor.
 
 treebank_file_report (const treebank_file_report &) noexcept=default
 Default copy constructor.
 
 treebank_file_report (treebank_file_report &&) noexcept=default
 Default move constructor.
 
 treebank_file_report (const treebank_file_error &err) noexcept
 Constructor with treebank error.
 
 treebank_file_report (treebank_file_error &&err) noexcept
 Constructor with a single head vector error.
 
 treebank_file_report (const uint64_t line_number, const head_vector_error &err) noexcept
 Constructor with a single head vector error.
 
 treebank_file_report (const uint64_t line_number, head_vector_error &&err) noexcept
 Constructor with a single head vector error.
 
 ~treebank_file_report () noexcept=default
 Default destructor.
 
treebank_file_reportoperator= (const treebank_file_report &) noexcept=default
 Default copy assignment.
 
treebank_file_reportoperator= (treebank_file_report &&) noexcept=default
 Default move assignment.
 
void add_error (const uint64_t line_number, const head_vector_error &err) noexcept
 Adds an error to the list of errors.
 
void add_error (const uint64_t line_number, head_vector_error &&err) noexcept
 Adds an error to the list of errors.
 
void set_treebank_error (const treebank_file_error &err) noexcept
 Sets the treebank error m_treebank_error.
 
void set_treebank_error (treebank_file_error &&err) noexcept
 Sets the treebank error m_treebank_error.
 
std::size_t get_num_errors () const noexcept
 Returns the number of errors in this report.
 
const error_listget_head_vector_errors () const noexcept
 Returns the list of errors in the head vectors.
 
const treebank_file_errorget_treebank_error () const noexcept
 Returns the only treebank error concerning the file (if any).
 

Private Attributes

error_list m_hv_errors
 The error in the head vector and the line number where it happened.
 
treebank_file_error m_treebank_error
 A treebank error. Set if the file could not be opened or it does not exist.
 

Detailed Description

Report on a treebank file.

Stores a list of errors concerning a treebank file and its contents. If the treebank file could not be opened, then the treebank error is set (see m_treebank_error and lal::io::treebank_file_error::is_error).

Only when the treebank could be opened (and thus the treebank error is never set) does this class contain a valid (possibly empty) list of errors of head vectors (see m_hv_errors).

Member Typedef Documentation

◆ error_list

typedef std::vector<std::pair<uint64_t, head_vector_error> > lal::io::treebank_file_report::error_list

The error list for a trebank file.

A list of pairs where

  • The first field is the line number where the error is found.
  • The second field is the actual error in the head vector.

Member Function Documentation

◆ add_error() [1/2]

void lal::io::treebank_file_report::add_error ( const uint64_t line_number,
const head_vector_error & err )
inlinenoexcept

Adds an error to the list of errors.

Parameters
line_numberLine number of the treebank file where the error is.
errError to add.

◆ add_error() [2/2]

void lal::io::treebank_file_report::add_error ( const uint64_t line_number,
head_vector_error && err )
inlinenoexcept

Adds an error to the list of errors.

Parameters
line_numberLine number of the treebank file where the error is.
errError to add.

◆ get_head_vector_errors()

const error_list & lal::io::treebank_file_report::get_head_vector_errors ( ) const
inlinenodiscardnoexcept

Returns the list of errors in the head vectors.

If the list returned is empty, then there were no errors.

◆ get_treebank_error()

const treebank_file_error & lal::io::treebank_file_report::get_treebank_error ( ) const
inlinenodiscardnoexcept

Returns the only treebank error concerning the file (if any).

Returns
An error that informs that the file does not exist or that it could not be opened.

The documentation for this class was generated from the following file: