Skip to content

Commit

Permalink
Merge pull request #70 from BxCppDev/fix-falaise-193
Browse files Browse the repository at this point in the history
Minor mods
  • Loading branch information
fmauger authored May 17, 2021
2 parents b9f23a1 + 27236a5 commit 2fb85ae
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
8 changes: 4 additions & 4 deletions source/bxdatatools/include/datatools/library_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ namespace datatools {
private:

// Management:
bool _initialized_; //!< Initialization flag
logger::priority _logging_; //!< Logging priority
bool _initialized_ = false; //!< Initialization flag
logger::priority _logging_ = datatools::logger::PRIO_WARNING; //!< Logging priority

// Working data:
datatools::multi_properties _db_; //!< Main register
std::map<std::string,std::string> _db_aliases_; //!< Dictionary of aliases
datatools::multi_properties _db_; //!< Main register
std::map<std::string,std::string> _db_aliases_; //!< Dictionary of aliases

};

Expand Down
32 changes: 25 additions & 7 deletions source/bxdatatools/src/library_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ namespace datatools {
std::string & resolved_path_,
std::string & error_msg_) const
{
bool devel = false;
if (devel) std::cerr << "[devel] ************** library_info::resolve_path : " << path_ << std::endl;
bool failure = false;
resolved_path_.clear();
error_msg_.clear();
Expand All @@ -502,47 +504,61 @@ namespace datatools {
return failure;
}
std::string library_directive = path1.substr(0, cpos);
// std::cerr << "[devel] library_directive = " << library_directive << std::endl;
if (devel) std::cerr << "[devel] library_directive = " << library_directive << std::endl;
std::vector<std::string> lib_tokens;
boost::split(lib_tokens, library_directive, boost::is_any_of("."));
if (lib_tokens.size() == 0 || lib_tokens.size() > 2) {
error_msg_ = "Invalid format; malformed library name/topic in '" + path_ + "'";
return failure;
}
std::string library_name = lib_tokens[0];
// std::cerr << "[devel] library_name = " << library_name << std::endl;
if (devel) std::cerr << " [devel] ************** library_name = " << library_name << std::endl;
std::string library_topic = library_info::default_topic_label();
if (lib_tokens.size() > 1) {
library_topic = lib_tokens[1];
}
// std::cerr << "[devel] library_topic = " << library_topic << std::endl;
if (devel) std::cerr << " [devel] ************** library_topic = " << library_topic << std::endl;
if (!library_info::topic_labels().count(library_topic)) {
error_msg_ = "Unsupported topic '" + library_topic + "' in '" + path_ + "'";
return failure;
}
std::string install_path_key = library_info::topic_label_to_install_key(library_topic);
std::string environ_path_key = library_info::topic_label_to_env_key(library_topic);

if (devel) {
std::cerr << " [devel] ************** install_path_key = " << install_path_key << std::endl;
std::cerr << " [devel] ************** environ_path_key = " << environ_path_key << std::endl;
}

if (!this->has(library_name)) {
error_msg_ = "Unregistered library '" + library_name + "' in the kernel library register";
error_msg_ = "Unregistered library/component '" + library_name + "' in the kernel library register";
if (devel) std::cerr << " [devel] ************** error: " << error_msg_ << std::endl;
return failure;
}
const datatools::properties & lib_infos = this->get(library_name);

if (devel) {
std::cerr << " [devel] ************** lib_infos=" << std::hex << &lib_infos << std::endl;
lib_infos.tree_dump(std::cerr, "Lib info: ", " [devel] ");
}

// Search for the topic directory path from the register:
std::string topic_dir_str;

// Attempt 1: from the registered environment variable name (if any):
if (topic_dir_str.empty() && !environ_path_key.empty()) {
if ( lib_infos.has_key(environ_path_key)) {
if (devel) std::cerr << " [devel] ************** using environ_path_key = " << environ_path_key << std::endl;
std::string env_topic_dir = lib_infos.fetch_string(environ_path_key);
if (devel) std::cerr << " [devel] ************** env_topic_dir = " << env_topic_dir << std::endl;
if (! env_topic_dir.empty()) {
if (devel) std::cerr << " [devel] ************** Searching env_value ..." << std::endl;
const char *env_value = getenv(env_topic_dir.c_str());
if (env_value != 0) {
// Found the 'env_topic_dir' environment variable:
topic_dir_str = std::string(env_value);
if (devel) std::cerr << " [devel] ************** topic_dir_str=" << topic_dir_str << std::endl;
}
}
} else {
if (devel) std::cerr << " [devel] ************** No environ_path_key" << std::endl;
}
}

Expand Down Expand Up @@ -911,6 +927,8 @@ namespace datatools {
if (!title_.empty()) {
out_ << indent << title_ << std::endl;
}
out_ << indent << i_tree_dumpable::tag
<< "@Address : " << std::hex << this << std::endl;
out_ << indent << i_tree_dumpable::tag
<< "Initialized : " << _initialized_ << std::endl;
std::vector<std::string> libnames;
Expand Down
10 changes: 7 additions & 3 deletions source/bxdatatools/src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,6 @@ namespace datatools {
}
}
}

if (trace) {
DT_LOG_TRACE(datatools::logger::PRIO_TRACE, "Entering...");
}
Expand Down Expand Up @@ -718,7 +717,7 @@ namespace datatools {
DT_THROW(std::logic_error, "The path resolution from a mount point is not allowed!");
}
if (trace) {
DT_LOG_TRACE(datatools::logger::PRIO_TRACE, "Entering '@' mode...");
DT_LOG_TRACE(datatools::logger::PRIO_TRACE, "Entering '@' mode for text='" << text << "'");
}
DT_THROW_IF(! datatools::kernel::is_instantiated(),
std::runtime_error,
Expand All @@ -731,13 +730,18 @@ namespace datatools {
<< "No support for '@foo[.topic]:bar/blah.txt' syntax !");
const datatools::library_info & lib_info_reg =
datatools::kernel::instance().get_library_info_register();

if (trace) {
DT_LOG_TRACE(datatools::logger::PRIO_TRACE, "text='" << text << "'");
}
std::string resolved_path;
std::string errmsg;
if (!lib_info_reg.resolve_path(text, resolved_path, errmsg)) {
DT_THROW(std::logic_error,
"Cannot resolve path from mount point : " << errmsg << "!");
} else {
if (trace) {
DT_LOG_TRACE(datatools::logger::PRIO_TRACE, "resolved_path='"<< resolved_path << "'");
}
text = resolved_path;
registered_lib_topic = true;
}
Expand Down
3 changes: 1 addition & 2 deletions source/bxmygsl/src/multidimensional_minimization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ namespace mygsl {

const size_t multidimensional_minimization::DEFAULT_MAX_ITER = 1000;
const size_t multidimensional_minimization::DEFAULT_MODULO_ITER = 100;
const double multidimensional_minimization::DEFAULT_EPSABS = 1.e-3;

const double multidimensional_minimization::DEFAULT_EPSABS = 1.e-3;
const double multidimensional_minimization_system::DEFAULT_OUT_OF_LIMIT_SLOPE = 1.e10;

void multidimensional_minimization_system::set_numeric_eval_df (bool use_)
Expand Down

0 comments on commit 2fb85ae

Please sign in to comment.