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

Create a single instance of a SampleEnvironment. More...

#include <SampleEnvironmentFactory.h>

Public Member Functions

size_t cacheSize () const
 
void clearCache ()
 Clear the cache of SampleEnvironmentSpec objects. More...
 
Geometry::SampleEnvironment_uptr create (const std::string &facility, const std::string &instrument, const std::string &specName, const std::string &canName)
 Create a new SampleEnvironment instance from the given specification and can. More...
 
SampleEnvironmentSpec_uptr parseSpec (const std::string &filename, const std::string &filepath) const
 Calls SampleEnvironmentSpecFileFinder::parseSpec. More...
 
 SampleEnvironmentFactory ()=default
 
 SampleEnvironmentFactory (ISampleEnvironmentSpecFinder_uptr specFinder)
 Constructor accepting a pointer to a finder object. More...
 

Private Attributes

ISampleEnvironmentSpecFinder_uptr m_finder
 

Detailed Description

Create a single instance of a SampleEnvironment.

It requires the name of a sample environment specification and a can name.

The specifications are cached in a static lookup. The class is implemented using the monostate pattern

Definition at line 36 of file SampleEnvironmentFactory.h.

Constructor & Destructor Documentation

◆ SampleEnvironmentFactory() [1/2]

Mantid::DataHandling::SampleEnvironmentFactory::SampleEnvironmentFactory ( )
default

◆ SampleEnvironmentFactory() [2/2]

Mantid::DataHandling::SampleEnvironmentFactory::SampleEnvironmentFactory ( ISampleEnvironmentSpecFinder_uptr  specFinder)

Constructor accepting a pointer to a finder object.

Parameters
specFinderA reference to an object used to retrieve find a given specification.

Definition at line 60 of file SampleEnvironmentFactory.cpp.

Member Function Documentation

◆ cacheSize()

size_t Mantid::DataHandling::SampleEnvironmentFactory::cacheSize ( ) const
Returns
the number of cache entries

Definition at line 95 of file SampleEnvironmentFactory.cpp.

◆ clearCache()

void Mantid::DataHandling::SampleEnvironmentFactory::clearCache ( )

Clear the cache of SampleEnvironmentSpec objects.

Definition at line 100 of file SampleEnvironmentFactory.cpp.

◆ create()

Geometry::SampleEnvironment_uptr Mantid::DataHandling::SampleEnvironmentFactory::create ( const std::string &  facility,
const std::string &  instrument,
const std::string &  specName,
const std::string &  canName 
)

Create a new SampleEnvironment instance from the given specification and can.

SampleEnvironmentSpec

Parameters
facilityName of facility
instrumentFull name of the instrument
specNameThe name of a specification
canNameThe name of a can within the spec
Returns
A new instance of the given environment

Definition at line 72 of file SampleEnvironmentFactory.cpp.

References Mantid::DataHandling::SampleEnvironmentSpec::buildEnvironment(), and m_finder.

Referenced by Mantid::DataHandling::SetSample::setSampleEnvironmentFromFile().

◆ parseSpec()

SampleEnvironmentSpec_uptr Mantid::DataHandling::SampleEnvironmentFactory::parseSpec ( const std::string &  filename,
const std::string &  filepath 
) const

Calls SampleEnvironmentSpecFileFinder::parseSpec.

Parameters
filenameThe name of the specification
filepathAssumed to be an absolute path to an existing specification
Returns
A parse specification

Definition at line 108 of file SampleEnvironmentFactory.cpp.

References m_finder.

Referenced by Mantid::DataHandling::SetSample::setSampleEnvironmentFromFile().

Member Data Documentation

◆ m_finder

ISampleEnvironmentSpecFinder_uptr Mantid::DataHandling::SampleEnvironmentFactory::m_finder
private

Definition at line 49 of file SampleEnvironmentFactory.h.

Referenced by create(), and parseSpec().


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