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

Class contains common OKS classes and methods. More...

#include <defs.hpp>

Classes

class  Tokenizer
 String tokenizer. More...
 

Static Public Member Functions

static std::ostream & error_msg (const char *)
 
static std::ostream & warning_msg (const char *)
 
static std::ostream & error_msg (const std::string &s)
 
static std::ostream & warning_msg (const std::string &s)
 
static void substitute_variables (std::string &)
 
static bool real_path (std::string &, bool ignore_errors)
 

Detailed Description

Class contains common OKS classes and methods.

Definition at line 41 of file defs.hpp.

Member Function Documentation

◆ error_msg() [1/2]

std::ostream & dunedaq::oks::Oks::error_msg ( const char * msg)
static

Definition at line 556 of file kernel.cpp.

557{
558 std::cerr << "ERROR [" << msg << "]:\n"; return std::cerr;
559}

◆ error_msg() [2/2]

static std::ostream & dunedaq::oks::Oks::error_msg ( const std::string & s)
inlinestatic

Definition at line 47 of file defs.hpp.

47{return error_msg(s.c_str());}
static std::ostream & error_msg(const char *)
Definition kernel.cpp:556

◆ real_path()

bool dunedaq::oks::Oks::real_path ( std::string & path,
bool ignore_errors )
static

Definition at line 594 of file kernel.cpp.

595{
596 char resolved_name[PATH_MAX];
597
598 if(realpath(path.c_str(), resolved_name) != 0) {
599 path = resolved_name;
600 return true;
601 }
602 else {
603 if(ignore_errors) {
604 TLOG_DEBUG( 3) << "realpath(\'" << path << "\') has failed with code " << errno << ": \'" << strerror(errno) << '\'' ;
605 return false;
606 }
607 else {
608 throw CannotResolvePath(path, errno);
609 }
610 }
611}
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
const std::string strerror(int error)
Convert C error number to string.
Definition kernel.cpp:114

◆ substitute_variables()

void dunedaq::oks::Oks::substitute_variables ( std::string & s)
static

Definition at line 570 of file kernel.cpp.

571{
572 std::string::size_type pos = 0; // position of tested string index
573 std::string::size_type p_start = 0; // begining of variable
574 std::string::size_type p_end = 0; // begining of variable
575
576 while(
577 ((p_start = s.find("$(", pos)) != std::string::npos) &&
578 ((p_end = s.find(")", p_start + 2)) != std::string::npos)
579 ) {
580 std::string var(s, p_start + 2, p_end - p_start - 2);
581
582 char * env = getenv(var.c_str());
583
584 if(env) {
585 s.replace(p_start, p_end - p_start + 1, env);
586 }
587
588 pos = p_start + 1;
589 }
590}

◆ warning_msg() [1/2]

std::ostream & dunedaq::oks::Oks::warning_msg ( const char * msg)
static

Definition at line 563 of file kernel.cpp.

564{
565 std::cerr << "WARNING [" << msg << "]:\n"; return std::cerr;
566}

◆ warning_msg() [2/2]

static std::ostream & dunedaq::oks::Oks::warning_msg ( const std::string & s)
inlinestatic

Definition at line 48 of file defs.hpp.

48{return warning_msg(s.c_str());}
static std::ostream & warning_msg(const char *)
Definition kernel.cpp:563

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