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

Defines the properties of a named SampleEnvironment setup. More...

#include <SampleEnvironmentSpec.h>

Public Types

using ComponentList = std::vector< Geometry::IObject_const_sptr >
 
using ContainerIndex = std::unordered_map< std::string, Geometry::Container_const_sptr >
 

Public Member Functions

void addComponent (const Geometry::IObject_const_sptr &component)
 Add a non-can component to the specification. More...
 
void addContainer (const Geometry::Container_const_sptr &can)
 Adds a can definition to the known list. More...
 
Geometry::SampleEnvironment_uptr buildEnvironment (const std::string &canID) const
 Build a new SampleEnvironment instance from a given can ID. More...
 
Geometry::Container_const_sptr findContainer (const std::string &id) const
 Find a can by id string. More...
 
const std::string & name () const
 
size_t ncans () const
 
size_t ncomponents () const
 
 SampleEnvironmentSpec (std::string name)
 Constructor. More...
 

Private Attributes

ContainerIndex m_cans
 
ComponentList m_components
 
std::string m_name
 

Detailed Description

Defines the properties of a named SampleEnvironment setup.

It is used in conjunction with the SampleEnvionmentBuilder to construct given configuration of SampleEnvironment. It can be read from XML by a SampleEnvironmentParser.

Definition at line 26 of file SampleEnvironmentSpec.h.

Member Typedef Documentation

◆ ComponentList

Definition at line 30 of file SampleEnvironmentSpec.h.

◆ ContainerIndex

Definition at line 29 of file SampleEnvironmentSpec.h.

Constructor & Destructor Documentation

◆ SampleEnvironmentSpec()

Mantid::DataHandling::SampleEnvironmentSpec::SampleEnvironmentSpec ( std::string  name)

Constructor.

Parameters
nameThe string name of the specification

Definition at line 15 of file SampleEnvironmentSpec.cpp.

Member Function Documentation

◆ addComponent()

void Mantid::DataHandling::SampleEnvironmentSpec::addComponent ( const Geometry::IObject_const_sptr component)

Add a non-can component to the specification.

Parameters
componentA pointer to a Object

Definition at line 68 of file SampleEnvironmentSpec.cpp.

References m_components.

Referenced by Mantid::DataHandling::SampleEnvironmentSpecParser::loadFullSpecification(), and Mantid::DataHandling::SampleEnvironmentSpecParser::parseAndAddComponents().

◆ addContainer()

void Mantid::DataHandling::SampleEnvironmentSpec::addContainer ( const Geometry::Container_const_sptr can)

Adds a can definition to the known list.

Parameters
canA pointer to a Container object
Exceptions
std::invalid::argumentif the id is empty

Definition at line 56 of file SampleEnvironmentSpec.cpp.

References m_cans.

Referenced by Mantid::DataHandling::SampleEnvironmentSpecParser::loadFullSpecification(), and Mantid::DataHandling::SampleEnvironmentSpecParser::parseAndAddContainers().

◆ buildEnvironment()

Geometry::SampleEnvironment_uptr Mantid::DataHandling::SampleEnvironmentSpec::buildEnvironment ( const std::string &  canID) const

Build a new SampleEnvironment instance from a given can ID.

Returns
A new instance of a SampleEnvironment

Definition at line 43 of file SampleEnvironmentSpec.cpp.

References findContainer(), m_components, and m_name.

Referenced by Mantid::DataHandling::SampleEnvironmentFactory::create().

◆ findContainer()

Geometry::Container_const_sptr Mantid::DataHandling::SampleEnvironmentSpec::findContainer ( const std::string &  id) const

Find a can by id string.

Parameters
idThe string id to search for
Returns
A pointer to the retrieved Container instance
Exceptions
std::invalid_argument

Definition at line 23 of file SampleEnvironmentSpec.cpp.

References m_cans.

Referenced by buildEnvironment().

◆ name()

const std::string & Mantid::DataHandling::SampleEnvironmentSpec::name ( ) const
inline
Returns
The name of the specification

Definition at line 35 of file SampleEnvironmentSpec.h.

◆ ncans()

size_t Mantid::DataHandling::SampleEnvironmentSpec::ncans ( ) const
inline
Returns
The number of known cans

Definition at line 37 of file SampleEnvironmentSpec.h.

Referenced by Mantid::DataHandling::SampleEnvironmentSpecParser::loadFullSpecification().

◆ ncomponents()

size_t Mantid::DataHandling::SampleEnvironmentSpec::ncomponents ( ) const
inline
Returns
The number of non-can components

Definition at line 39 of file SampleEnvironmentSpec.h.

Member Data Documentation

◆ m_cans

ContainerIndex Mantid::DataHandling::SampleEnvironmentSpec::m_cans
private

Definition at line 49 of file SampleEnvironmentSpec.h.

Referenced by addContainer(), and findContainer().

◆ m_components

ComponentList Mantid::DataHandling::SampleEnvironmentSpec::m_components
private

Definition at line 50 of file SampleEnvironmentSpec.h.

Referenced by addComponent(), and buildEnvironment().

◆ m_name

std::string Mantid::DataHandling::SampleEnvironmentSpec::m_name
private

Definition at line 48 of file SampleEnvironmentSpec.h.

Referenced by buildEnvironment().


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