psana/src/ExpNameFromConfig.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: ExpNameFromConfig.cpp 3038 2012-03-08 22:12:17Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class ExpNameFromConfig...
00007 //
00008 // Author List:
00009 //      Andy Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana/ExpNameFromConfig.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 #include <utility>
00022 
00023 //-------------------------------
00024 // Collaborating Class Headers --
00025 //-------------------------------
00026 #include "ExpNameDb/ExpNameDatabase.h"
00027 #include "MsgLogger/MsgLogger.h"
00028 
00029 //-----------------------------------------------------------------------
00030 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00031 //-----------------------------------------------------------------------
00032 
00033 using namespace std;
00034 
00035 namespace {
00036 
00037   const char* logger = "ExpNameFromConfig";
00038 
00039 }
00040 
00041 //              ----------------------------------------
00042 //              -- Public Function Member Definitions --
00043 //              ----------------------------------------
00044 
00045 namespace psana {
00046 
00047 //----------------
00048 // Constructors --
00049 //----------------
00050 ExpNameFromConfig::ExpNameFromConfig (const std::string& instr, const std::string& exp)
00051   : IExpNameProvider()
00052   , m_instr(instr)
00053   , m_exp(exp)
00054   , m_expNum(0)
00055 {
00056   ExpNameDb::ExpNameDatabase namedb;
00057   if (m_instr.empty()) {
00058     const pair<string, unsigned>& res = namedb.getInstrumentAndID(m_exp);
00059     if (res.first.empty()) {
00060       MsgLog(logger, warning, "ExpNameFromConfig: failed to find experiment name " << m_exp);
00061     }
00062     m_instr = res.first;
00063     m_expNum = res.second;
00064   } else {
00065     m_expNum = namedb.getID(m_instr, m_exp);
00066     if (m_expNum == 0) {
00067       MsgLog(logger, warning, "ExpNameFromConfig: failed to find instrument/experiment name " << m_instr << "/" << m_exp);
00068     }
00069   }
00070 }
00071 
00072 //--------------
00073 // Destructor --
00074 //--------------
00075 ExpNameFromConfig::~ExpNameFromConfig ()
00076 {
00077 }
00078 
00079 } // namespace psana

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7