/** Constructor.
    * @param f :: The facility
    * @param elem :: The Poco::XML::Element to read the data from
    * @throw std::runtime_error if name or at least one technique are not defined
    */
    InstrumentInfo::InstrumentInfo(const FacilityInfo* f,const Poco::XML::Element* elem)
      : m_facility(f), m_liveListener(), m_liveDataAddress()
    {

      m_name = elem->getAttribute("name");
      if (m_name.empty())
      {
        throw std::runtime_error("Instrument name is not defined");
      }

      // The string to separate the instrument name and the run number.
      m_delimiter = elem->getAttribute("delimiter");
      if (m_delimiter.empty())
      {
        m_delimiter = f->delimiter();
      }

      m_shortName = elem->getAttribute("shortname");
      if (m_shortName.empty())
      {
        m_shortName = m_name;
      }

      fillTechniques(elem);
      fillLiveData(elem);
      fillZeroPadding(elem);
    }
Exemple #2
0
/** Constructor.
  * @param elem :: The Poco::XML::Element to read the data from
  * @throw std::runtime_error if name or file extensions are not defined
  */
FacilityInfo::FacilityInfo(const Poco::XML::Element *elem)
    : m_catalogs(elem), m_name(elem->getAttribute("name")), m_zeroPadding(0),
      m_delimiter(), m_extensions(), m_archiveSearch(), m_instruments(),
      m_liveListener(), m_computeResources() {
  if (m_name.empty()) {
    g_log.error("Facility name is not defined");
    throw std::runtime_error("Facility name is not defined");
  }

  // Fill the various fields from the XML
  fillZeroPadding(elem);
  fillDelimiter(elem);
  fillExtensions(elem);
  fillArchiveNames(elem);
  fillLiveListener(elem);
  fillComputeResources(elem);
  fillInstruments(elem); // Make sure this is last as it picks up some defaults
                         // that are set above
}