DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::oks::LoadErrors Struct Reference

#include <kernel.hpp>

Public Member Functions

void add_error (const OksFile &file, std::exception &ex)
bool is_empty ()
void clear ()
std::string get_text ()

Private Member Functions

void add_parents (std::string &text, const OksFile *file, std::set< const OksFile * > &parents)

Private Attributes

std::list< std::string > m_errors
std::string m_error_string
std::mutex p_mutex

Detailed Description

Definition at line 389 of file kernel.hpp.

Member Function Documentation

◆ add_error()

void dunedaq::oks::LoadErrors::add_error ( const OksFile & file,
std::exception & ex )

Definition at line 2862 of file kernel.cpp.

2863{
2864 std::string text;
2865 std::set<const OksFile*> parents;
2866 add_parents(text, file.get_parent(), parents);
2867
2868 bool has_no_parents(text.empty());
2869
2870 text += "file \'";
2871 text += file.get_full_file_name();
2872 text += (has_no_parents ? "\' has problem:\n" : "\' that has problem:\n");
2873 text += ex.what();
2874
2875 std::lock_guard lock(p_mutex);
2876 m_errors.push_back(text);
2877}
void add_parents(std::string &text, const OksFile *file, std::set< const OksFile * > &parents)
Definition kernel.cpp:2847
std::list< std::string > m_errors
Definition kernel.hpp:406

◆ add_parents()

void dunedaq::oks::LoadErrors::add_parents ( std::string & text,
const OksFile * file,
std::set< const OksFile * > & parents )
private

Definition at line 2847 of file kernel.cpp.

2848{
2849 if (file) {
2850 if (parents.insert(file).second == false) {
2851 text += "(ignoring circular dependency between included files...)\n";
2852 } else {
2853 add_parents(text, file->get_parent(), parents);
2854 text += "file \'";
2855 text += file->get_full_file_name();
2856 text += "\' includes:\n";
2857 }
2858 }
2859}

◆ clear()

void dunedaq::oks::LoadErrors::clear ( )
inline

Definition at line 398 of file kernel.hpp.

399 {
400 std::lock_guard lock(p_mutex);
401 m_errors.clear();
402 }

◆ get_text()

std::string dunedaq::oks::LoadErrors::get_text ( )

Definition at line 2880 of file kernel.cpp.

2881{
2882 std::lock_guard lock(p_mutex);
2883
2884 {
2885 std::ostringstream s;
2886
2887 if (m_errors.size() == 1) {
2888 s << "Found 1 error parsing OKS data:\n" << *m_errors.begin();
2889 } else {
2890 s << "Found " << m_errors.size() << " errors parsing OKS data:";
2891 int j = 1;
2892 for (std::list<std::string>::const_iterator i = m_errors.begin(); i != m_errors.end(); ++i) {
2893 s << "\nERROR [" << j++ << "] ***: " << *i;
2894 }
2895 }
2896
2897 m_error_string = s.str();
2898 }
2899
2900 return m_error_string;
2901}
std::string m_error_string
Definition kernel.hpp:407

◆ is_empty()

bool dunedaq::oks::LoadErrors::is_empty ( )
inline

Definition at line 393 of file kernel.hpp.

394 {
395 std::lock_guard lock(p_mutex);
396 return m_errors.empty();
397 }

Member Data Documentation

◆ m_error_string

std::string dunedaq::oks::LoadErrors::m_error_string
private

Definition at line 407 of file kernel.hpp.

◆ m_errors

std::list<std::string> dunedaq::oks::LoadErrors::m_errors
private

Definition at line 406 of file kernel.hpp.

◆ p_mutex

std::mutex dunedaq::oks::LoadErrors::p_mutex
private

Definition at line 408 of file kernel.hpp.


The documentation for this struct was generated from the following files: