Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:32

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2022 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 
0012 #ifndef GAUDIKERNEL_JOBHISTORY_H
0013 #define GAUDIKERNEL_JOBHISTORY_H
0014 
0015 #include "GaudiKernel/HistoryObj.h"
0016 #include "GaudiKernel/IVersHistoryObj.h"
0017 #include <Gaudi/Property.h>
0018 
0019 #include <ctime>
0020 #include <iosfwd>
0021 #include <memory>
0022 #include <string>
0023 #include <utility>
0024 #include <vector>
0025 
0026 /** @class JobHistory JobHistory.h
0027  *
0028  *  JobHistory class definition
0029  *
0030  *  @author: Charles Leggett
0031  *
0032  */
0033 class GAUDI_API JobHistory : public HistoryObj, virtual public IVersHistoryObj {
0034 
0035 public:
0036   typedef std::vector<std::pair<std::string, std::unique_ptr<Gaudi::Property<std::string>>>> PropertyPairList;
0037 
0038 private: // data
0039   std::string m_release_version;
0040   std::string m_dir;
0041   std::string m_cmtconfig;
0042 
0043   std::string m_osname;
0044   std::string m_hostname;
0045   std::string m_os_version;
0046   std::string m_machine;
0047 
0048   std::vector<std::string> m_environ;
0049 
0050   PropertyList     m_props;
0051   PropertyPairList m_ppl;
0052 
0053   std::vector<std::string> m_CVSid;
0054   time_t                   m_start_time;
0055 
0056 public: // functions
0057   // Constructor.
0058   JobHistory();
0059   JobHistory( const std::string& rel, const std::string& os, const std::string& host, const std::string& dir,
0060               const std::string& osver, const std::string& mach, const std::string& cmtconfig, const time_t& time );
0061 
0062   // Destructor.
0063   virtual ~JobHistory();
0064 
0065   // Class IDs
0066   const CLID&        clID() const override { return classID(); }
0067   static const CLID& classID();
0068 
0069   // add a global property
0070   void addProperty( const std::string& key, const std::string& value );
0071 
0072   // Return the job history data.
0073   std::string              release_version() const { return m_release_version; }
0074   std::string              os() const { return m_osname; }
0075   std::string              hostname() const { return m_hostname; }
0076   std::string              os_version() const { return m_os_version; }
0077   std::string              machine() const { return m_machine; }
0078   std::string              dir() const { return m_dir; }
0079   std::string              cmtconfig() const { return m_cmtconfig; }
0080   std::vector<std::string> environment() const { return m_environ; }
0081   const PropertyList&      properties() const override { return m_props; }
0082   const PropertyPairList&  propertyPairs() const { return m_ppl; }
0083   time_t                   start_time() const { return m_start_time; }
0084 
0085   std::ostream& dump( std::ostream&, bool isXML, int indent ) const override;
0086 
0087   const std::string& name() const override { return m_machine; }
0088   const std::string& version() const override { return m_release_version; }
0089   const std::string& type() const override { return m_osname; }
0090 
0091   // Output stream.
0092   friend std::ostream& operator<<( std::ostream& lhs, const JobHistory& rhs ) { return rhs.dump( lhs, false, 0 ); }
0093 };
0094 
0095 #endif