60 {
61
64 return StatusCode::SUCCESS;
65 }
66
67
69 if (fileWithPath.empty()) {
71 return StatusCode::FAILURE;
72 }
73
74
76 if (
stat(fileWithPath.c_str(), &buffer) != 0) {
78 << fileWithPath.c_str()
79 << "\" -> map can not be initialized from this file.");
80 return StatusCode::FAILURE;
81 }
82
83
84 std::ifstream
fin(fileWithPath.c_str(), std::ios::in);
86 bool initializedWithWarnings = false;
87
88 while (std::getline(fin, line)) {
89
90 if (
line.empty() ||
line.compare(0, 1,
"#") == 0 ||
91 line.compare(0, 2,
"//")) {
92 continue;
93 }
94
95 std::stringstream lineStream(line);
96
97 std::string token;
98 std::vector<std::string> tokenVector;
99 while (std::getline(lineStream, token, ',')) {
100 tokenVector.push_back(token);
101 }
102
103 if (tokenVector.size() == 2) {
104
105
106
108 Identifier
id(identifierCompact);
109 float shift = std::stof(tokenVector[1]);
111 } else {
113 << fileWithPath.c_str());
116 initializedWithWarnings = true;
117 }
118 }
120 if (initializedWithWarnings) {
122 << fileWithPath.c_str() << "\"");
123 } else {
124 ATH_MSG_INFO(
"Successfully initialized shift map from file \""
125 << fileWithPath.c_str() << "\"");
126 }
127 return StatusCode::SUCCESS;
128}
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)