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

Member Function Documentation

◆ add_error()

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

Definition at line 3067 of file kernel.cpp.

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

◆ add_parents()

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

Definition at line 3052 of file kernel.cpp.

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

◆ clear()

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

Definition at line 366 of file kernel.hpp.

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

◆ get_text()

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

Definition at line 3084 of file kernel.cpp.

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

◆ is_empty()

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

Definition at line 365 of file kernel.hpp.

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

◆ m_errors

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

Definition at line 371 of file kernel.hpp.

◆ p_mutex

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

Definition at line 373 of file kernel.hpp.


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