Skip to content

Commit

Permalink
First lot of updates for new loader check style. Refs #7263
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Jul 4, 2013
1 parent ff1f7ad commit 5eec929
Show file tree
Hide file tree
Showing 36 changed files with 326 additions and 798 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/IDataFileChecker.h"
#include "MantidAPI/IHDFFileLoader.h"
#include "MantidDataObjects/EventWorkspace.h"
#include <nexus/NeXusFile.hpp>
#include <nexus/NeXusException.hpp>
Expand Down Expand Up @@ -68,7 +68,7 @@ namespace Mantid
File change history is stored at: <https://github.com/mantidproject/mantid>
*/
class DLLExport LoadEventNexus : public API::IDataFileChecker
class DLLExport LoadEventNexus : public API::IHDFFileLoader
{
public:
/// Sets documentation strings for this algorithm
Expand All @@ -80,10 +80,8 @@ namespace Mantid
virtual int version() const { return 1;};
virtual const std::string category() const { return "DataHandling\\Nexus";}

/// do a quick check that this file can be loaded
bool quickFileCheck(const std::string& filePath,size_t nread,const file_header& header);
/// check the structure of the file and return a value between 0 and 100 of how much this file can be loaded
int fileCheck(const std::string& filePath);
/// Returns a confidence value that this algorithm can load a file
int confidence(const Kernel::HDFDescriptor & descriptor) const;

/** Sets whether the pixel counts will be pre-counted.
* @param value :: true if you want to precount. */
Expand Down
29 changes: 11 additions & 18 deletions Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadILL.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
//---------------------------------------------------
// Includes
//---------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidAPI/IHDFFileLoader.h"
#include "MantidNexus/NexusClasses.h"

namespace Mantid {
Expand Down Expand Up @@ -39,14 +38,13 @@ namespace DataHandling {
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadILL: public API::IDataFileChecker {
class DLLExport LoadILL: public API::IHDFFileLoader
{
public:
/// Constructor
LoadILL() :
API::IDataFileChecker(), m_instrumentName(""),
//m_nexusInstrumentEntryName(""),
m_wavelength(0), m_channelWidth(0) {

LoadILL() : API::IHDFFileLoader(), m_instrumentName(""),
m_wavelength(0), m_channelWidth(0)
{
supportedInstruments.push_back("IN4");
supportedInstruments.push_back("IN5");
supportedInstruments.push_back("IN6");
Expand All @@ -67,11 +65,10 @@ namespace DataHandling {
virtual const std::string category() const {
return "DataHandling";
}
///checks the file can be loaded by reading 1st 100 bytes and looking at the file extension.
bool quickFileCheck(const std::string& filePath, size_t nread,
const file_header& header);
/// check the structure of the file and if this file can be loaded return a value between 1 and 100
int fileCheck(const std::string& filePath);

/// Returns a confidence value that this algorithm can load a file
int confidence(const Kernel::HDFDescriptor & descriptor) const;

private:
/// Sets documentation strings for this algorithm
virtual void initDocs();
Expand All @@ -81,7 +78,7 @@ namespace DataHandling {
void exec();

void setInstrumentName(NeXus::NXEntry& entry);
std::string getInstrumentName(NeXus::NXEntry& entry);
std::string getInstrumentName(NeXus::NXEntry& entry) const;
void initWorkSpace(NeXus::NXEntry& entry);
void initInstrumentSpecific();
void loadRunDetails(NeXus::NXEntry & entry);
Expand Down Expand Up @@ -122,10 +119,6 @@ namespace DataHandling {

std::vector<std::string> supportedInstruments;

// Nexus instrument entry is of the format /entry0/<XXX>/
// XXX changes from version to version
std::string m_nexusInstrumentEntryName;

};

} // namespace DataHandling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidAPI/IHDFFileLoader.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidDataHandling/ISISRunLogs.h"
#include "MantidNexus/NexusClasses.h"
Expand Down Expand Up @@ -67,7 +67,7 @@ namespace Mantid
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadISISNexus2 : public API::IDataFileChecker
class DLLExport LoadISISNexus2 : public API::IHDFFileLoader
{
public:
/// Default constructor
Expand All @@ -81,11 +81,9 @@ namespace Mantid
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "DataHandling\\Nexus"; }

/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

/// do a quick check that this file can be loaded
virtual bool quickFileCheck(const std::string& filePath,size_t nread,const file_header& header);
/// check the structure of the file and return a value between 0 and 100 of how much this file can be loaded
virtual int fileCheck(const std::string& filePath);
/// Spectra block descriptor
struct SpectraBlock
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#define MANTID_DATAHANDLING_LOADLLB_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidAPI/IHDFFileLoader.h"
#include "MantidNexus/NexusClasses.h"

namespace Mantid
Expand Down Expand Up @@ -33,26 +32,24 @@ namespace DataHandling
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadLLB: public API::IDataFileChecker {
class DLLExport LoadLLB: public API::IHDFFileLoader {
public:
LoadLLB();
virtual ~LoadLLB();

virtual const std::string name() const;
virtual int version() const;
virtual const std::string category() const;
///checks the file can be loaded by reading 1st 100 bytes and looking at the file extension.
bool quickFileCheck(const std::string& filePath, size_t nread,
const file_header& header);
/// check the structure of the file and if this file can be loaded return a value between 1 and 100
int fileCheck(const std::string& filePath);

/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

private:
virtual void initDocs();
void init();
void exec();
void setInstrumentName(NeXus::NXEntry& entry);
std::string getInstrumentName(NeXus::NXEntry& entry);
std::string getInstrumentName(NeXus::NXEntry& entry) const;
void initWorkSpace(NeXus::NXEntry&);
void loadTimeDetails(NeXus::NXEntry& entry);
void loadDataIntoTheWorkSpace(NeXus::NXEntry&);
Expand All @@ -71,7 +68,6 @@ class DLLExport LoadLLB: public API::IDataFileChecker {
void runLoadInstrument();

std::vector<std::string> supportedInstruments;
std::string m_nexusInstrumentEntryName;
std::string m_instrumentName;
API::MatrixWorkspace_sptr m_localWorkspace;
size_t m_numberOfTubes; // number of tubes - X
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#define MANTID_DATAHANDLING_LOADMCSTASNEXUS_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidAPI/IHDFFileLoader.h"

namespace Mantid
{
Expand Down Expand Up @@ -32,7 +31,7 @@ namespace DataHandling
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadMcStasNexus : public API::IDataFileChecker
class DLLExport LoadMcStasNexus : public API::IHDFFileLoader
{
public:
LoadMcStasNexus();
Expand All @@ -42,10 +41,8 @@ namespace DataHandling
virtual int version() const;
virtual const std::string category() const;

/// do a quick check that this file can be loaded
virtual bool quickFileCheck(const std::string& filePath,size_t nread,const file_header& header);
/// check the structure of the file and return a value between 0 and 100 of how much this file can be loaded
virtual int fileCheck(const std::string& filePath);
/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

private:
virtual void initDocs();
Expand All @@ -59,4 +56,4 @@ namespace DataHandling
} // namespace DataHandling
} // namespace Mantid

#endif /* MANTID_DATAHANDLING_LOADMCSTASNEXUS_H_ */
#endif /* MANTID_DATAHANDLING_LOADMCSTASNEXUS_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IHDFFileLoader.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidKernel/System.h"

//----------------------------------------------------------------------
Expand Down Expand Up @@ -59,7 +58,7 @@ namespace Mantid
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadMuonNexus : public API::IDataFileChecker
class DLLExport LoadMuonNexus : public API::IHDFFileLoader
{
public:
/// Default constructor
Expand All @@ -73,10 +72,9 @@ namespace Mantid
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "DataHandling\\Nexus;Muon"; }

/// do a quick check that this file can be loaded
virtual bool quickFileCheck(const std::string& filePath,size_t nread,const file_header& header);
/// check the structure of the file and return a value between 0 and 100 of how much this file can be loaded
virtual int fileCheck(const std::string& filePath);
/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

protected:

virtual void runLoadInstrumentFromNexus(DataObjects::Workspace2D_sptr) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ namespace Mantid
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "DataHandling\\Nexus;Muon"; }

/// check the structure of the file and return a value between 0 and 100 of how much this file can be loaded
virtual int fileCheck(const std::string& filePath);
/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

protected:
/// Overwrites Algorithm method
void exec();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidDataHandling/LoadMuonNexus.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidNexus/NexusClasses.h"

namespace Mantid
Expand Down Expand Up @@ -70,8 +69,9 @@ namespace Mantid
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "DataHandling\\Nexus;Muon"; }

/// check the structure of the file and return a value between 0 and 100 of how much this file can be loaded
virtual int fileCheck(const std::string& filePath);
/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

private:
/// Sets documentation strings for this algorithm
virtual void initDocs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#define MANTID_DATAHANDLING_LOADNXSPE_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidAPI/IHDFFileLoader.h"

namespace Mantid
{
Expand Down Expand Up @@ -39,7 +38,7 @@ namespace DataHandling
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadNXSPE : public API::IDataFileChecker
class DLLExport LoadNXSPE : public API::IHDFFileLoader
{
public:
LoadNXSPE();
Expand All @@ -51,11 +50,9 @@ namespace DataHandling
virtual int version() const { return 1;};
/// Algorithm's category for identification
virtual const std::string category() const { return "DataHandling\\Nexus;DataHandling\\SPE;Inelastic";}
/// Do a quick check that this file can be loaded
virtual bool quickFileCheck(const std::string& filePath,size_t nread,const file_header& header);
/// check the structure of the file and return a value between
/// 0 and 100 of how much this file can be loaded
virtual int fileCheck(const std::string& filePath);

/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

private:
/// Sets documentation strings for this algorithm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidAPI/IHDFFileLoader.h"

#include "MantidNexus/NexusClasses.h"
#include <nexus/NeXusFile.hpp>
Expand Down Expand Up @@ -48,7 +47,7 @@ namespace Mantid
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadNexusProcessed : public API::IDataFileChecker
class DLLExport LoadNexusProcessed : public API::IHDFFileLoader
{

public:
Expand All @@ -63,10 +62,8 @@ namespace Mantid
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "DataHandling\\Nexus";}

/// do a quick check that this file can be loaded
virtual bool quickFileCheck(const std::string& filePath,size_t nread,const file_header& header);
/// check the structure of the file and return a value between 0 and 100 of how much this file can be loaded
virtual int fileCheck(const std::string& filePath);
/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

private:
/// Sets documentation strings for this algorithm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
//---------------------------------------------------
// Includes
//---------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IDataFileChecker.h"
#include "MantidAPI/IHDFFileLoader.h"

namespace Mantid
{
Expand Down Expand Up @@ -38,7 +37,7 @@ namespace DataHandling
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadQKK : public API::IDataFileChecker
class DLLExport LoadQKK : public API::IHDFFileLoader
{
public:
/// (Empty) Constructor
Expand All @@ -52,10 +51,8 @@ class DLLExport LoadQKK : public API::IDataFileChecker
/// Algorithm's category for identification
virtual const std::string category() const { return "DataHandling"; }

/// do a quick check that this file can be loaded
virtual bool quickFileCheck(const std::string& filePath,size_t nread,const file_header& header);
/// check the structure of the file and return a value between 0 and 100 of how much this file can be loaded
virtual int fileCheck(const std::string& filePath);
/// Returns a confidence value that this algorithm can load a file
virtual int confidence(const Kernel::HDFDescriptor & descriptor) const;

private:
/// Sets documentation strings for this algorithm
Expand Down

0 comments on commit 5eec929

Please sign in to comment.