LHEProxy

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#ifndef GeneratorInterface_LHEInterface_LHEProxy_h
#define GeneratorInterface_LHEInterface_LHEProxy_h

#include <memory>

namespace lhef {

  // forward declarations
  class LHEEvent;
  class LHERunInfo;

  class LHEProxy {
  public:
    typedef unsigned long ProxyID;

    // not allowed and not implemented
    LHEProxy(const LHEProxy &orig) = delete;
    LHEProxy &operator=(const LHEProxy &orig) = delete;

    ~LHEProxy();

    const std::shared_ptr<LHERunInfo> &getRunInfo() const { return runInfo; }
    const std::shared_ptr<LHEEvent> &getEvent() const { return event; }

    std::shared_ptr<LHERunInfo> releaseRunInfo() {
      std::shared_ptr<LHERunInfo> result(runInfo);
      runInfo.reset();
      return result;
    }
    std::shared_ptr<LHEEvent> releaseEvent() {
      std::shared_ptr<LHEEvent> result(event);
      event.reset();
      return result;
    }

    void clearRunInfo() { runInfo.reset(); }
    void clearEvent() { event.reset(); }

    void loadRunInfo(const std::shared_ptr<LHERunInfo> &runInfo) { this->runInfo = runInfo; }
    void loadEvent(const std::shared_ptr<LHEEvent> &event) { this->event = event; }

    ProxyID getID() const { return id; }

    static std::shared_ptr<LHEProxy> create();
    static std::shared_ptr<LHEProxy> find(ProxyID id);

  private:
    LHEProxy(ProxyID id);

    const ProxyID id;

    std::shared_ptr<LHERunInfo> runInfo;
    std::shared_ptr<LHEEvent> event;
  };

}  // namespace lhef

#endif  // GeneratorProxy_LHEInterface_LHEProxy_h