Mantid
|
A class that holds information about an instrument. More...
#include <InstrumentInfo.h>
Public Member Functions | |
std::string | delimiter () const |
Returns the default delimiter between instrument name and run number. More... | |
const FacilityInfo & | facility () const |
The facility to which this instrument belongs. More... | |
std::string | filePrefix (unsigned int runNumber) const |
Returns file prefix for this instrument and a run number. More... | |
bool | hasLiveListenerInfo () const |
Returns true if this instrument has at least one live listener defined. More... | |
InstrumentInfo (const FacilityInfo *f, const Poco::XML::Element *elem) | |
Constructor. More... | |
std::string | liveDataAddress (const std::string &name="") const |
Returns a string containing the "host:port" for default live listener. More... | |
std::string | liveListener (const std::string &name="") const |
Returns the name of the default live listener. More... | |
const LiveListenerInfo & | liveListenerInfo (std::string name="") const |
Returns LiveListenerInfo for specified connection name (or default) More... | |
const std::vector< LiveListenerInfo > & | liveListenerInfoList () const |
Returns all available LiveListenerInfos as a vector. More... | |
const std::string | name () const |
Return the name of the instrument. More... | |
bool | operator== (const InstrumentInfo &rhs) const |
Equality operator. More... | |
const std::string | shortName () const |
Return the short name of the instrument. More... | |
const std::set< std::string > & | techniques () const |
Return list of techniques. More... | |
const std::vector< TopicInfo > & | topicInfoList () const |
int | zeroPadding (unsigned int runNumber) const |
Returns zero padding for this instrument and a run number. More... | |
Private Types | |
using | ZeroPaddingMap = std::map< unsigned int, std::pair< std::string, int > > |
Typedef for the zeropadding holder, first is starting run-number, second is file prefix - zero padding pair. More... | |
Private Member Functions | |
void | fillLiveData (const Poco::XML::Element *elem) |
Called from constructor to fill live listener name. More... | |
void | fillTechniques (const Poco::XML::Element *elem) |
Called from constructor to fill live listener name. More... | |
void | fillZeroPadding (const Poco::XML::Element *elem) |
Called from constructor to fill zero padding. More... | |
const std::string & | getPrefix (ZeroPaddingMap::const_iterator it) const |
get the prefix part More... | |
int | getZeroPadding (ZeroPaddingMap::const_iterator it) const |
get the zeropadding part More... | |
Private Attributes | |
std::string | m_defaultListener |
Default LiveListener connection to use. More... | |
std::string | m_delimiter |
Delimiter between instrument name and run number. More... | |
const FacilityInfo * | m_facility |
Facility. More... | |
std::vector< TopicInfo > | m_kafkaTopics |
Kafka topics. More... | |
std::vector< LiveListenerInfo > | m_listeners |
LiveListener connections. More... | |
std::string | m_name |
Instrument name. More... | |
std::string | m_shortName |
Instrument short name. More... | |
std::set< std::string > | m_technique |
List of techniques the instrument can do. More... | |
ZeroPaddingMap | m_zeroPadding |
Run number-dependent zero padding. More... | |
A class that holds information about an instrument.
Definition at line 40 of file InstrumentInfo.h.
|
private |
Typedef for the zeropadding holder, first is starting run-number, second is file prefix - zero padding pair.
Definition at line 80 of file InstrumentInfo.h.
Mantid::Kernel::InstrumentInfo::InstrumentInfo | ( | const FacilityInfo * | f, |
const Poco::XML::Element * | elem | ||
) |
Constructor.
f | :: The facility |
elem | :: The Poco::XML::Element to read the data from |
std::runtime_error | if name or at least one technique are not defined |
Definition at line 36 of file InstrumentInfo.cpp.
References Mantid::Kernel::FacilityInfo::delimiter(), fillLiveData(), fillTechniques(), fillZeroPadding(), m_delimiter, m_name, and m_shortName.
std::string Mantid::Kernel::InstrumentInfo::delimiter | ( | ) | const |
Returns the default delimiter between instrument name and run number.
Definition at line 61 of file InstrumentInfo.cpp.
References m_delimiter.
Referenced by export_InstrumentInfo(), and Mantid::API::FileFinderImpl::makeFileName().
const FacilityInfo & Mantid::Kernel::InstrumentInfo::facility | ( | ) | const |
The facility to which this instrument belongs.
Return the facility.
Definition at line 175 of file InstrumentInfo.cpp.
References m_facility.
Referenced by Mantid::WorkflowAlgorithms::DgsReduction::exec(), export_InstrumentInfo(), and Mantid::API::FileFinderImpl::findRun().
std::string Mantid::Kernel::InstrumentInfo::filePrefix | ( | unsigned int | runNumber | ) | const |
Returns file prefix for this instrument and a run number.
runNumber | :: A run number. |
Definition at line 96 of file InstrumentInfo.cpp.
References getPrefix(), m_shortName, and m_zeroPadding.
Referenced by export_InstrumentInfo(), and Mantid::API::FileFinderImpl::toInstrumentAndNumber().
|
private |
Called from constructor to fill live listener name.
Definition at line 248 of file InstrumentInfo.cpp.
References Mantid::Kernel::Logger::error(), Mantid::Kernel::DateAndTimeHelpers::g_log, m_defaultListener, m_kafkaTopics, m_listeners, and m_name.
Referenced by InstrumentInfo().
|
private |
Called from constructor to fill live listener name.
Definition at line 225 of file InstrumentInfo.cpp.
References m_name, m_technique, and n.
Referenced by InstrumentInfo().
|
private |
Called from constructor to fill zero padding.
Definition at line 178 of file InstrumentInfo.cpp.
References Mantid::Kernel::Strings::convert(), m_facility, m_name, m_shortName, m_zeroPadding, n, and Mantid::Kernel::FacilityInfo::zeroPadding().
Referenced by InstrumentInfo().
|
inlineprivate |
|
inlineprivate |
get the zeropadding part
Definition at line 82 of file InstrumentInfo.h.
Referenced by zeroPadding().
bool Mantid::Kernel::InstrumentInfo::hasLiveListenerInfo | ( | ) | const |
Returns true if this instrument has at least one live listener defined.
Definition at line 167 of file InstrumentInfo.cpp.
References m_listeners.
Referenced by export_InstrumentInfo(), liveDataAddress(), liveListener(), and liveListenerInfo().
std::string Mantid::Kernel::InstrumentInfo::liveDataAddress | ( | const std::string & | name = "" | ) | const |
Returns a string containing the "host:port" for default live listener.
Returns the host & port to connect to for a live data stream No guarantees are given that the provided string is well-formed and valid.
Definition at line 130 of file InstrumentInfo.cpp.
References Mantid::Kernel::LiveListenerInfo::address(), hasLiveListenerInfo(), liveListenerInfo(), and name().
Referenced by export_InstrumentInfo().
std::string Mantid::Kernel::InstrumentInfo::liveListener | ( | const std::string & | name = "" | ) | const |
Returns the name of the default live listener.
Returns the name of the live listener.
Definition at line 119 of file InstrumentInfo.cpp.
References hasLiveListenerInfo(), Mantid::Kernel::LiveListenerInfo::listener(), liveListenerInfo(), and name().
Referenced by export_InstrumentInfo().
const LiveListenerInfo & Mantid::Kernel::InstrumentInfo::liveListenerInfo | ( | std::string | name = "" | ) | const |
Returns LiveListenerInfo for specified connection name (or default)
Get LiveListenerInfo for specified connection (or default).
name | Name attribute of connection to return info on |
std::runtime_error | When no listeners, or name not found |
Definition at line 144 of file InstrumentInfo.cpp.
References hasLiveListenerInfo(), m_defaultListener, m_listeners, m_name, and name().
Referenced by export_InstrumentInfo(), liveDataAddress(), and liveListener().
const std::vector< LiveListenerInfo > & Mantid::Kernel::InstrumentInfo::liveListenerInfoList | ( | ) | const |
Returns all available LiveListenerInfos as a vector.
Definition at line 169 of file InstrumentInfo.cpp.
References m_listeners.
Referenced by export_InstrumentInfo().
const std::string Mantid::Kernel::InstrumentInfo::name | ( | ) | const |
Return the name of the instrument.
Definition at line 64 of file InstrumentInfo.cpp.
References m_name.
Referenced by export_InstrumentInfo(), Mantid::Kernel::FacilityInfo::instrument(), liveDataAddress(), liveListener(), Mantid::Kernel::LiveListenerInfo::LiveListenerInfo(), liveListenerInfo(), Mantid::Kernel::operator<<(), operator==(), and Mantid::Kernel::TopicInfo::TopicInfo().
bool Mantid::Kernel::InstrumentInfo::operator== | ( | const InstrumentInfo & | rhs | ) | const |
Equality operator.
Two objects are considered equal if their names and short names are the same.
rhs | :: The object to compare this with |
Definition at line 56 of file InstrumentInfo.cpp.
const std::string Mantid::Kernel::InstrumentInfo::shortName | ( | ) | const |
Return the short name of the instrument.
Definition at line 67 of file InstrumentInfo.cpp.
References m_shortName.
Referenced by export_InstrumentInfo(), MantidQt::MantidWidgets::InstrumentSelector::fillWithInstrumentsFromFacility(), and Mantid::API::FileFinderImpl::makeFileName().
const std::set< std::string > & Mantid::Kernel::InstrumentInfo::techniques | ( | ) | const |
Return list of techniques.
Definition at line 172 of file InstrumentInfo.cpp.
References m_technique.
Referenced by export_InstrumentInfo().
|
inline |
Definition at line 71 of file InstrumentInfo.h.
int Mantid::Kernel::InstrumentInfo::zeroPadding | ( | unsigned int | runNumber | ) | const |
Returns zero padding for this instrument and a run number.
Returns zero padding for this instrument.
Definition at line 70 of file InstrumentInfo.cpp.
References getZeroPadding(), m_facility, m_zeroPadding, and Mantid::Kernel::FacilityInfo::zeroPadding().
Referenced by export_InstrumentInfo(), and Mantid::API::FileFinderImpl::toInstrumentAndNumber().
|
private |
Default LiveListener connection to use.
Definition at line 95 of file InstrumentInfo.h.
Referenced by fillLiveData(), and liveListenerInfo().
|
private |
Delimiter between instrument name and run number.
Definition at line 90 of file InstrumentInfo.h.
Referenced by delimiter(), and InstrumentInfo().
|
private |
Facility.
Definition at line 86 of file InstrumentInfo.h.
Referenced by facility(), fillZeroPadding(), and zeroPadding().
|
private |
|
private |
LiveListener connections.
Definition at line 93 of file InstrumentInfo.h.
Referenced by fillLiveData(), hasLiveListenerInfo(), liveListenerInfo(), and liveListenerInfoList().
|
private |
Instrument name.
Definition at line 87 of file InstrumentInfo.h.
Referenced by fillLiveData(), fillTechniques(), fillZeroPadding(), InstrumentInfo(), liveListenerInfo(), and name().
|
private |
Instrument short name.
Definition at line 88 of file InstrumentInfo.h.
Referenced by filePrefix(), fillZeroPadding(), InstrumentInfo(), and shortName().
|
private |
List of techniques the instrument can do.
Definition at line 91 of file InstrumentInfo.h.
Referenced by fillTechniques(), and techniques().
|
private |
Run number-dependent zero padding.
Definition at line 89 of file InstrumentInfo.h.
Referenced by filePrefix(), fillZeroPadding(), and zeroPadding().