Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #11101 Initial commit with some of the class structure.
- Loading branch information
Showing
4 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
Code/Mantid/Framework/API/inc/MantidAPI/FileBackedExperimentInfo.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef MANTID_API_FILEBACKEDEXPERIMENTINFO_H_ | ||
#define MANTID_API_FILEBACKEDEXPERIMENTINFO_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/ExperimentInfo.h" | ||
|
||
#if defined(__GLIBCXX__) && __GLIBCXX__ >= 20100121 // libstdc++-4.4.3 | ||
typedef std::unique_ptr< ::NeXus::File> file_holder_type; | ||
#else | ||
typedef std::auto_ptr< ::NeXus::File> file_holder_type; | ||
#endif | ||
|
||
namespace Mantid | ||
{ | ||
namespace API | ||
{ | ||
|
||
/** FileBackedExperimentInfo : TODO: DESCRIPTION | ||
Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport FileBackedExperimentInfo : public ExperimentInfo | ||
{ | ||
public: | ||
/// Constructor | ||
FileBackedExperimentInfo(::NeXus::File file, std::string groupName); | ||
/// Virtual destructor | ||
virtual ~FileBackedExperimentInfo(); | ||
|
||
private: | ||
void intialise(); | ||
::NeXus::File *file; | ||
std::string groupName; | ||
}; | ||
|
||
|
||
} // namespace API | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_API_FILEBACKEDEXPERIMENTINFO_H_ */ |
47 changes: 47 additions & 0 deletions
47
Code/Mantid/Framework/API/src/FileBackedExperimentInfo.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "MantidAPI/FileBackedExperimentInfo.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace API | ||
{ | ||
namespace { | ||
/// static logger object | ||
Kernel::Logger g_log("FileBackedExperimentInfo"); | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Constructor | ||
*/ | ||
FileBackedExperimentInfo::FileBackedExperimentInfo(::NeXus::File file, std::string groupName) | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Destructor | ||
*/ | ||
FileBackedExperimentInfo::~FileBackedExperimentInfo() | ||
{ | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------------ | ||
// Private members | ||
//------------------------------------------------------------------------------------------------------ | ||
/** | ||
* Here we actually load the data | ||
*/ | ||
void FileBackedExperimentInfo::intialise() { | ||
std::string parameterStr; | ||
try { | ||
// Get the sample, logs, instrument | ||
this->loadExperimentInfoNexus(file, parameterStr); | ||
// Now do the parameter map | ||
this->readParameterMap(parameterStr); | ||
} catch (std::exception &e) { | ||
g_log.information("Error loading section '" + groupName + | ||
"' of nxs file."); | ||
g_log.information(e.what()); | ||
} | ||
} | ||
|
||
} // namespace API | ||
} // namespace Mantid |
29 changes: 29 additions & 0 deletions
29
Code/Mantid/Framework/API/test/FileBackedExperimentInfoTest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef MANTID_API_FILEBACKEDEXPERIMENTINFOTEST_H_ | ||
#define MANTID_API_FILEBACKEDEXPERIMENTINFOTEST_H_ | ||
|
||
#include <cxxtest/TestSuite.h> | ||
|
||
#include "MantidAPI/FileBackedExperimentInfo.h" | ||
|
||
using Mantid::API::FileBackedExperimentInfo; | ||
using namespace Mantid::API; | ||
|
||
class FileBackedExperimentInfoTest : public CxxTest::TestSuite | ||
{ | ||
public: | ||
// This pair of boilerplate methods prevent the suite being created statically | ||
// This means the constructor isn't called when running other tests | ||
static FileBackedExperimentInfoTest *createSuite() { return new FileBackedExperimentInfoTest(); } | ||
static void destroySuite( FileBackedExperimentInfoTest *suite ) { delete suite; } | ||
|
||
|
||
void test_Something() | ||
{ | ||
TSM_ASSERT( "You forgot to write a test!", 0); | ||
} | ||
|
||
|
||
}; | ||
|
||
|
||
#endif /* MANTID_API_FILEBACKEDEXPERIMENTINFOTEST_H_ */ |