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 365 of file kernel.hpp.

Member Function Documentation

◆ add_error()

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

Definition at line 3072 of file kernel.cpp.

3073 {
3074 std::string text;
3075 std::set<const OksFile *> parents;
3076 add_parents(text, file.get_parent(), parents);
3077
3078 bool has_no_parents(text.empty());
3079
3080 text += "file \'";
3081 text += file.get_full_file_name();
3082 text += (has_no_parents ? "\' has problem:\n" : "\' that has problem:\n");
3083 text += ex.what();
3084
3085 std::lock_guard lock(p_mutex);
3086 m_errors.push_back(text);
3087 }
void add_parents(std::string &text, const OksFile *file, std::set< const OksFile * > &parents)
Definition kernel.cpp:3057
std::list< std::string > m_errors
Definition kernel.hpp:376

◆ add_parents()

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

Definition at line 3057 of file kernel.cpp.

3058 {
3059 if(file) {
3060 if(parents.insert(file).second == false) {
3061 text += "(ignoring circular dependency between included files...)\n";
3062 }
3063 else {
3064 add_parents(text, file->get_parent(), parents);
3065 text += "file \'";
3066 text += file->get_full_file_name();
3067 text += "\' includes:\n";
3068 }
3069 }
3070 }

◆ clear()

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

Definition at line 371 of file kernel.hpp.

371{ std::lock_guard lock(p_mutex); m_errors.clear(); }

◆ get_text()

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

Definition at line 3089 of file kernel.cpp.

3090 {
3091 std::lock_guard lock(p_mutex);
3092
3093 {
3094 std::ostringstream s;
3095
3096 if(m_errors.size() == 1) {
3097 s << "Found 1 error parsing OKS data:\n" << *m_errors.begin();
3098 }
3099 else {
3100 s << "Found " << m_errors.size() << " errors parsing OKS data:";
3101 int j = 1;
3102 for(std::list<std::string>::const_iterator i = m_errors.begin(); i != m_errors.end(); ++i) {
3103 s << "\nERROR [" << j++ << "] ***: " << *i;
3104 }
3105 }
3106
3107 m_error_string = s.str();
3108 }
3109
3110 return m_error_string;
3111 }
std::string m_error_string
Definition kernel.hpp:377

◆ is_empty()

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

Definition at line 370 of file kernel.hpp.

370{ std::lock_guard lock(p_mutex); return m_errors.empty(); }

Member Data Documentation

◆ m_error_string

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

Definition at line 377 of file kernel.hpp.

◆ m_errors

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

Definition at line 376 of file kernel.hpp.

◆ p_mutex

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

Definition at line 378 of file kernel.hpp.


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