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

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 FacilityInfofacility () 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 LiveListenerInfoliveListenerInfo (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 FacilityInfom_facility
 Facility. More...
 
std::vector< TopicInfom_kafkaTopics
 Kafka topics. More...
 
std::vector< LiveListenerInfom_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...
 

Detailed Description

A class that holds information about an instrument.

Definition at line 40 of file InstrumentInfo.h.

Member Typedef Documentation

◆ ZeroPaddingMap

using Mantid::Kernel::InstrumentInfo::ZeroPaddingMap = std::map<unsigned int, std::pair<std::string, int> >
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.

Constructor & Destructor Documentation

◆ InstrumentInfo()

Mantid::Kernel::InstrumentInfo::InstrumentInfo ( const FacilityInfo f,
const Poco::XML::Element *  elem 
)

Constructor.

Parameters
f:: The facility
elem:: The Poco::XML::Element to read the data from
Exceptions
std::runtime_errorif 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.

Member Function Documentation

◆ delimiter()

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().

◆ facility()

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().

◆ filePrefix()

std::string Mantid::Kernel::InstrumentInfo::filePrefix ( unsigned int  runNumber) const

Returns file prefix for this instrument and a run number.

Parameters
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().

◆ fillLiveData()

void Mantid::Kernel::InstrumentInfo::fillLiveData ( const Poco::XML::Element *  elem)
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().

◆ fillTechniques()

void Mantid::Kernel::InstrumentInfo::fillTechniques ( const Poco::XML::Element *  elem)
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().

◆ fillZeroPadding()

void Mantid::Kernel::InstrumentInfo::fillZeroPadding ( const Poco::XML::Element *  elem)
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().

◆ getPrefix()

const std::string & Mantid::Kernel::InstrumentInfo::getPrefix ( ZeroPaddingMap::const_iterator  it) const
inlineprivate

get the prefix part

Definition at line 84 of file InstrumentInfo.h.

Referenced by filePrefix().

◆ getZeroPadding()

int Mantid::Kernel::InstrumentInfo::getZeroPadding ( ZeroPaddingMap::const_iterator  it) const
inlineprivate

get the zeropadding part

Definition at line 82 of file InstrumentInfo.h.

Referenced by zeroPadding().

◆ hasLiveListenerInfo()

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().

◆ liveDataAddress()

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.

  • the caller should check this themselves

Definition at line 130 of file InstrumentInfo.cpp.

References Mantid::Kernel::LiveListenerInfo::address(), hasLiveListenerInfo(), liveListenerInfo(), and name().

Referenced by export_InstrumentInfo().

◆ liveListener()

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().

◆ liveListenerInfo()

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).

Parameters
nameName attribute of connection to return info on
Returns
Reference to LiveListenerInfo for specified connection
Exceptions
std::runtime_errorWhen 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().

◆ liveListenerInfoList()

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().

◆ name()

const std::string Mantid::Kernel::InstrumentInfo::name ( ) const

◆ operator==()

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.

Parameters
rhs:: The object to compare this with
Returns
True if the objects are considered equal, false otherwise

Definition at line 56 of file InstrumentInfo.cpp.

References name(), and rhs.

◆ shortName()

const std::string Mantid::Kernel::InstrumentInfo::shortName ( ) const

◆ techniques()

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().

◆ topicInfoList()

const std::vector< TopicInfo > & Mantid::Kernel::InstrumentInfo::topicInfoList ( ) const
inline

Definition at line 71 of file InstrumentInfo.h.

◆ zeroPadding()

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().

Member Data Documentation

◆ m_defaultListener

std::string Mantid::Kernel::InstrumentInfo::m_defaultListener
private

Default LiveListener connection to use.

Definition at line 95 of file InstrumentInfo.h.

Referenced by fillLiveData(), and liveListenerInfo().

◆ m_delimiter

std::string Mantid::Kernel::InstrumentInfo::m_delimiter
private

Delimiter between instrument name and run number.

Definition at line 90 of file InstrumentInfo.h.

Referenced by delimiter(), and InstrumentInfo().

◆ m_facility

const FacilityInfo* Mantid::Kernel::InstrumentInfo::m_facility
private

Facility.

Definition at line 86 of file InstrumentInfo.h.

Referenced by facility(), fillZeroPadding(), and zeroPadding().

◆ m_kafkaTopics

std::vector<TopicInfo> Mantid::Kernel::InstrumentInfo::m_kafkaTopics
private

Kafka topics.

Definition at line 94 of file InstrumentInfo.h.

Referenced by fillLiveData().

◆ m_listeners

std::vector<LiveListenerInfo> Mantid::Kernel::InstrumentInfo::m_listeners
private

LiveListener connections.

Definition at line 93 of file InstrumentInfo.h.

Referenced by fillLiveData(), hasLiveListenerInfo(), liveListenerInfo(), and liveListenerInfoList().

◆ m_name

std::string Mantid::Kernel::InstrumentInfo::m_name
private

Instrument name.

Definition at line 87 of file InstrumentInfo.h.

Referenced by fillLiveData(), fillTechniques(), fillZeroPadding(), InstrumentInfo(), liveListenerInfo(), and name().

◆ m_shortName

std::string Mantid::Kernel::InstrumentInfo::m_shortName
private

Instrument short name.

Definition at line 88 of file InstrumentInfo.h.

Referenced by filePrefix(), fillZeroPadding(), InstrumentInfo(), and shortName().

◆ m_technique

std::set<std::string> Mantid::Kernel::InstrumentInfo::m_technique
private

List of techniques the instrument can do.

Definition at line 91 of file InstrumentInfo.h.

Referenced by fillTechniques(), and techniques().

◆ m_zeroPadding

ZeroPaddingMap Mantid::Kernel::InstrumentInfo::m_zeroPadding
private

Run number-dependent zero padding.

Definition at line 89 of file InstrumentInfo.h.

Referenced by filePrefix(), fillZeroPadding(), and zeroPadding().


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