Mantid
Loading...
Searching...
No Matches
InstrumentMetadata.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2026 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
10
11#include <stdexcept>
12
13namespace Mantid::Geometry {
14
15InstrumentMetadata::InstrumentMetadata(const Types::Core::DateAndTime &validFromDate,
16 const Types::Core::DateAndTime &validToDate, const std::string &filename,
17 const std::string &xmlText, const std::string &defaultView,
18 const std::string &defaultAxis,
19 const std::shared_ptr<const ComponentInfo> &physicalComponentInfo,
20 const std::shared_ptr<const DetectorInfo> &physicalDetectorInfo)
21 : m_validFromDate(validFromDate), m_validToDate(validToDate), m_filename(filename), m_xmlText(xmlText),
22 m_defaultView(defaultView), m_defaultAxis(defaultAxis), m_physicalComponentInfo(physicalComponentInfo),
23 m_physicalDetectorInfo(physicalDetectorInfo) {}
24
25const Types::Core::DateAndTime &InstrumentMetadata::validFromDate() const { return m_validFromDate; }
26
27const Types::Core::DateAndTime &InstrumentMetadata::validToDate() const { return m_validToDate; }
28
29const std::string &InstrumentMetadata::filename() const { return m_filename; }
30
31const std::string &InstrumentMetadata::xmlText() const { return m_xmlText; }
32
33const std::string &InstrumentMetadata::defaultView() const { return m_defaultView; }
34
35const std::string &InstrumentMetadata::defaultAxis() const { return m_defaultAxis; }
36
37bool InstrumentMetadata::hasPhysicalInstrument() const { return static_cast<bool>(m_physicalComponentInfo); }
38
41 throw std::runtime_error("Cannot return reference to NULL physical ComponentInfo");
42 }
44}
45
48 throw std::runtime_error("Cannot return reference to NULL physical DetectorInfo");
49 }
51}
52
53void InstrumentMetadata::setFileName(const std::string &filename) { m_filename = filename; }
54
55void InstrumentMetadata::setXmlText(const std::string &xmlText) { m_xmlText = xmlText; }
56
57void InstrumentMetadata::setDefaultView(const std::string &defaultView) { m_defaultView = defaultView; }
58
59void InstrumentMetadata::setDefaultViewAxis(const std::string &defaultAxis) { m_defaultAxis = defaultAxis; }
60
61} // namespace Mantid::Geometry
ComponentInfo : Provides a component centric view on to the instrument.
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
void setFileName(const std::string &filename)
std::shared_ptr< const DetectorInfo > m_physicalDetectorInfo
Types::Core::DateAndTime m_validFromDate
void setDefaultView(const std::string &defaultView)
bool hasPhysicalInstrument() const
INDIRECT GEOMETRY INSTRUMENTS ONLY : true if a physical instrument was specified, distinct from the n...
std::shared_ptr< const ComponentInfo > m_physicalComponentInfo
const Types::Core::DateAndTime & validFromDate() const
InstrumentMetadata(const Types::Core::DateAndTime &validFromDate, const Types::Core::DateAndTime &validToDate, const std::string &filename, const std::string &xmlText, const std::string &defaultView, const std::string &defaultAxis, const std::shared_ptr< const ComponentInfo > &physicalComponentInfo=nullptr, const std::shared_ptr< const DetectorInfo > &physicalDetectorInfo=nullptr)
void setDefaultViewAxis(const std::string &defaultAxis)
const ComponentInfo & physicalComponentInfo() const
INDIRECT GEOMETRY INSTRUMENTS ONLY : the ComponentInfo of the physical instrument.
const Types::Core::DateAndTime & validToDate() const
const DetectorInfo & physicalDetectorInfo() const
INDIRECT GEOMETRY INSTRUMENTS ONLY : the DetectorInfo of the physical instrument.
const std::string & defaultAxis() const
void setXmlText(const std::string &xmlText)
const std::string & defaultView() const