Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:49

0001 #ifndef GeneratorInterface_LHEInterface_LHEProxy_h
0002 #define GeneratorInterface_LHEInterface_LHEProxy_h
0003 
0004 #include <memory>
0005 
0006 namespace lhef {
0007 
0008   // forward declarations
0009   class LHEEvent;
0010   class LHERunInfo;
0011 
0012   class LHEProxy {
0013   public:
0014     typedef unsigned long ProxyID;
0015 
0016     // not allowed and not implemented
0017     LHEProxy(const LHEProxy &orig) = delete;
0018     LHEProxy &operator=(const LHEProxy &orig) = delete;
0019 
0020     ~LHEProxy();
0021 
0022     const std::shared_ptr<LHERunInfo> &getRunInfo() const { return runInfo; }
0023     const std::shared_ptr<LHEEvent> &getEvent() const { return event; }
0024 
0025     std::shared_ptr<LHERunInfo> releaseRunInfo() {
0026       std::shared_ptr<LHERunInfo> result(runInfo);
0027       runInfo.reset();
0028       return result;
0029     }
0030     std::shared_ptr<LHEEvent> releaseEvent() {
0031       std::shared_ptr<LHEEvent> result(event);
0032       event.reset();
0033       return result;
0034     }
0035 
0036     void clearRunInfo() { runInfo.reset(); }
0037     void clearEvent() { event.reset(); }
0038 
0039     void loadRunInfo(const std::shared_ptr<LHERunInfo> &runInfo) { this->runInfo = runInfo; }
0040     void loadEvent(const std::shared_ptr<LHEEvent> &event) { this->event = event; }
0041 
0042     ProxyID getID() const { return id; }
0043 
0044     static std::shared_ptr<LHEProxy> create();
0045     static std::shared_ptr<LHEProxy> find(ProxyID id);
0046 
0047   private:
0048     LHEProxy(ProxyID id);
0049 
0050     const ProxyID id;
0051 
0052     std::shared_ptr<LHERunInfo> runInfo;
0053     std::shared_ptr<LHEEvent> event;
0054   };
0055 
0056 }  // namespace lhef
0057 
0058 #endif  // GeneratorProxy_LHEInterface_LHEProxy_h