Skip to content
Snippets Groups Projects
Commit 99bc6cf8 authored by Leal, Ricardo's avatar Leal, Ricardo
Browse files

Moved the place where sample closeGroup was called

parent 84786630
No related branches found
No related tags found
No related merge requests found
......@@ -638,32 +638,36 @@ void LoadEventNexus::loadEntryMetadata(const std::string &nexusfilename, T WS,
// appropriate state
try {
file.openGroup("sample", "NXsample");
if (exists(file, "name")) {
file.openData("name");
const auto info = file.getInfo();
std::string name;
if (info.type == ::NeXus::CHAR) {
if (info.dims.size() == 1) {
name = file.getStrData();
} else { // something special for 2-d array
const int64_t total_length = std::accumulate(
info.dims.begin(), info.dims.end(), static_cast<int64_t>(1),
std::multiplies<int64_t>());
boost::scoped_array<char> val_array(new char[total_length]);
file.getData(val_array.get());
file.closeData();
name = std::string(val_array.get(), total_length);
try {
if (exists(file, "name")) {
file.openData("name");
const auto info = file.getInfo();
std::string name;
if (info.type == ::NeXus::CHAR) {
if (info.dims.size() == 1) {
name = file.getStrData();
} else { // something special for 2-d array
const int64_t total_length = std::accumulate(
info.dims.begin(), info.dims.end(), static_cast<int64_t>(1),
std::multiplies<int64_t>());
boost::scoped_array<char> val_array(new char[total_length]);
file.getData(val_array.get());
file.closeData();
name = std::string(val_array.get(), total_length);
}
}
}
file.closeData();
file.closeData();
if (!name.empty()) {
WS->mutableSample().setName(name);
if (!name.empty()) {
WS->mutableSample().setName(name);
}
}
} catch (::NeXus::Exception &) {
// let it drop on floor if an exception occurs while reading sample
}
file.closeGroup();
} catch (::NeXus::Exception &) {
// let it drop on floor
// If an exception occurs while opening the group "sample"
}
// get the duration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment