Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::DataHandling::SampleEnvironmentSpecFileFinder Class Referencefinal

Class responsible for finding a specifications on disk. More...

#include <SampleEnvironmentFactory.h>

Inheritance diagram for Mantid::DataHandling::SampleEnvironmentSpecFileFinder:
Mantid::DataHandling::ISampleEnvironmentSpecFinder

Public Member Functions

SampleEnvironmentSpec_uptr find (const std::string &facility, const std::string &instrument, const std::string &name) const override
 Find a named specification in a file. More...
 
SampleEnvironmentSpec_uptr parseSpec (const std::string &name, const std::string &filename) const override
 Parses the specification from the given file. More...
 
 SampleEnvironmentSpecFileFinder (std::vector< std::string > directories)
 Constructor accepting a list of directories to search. More...
 
- Public Member Functions inherited from Mantid::DataHandling::ISampleEnvironmentSpecFinder
virtual SampleEnvironmentSpec_uptr find (const std::string &facility, const std::string &instrument, const std::string &name) const =0
 
virtual SampleEnvironmentSpec_uptr parseSpec (const std::string &name, const std::string &filename) const =0
 
virtual ~ISampleEnvironmentSpecFinder ()=default
 

Private Attributes

const std::string m_fileext = ".xml"
 
const std::vector< std::string > m_rootDirs
 

Detailed Description

Class responsible for finding a specifications on disk.

Definition at line 58 of file SampleEnvironmentFactory.h.

Constructor & Destructor Documentation

◆ SampleEnvironmentSpecFileFinder()

Mantid::DataHandling::SampleEnvironmentSpecFileFinder::SampleEnvironmentSpecFileFinder ( std::vector< std::string >  directories)

Constructor accepting a list of directories to search.

Parameters
directoriesA list of directories that form the root of the search path. Each entry will be appended with /facility/instrument/ and this directory then forms the path to find the named spec
Exceptions
std::invalid_argumentif the list is empty

Definition at line 127 of file SampleEnvironmentFactory.cpp.

References m_rootDirs.

Member Function Documentation

◆ find()

SampleEnvironmentSpec_uptr Mantid::DataHandling::SampleEnvironmentSpecFileFinder::find ( const std::string &  facility,
const std::string &  instrument,
const std::string &  name 
) const
overridevirtual

Find a named specification in a file.

Parameters
facilityName of facility
instrumentFull name of the instrument
nameThe name of the spec
Returns
The SampleEnvironmentSpec_uptr

Implements Mantid::DataHandling::ISampleEnvironmentSpecFinder.

Definition at line 141 of file SampleEnvironmentFactory.cpp.

References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, m_fileext, m_rootDirs, and parseSpec().

◆ parseSpec()

SampleEnvironmentSpec_uptr Mantid::DataHandling::SampleEnvironmentSpecFileFinder::parseSpec ( const std::string &  name,
const std::string &  filename 
) const
overridevirtual

Parses the specification from the given file.

Parameters
nameThe name of the specification
filenameAssumed to be an absolute path to an existing specification
Returns
A parse specification

Implements Mantid::DataHandling::ISampleEnvironmentSpecFinder.

Definition at line 182 of file SampleEnvironmentFactory.cpp.

References Mantid::DataHandling::SampleEnvironmentSpecParser::parse().

Referenced by find().

Member Data Documentation

◆ m_fileext

const std::string Mantid::DataHandling::SampleEnvironmentSpecFileFinder::m_fileext = ".xml"
private

Definition at line 67 of file SampleEnvironmentFactory.h.

Referenced by find().

◆ m_rootDirs

const std::vector<std::string> Mantid::DataHandling::SampleEnvironmentSpecFileFinder::m_rootDirs
private

Definition at line 68 of file SampleEnvironmentFactory.h.

Referenced by find(), and SampleEnvironmentSpecFileFinder().


The documentation for this class was generated from the following files: