Mantid
Loading...
Searching...
No Matches
InstrumentInfo.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidKernel/DllConfig.h"
15
16#include <map>
17#include <set>
18#include <string>
19#include <vector>
20
21//----------------------------------------------------------------------
22// Forward declarations
23//----------------------------------------------------------------------
24namespace Poco {
25namespace XML {
26class Element;
27}
28} // namespace Poco
29
30namespace Mantid {
31namespace Kernel {
32
33//----------------------------------------------------------------------
34// Forward declarations
35//----------------------------------------------------------------------
36class FacilityInfo;
37
40class MANTID_KERNEL_DLL InstrumentInfo {
41public:
43 InstrumentInfo(const FacilityInfo *f, const Poco::XML::Element *elem);
45 bool operator==(const InstrumentInfo &rhs) const;
47 const std::string name() const;
49 const std::string shortName() const;
51 int zeroPadding(unsigned int runNumber) const;
53 std::string filePrefix(unsigned int runNumber) const;
55 std::string delimiter() const;
57 const std::set<std::string> &techniques() const;
59 const FacilityInfo &facility() const;
60
62 std::string liveListener(const std::string &name = "") const;
64 std::string liveDataAddress(const std::string &name = "") const;
66 const LiveListenerInfo &liveListenerInfo(std::string name = "") const;
68 bool hasLiveListenerInfo() const;
70 const std::vector<LiveListenerInfo> &liveListenerInfoList() const;
71 const std::vector<TopicInfo> &topicInfoList() const { return m_kafkaTopics; }
72
73private:
74 void fillTechniques(const Poco::XML::Element *elem);
75 void fillLiveData(const Poco::XML::Element *elem);
76 void fillZeroPadding(const Poco::XML::Element *elem);
77
80 using ZeroPaddingMap = std::map<unsigned int, std::pair<std::string, int>>;
82 int getZeroPadding(ZeroPaddingMap::const_iterator it) const { return it->second.second; }
84 const std::string &getPrefix(ZeroPaddingMap::const_iterator it) const { return it->second.first; }
85
87 std::string m_name;
88 std::string m_shortName;
90 std::string m_delimiter;
91 std::set<std::string> m_technique;
92
93 std::vector<LiveListenerInfo> m_listeners;
94 std::vector<TopicInfo> m_kafkaTopics;
95 std::string m_defaultListener;
96};
97
99MANTID_KERNEL_DLL std::ostream &operator<<(std::ostream &buffer, const InstrumentInfo &instrumentDescriptor);
100
101} // namespace Kernel
102} // namespace Mantid
const std::vector< double > & rhs
A class that holds information about a facility.
Definition: FacilityInfo.h:36
A class that holds information about an instrument.
const std::vector< TopicInfo > & topicInfoList() const
std::vector< TopicInfo > m_kafkaTopics
Kafka topics.
std::string m_name
Instrument name.
std::string m_shortName
Instrument short name.
std::string m_defaultListener
Default LiveListener connection to use.
const FacilityInfo * m_facility
Facility.
const std::string & getPrefix(ZeroPaddingMap::const_iterator it) const
get the prefix part
int getZeroPadding(ZeroPaddingMap::const_iterator it) const
get the zeropadding part
std::set< std::string > m_technique
List of techniques the instrument can do.
std::string m_delimiter
Delimiter between instrument name and run number.
ZeroPaddingMap m_zeroPadding
Run number-dependent zero padding.
std::vector< LiveListenerInfo > m_listeners
LiveListener connections.
std::map< unsigned int, std::pair< std::string, int > > ZeroPaddingMap
Typedef for the zeropadding holder, first is starting run-number, second is file prefix - zero paddin...
A class that holds information about a LiveListener connection.
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.
Definition: CPUTimer.cpp:86
Helper class which provides the Collimation Length for SANS instruments.
Definition: Algorithm.h:30
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)