File indexing completed on 2025-08-06 08:17:10
0001 #include "PdbParameterMap.h"
0002
0003 #include <boost/functional/hash.hpp>
0004
0005 #include <iostream>
0006
0007 void PdbParameterMap::print() const
0008 {
0009 std::cout << "PdbParameterMap::print - Hash 0x" << std::hex << get_hash() << std::dec << std::endl;
0010
0011 std::cout << "double parameters: " << std::endl;
0012 for (const auto &dparam : dparams)
0013 {
0014 std::cout << dparam.first << ": " << dparam.second << std::endl;
0015 }
0016 std::cout << "integer parameters: " << std::endl;
0017 for (const auto &iparam : iparams)
0018 {
0019 std::cout << iparam.first << ": " << iparam.second << std::endl;
0020 }
0021 std::cout << "string parameters: " << std::endl;
0022 for (const auto &cparam : cparams)
0023 {
0024 std::cout << cparam.first << ": " << cparam.second << std::endl;
0025 }
0026 }
0027
0028 void PdbParameterMap::Reset()
0029 {
0030 dparams.clear();
0031 iparams.clear();
0032 cparams.clear();
0033 return;
0034 }
0035
0036 void PdbParameterMap::set_int_param(const std::string &name, const int ival)
0037 {
0038 iparams[name] = ival;
0039 }
0040
0041 void PdbParameterMap::set_double_param(const std::string &name, const double dval)
0042 {
0043 dparams[name] = dval;
0044 }
0045
0046 void PdbParameterMap::set_string_param(const std::string &name, const std::string &str)
0047 {
0048 cparams[name] = str;
0049 }
0050
0051 size_t
0052 PdbParameterMap::get_hash() const
0053 {
0054 size_t seed = 0;
0055
0056 for (const auto &dparam : dparams)
0057 {
0058
0059 boost::hash_combine(seed, dparam.first);
0060 boost::hash_combine(seed, dparam.second);
0061
0062 }
0063
0064 for (const auto &iparam : iparams)
0065 {
0066
0067 boost::hash_combine(seed, iparam.first);
0068 boost::hash_combine(seed, iparam.second);
0069
0070 }
0071
0072 for (const auto &cparam : cparams)
0073 {
0074
0075 boost::hash_combine(seed, cparam.first);
0076 boost::hash_combine(seed, cparam.second);
0077
0078 }
0079
0080 return seed;
0081 }