Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 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 #ifndef GAUDIKERNEL_ALGORITHMHISTORY_H
0012 #define GAUDIKERNEL_ALGORITHMHISTORY_H
0013 
0014 // An object of this class carries the history information
0015 // which is specific to a Gaudi algorithm.
0016 
0017 #include "GaudiKernel/HistoryObj.h"
0018 #include "GaudiKernel/IVersHistoryObj.h"
0019 
0020 #include <iosfwd>
0021 #include <string>
0022 #include <typeinfo>
0023 #include <vector>
0024 
0025 namespace Gaudi {
0026   class Algorithm;
0027 }
0028 class JobHistory;
0029 
0030 /** @class AlgorithmHistory AlgorithmHistory.h
0031  *
0032  *  AlgorithmHistory class definition
0033  *
0034  *  @author: Charles Leggett
0035  *
0036  */
0037 
0038 class GAUDI_API AlgorithmHistory : public HistoryObj, public IVersHistoryObj {
0039 
0040 public: // typedefs
0041   // List of subalgorithm histories. This may change.
0042   typedef std::vector<const AlgorithmHistory*> HistoryList;
0043 
0044 private: // data
0045   // Algorithm full type.
0046   std::string m_algorithm_type;
0047 
0048   // Algorithm version.
0049   std::string m_algorithm_version;
0050 
0051   // Algorithm name.
0052   std::string m_algorithm_name;
0053 
0054   // Algorithm
0055   const Gaudi::Algorithm* m_algorithm;
0056 
0057   // Properties.
0058   PropertyList m_properties;
0059 
0060   // Subalgorithm histories.
0061   HistoryList m_subalgorithm_histories;
0062 
0063   // Link to jobHistory
0064   const JobHistory* m_jobHistory;
0065 
0066 public: // functions
0067   // Constructor from the algorithm.
0068   explicit AlgorithmHistory( const Gaudi::Algorithm& alg, const JobHistory* job );
0069 
0070   // All-fields Constructor for persistency
0071   explicit AlgorithmHistory( std::string algVersion, std::string algName, std::string algType,
0072                              const PropertyList& props, const HistoryList& subHists );
0073   // Destructor.
0074   virtual ~AlgorithmHistory();
0075 
0076   // Class IDs
0077   const CLID&        clID() const override { return classID(); }
0078   static const CLID& classID();
0079 
0080   // Return the algorithm type.
0081   const std::string& algorithm_type() const { return m_algorithm_type; }
0082 
0083   // Return the algorithm version.
0084   const std::string& algorithm_version() const { return m_algorithm_version; }
0085 
0086   // Return the algorithm name.
0087   const std::string& algorithm_name() const { return m_algorithm_name; }
0088 
0089   // The actual algorithm
0090   const Gaudi::Algorithm* algorithm() const { return m_algorithm; }
0091 
0092   // Return the algorithm properties.
0093   const PropertyList& properties() const override { return m_properties; }
0094 
0095   // Return the subalgorithm histories.
0096   const HistoryList& subalgorithm_histories() const { return m_subalgorithm_histories; }
0097 
0098   // Return the jobHistory
0099   const JobHistory* jobHistory() const { return m_jobHistory; }
0100 
0101   std::ostream& dump( std::ostream&, bool isXML, int indent ) const override;
0102 
0103   const std::string& name() const override { return algorithm_name(); }
0104   const std::string& type() const override { return algorithm_type(); }
0105   const std::string& version() const override { return algorithm_version(); }
0106 
0107   // Output stream.
0108   friend std::ostream& operator<<( std::ostream& lhs, const AlgorithmHistory& rhs ) {
0109     return rhs.dump( lhs, false, 0 );
0110   }
0111 };
0112 
0113 #endif