Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-14 11:45:01

0001 #ifndef Fireworks_Core_FWJobMetadataManager
0002 #define Fireworks_Core_FWJobMetadataManager
0003 
0004 #include "Fireworks/Core/interface/FWTypeToRepresentations.h"
0005 
0006 #include "sigc++/signal.h"
0007 
0008 #include <string>
0009 #include <vector>
0010 
0011 class FWJobMetadataUpdateRequest;
0012 class FWTypeToRepresentations;
0013 
0014 /** Base class which keeps track of various  job specific metadata information.
0015     fwlite and (eventually) full-framework derived implementations are where 
0016     the job is actually done.
0017    */
0018 class FWJobMetadataManager {
0019 public:
0020   struct Data {
0021     std::string purpose_;
0022     std::string type_;
0023     std::string moduleLabel_;
0024     std::string productInstanceLabel_;
0025     std::string processName_;
0026   };
0027 
0028   FWJobMetadataManager();
0029   virtual ~FWJobMetadataManager();
0030 
0031   std::vector<Data> &usableData() { return m_metadata; }
0032   std::vector<std::string> &processNamesInJob() { return m_processNamesInJob; }
0033 
0034   /** Invoked when a given update request needs to happen. Will
0035        emit the metadataChanged_ signal when done so that observers can 
0036        update accordingly.
0037        
0038        Derived classes should implement the doUpdate() protected method
0039        to actually modify the metadata according to the request.
0040        
0041        Notice that this method is a consumer of request object and takes
0042        ownership of the lifetime of the request objects.
0043      */
0044   void update(FWJobMetadataUpdateRequest *request);
0045 
0046   /** This needs to be invoked to make the metadata manager keep track of
0047        the changes in the TypeToRepresentation.
0048      */
0049   void initReps(const FWTypeToRepresentations &iTypeAndReps);
0050 
0051   // needed by FWDetailViewManager
0052   virtual bool hasModuleLabel(std::string &moduleLabel) = 0;
0053 
0054   sigc::signal<void()> metadataChanged_;
0055 
0056 protected:
0057   /** This is the bit that needs to be implemented by a derived class 
0058        to update the various metadata structures.
0059        
0060        @return true if any update actually took place.
0061      */
0062   virtual bool doUpdate(FWJobMetadataUpdateRequest *) = 0;
0063   std::vector<Data> m_metadata;
0064   std::vector<std::string> m_processNamesInJob;
0065   FWTypeToRepresentations *m_typeAndReps;
0066 };
0067 
0068 #endif