Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:38

0001 /*************************************************************************
0002  * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0007  *************************************************************************/
0008 
0009 #ifndef ROOT7_RDrawableRequest
0010 #define ROOT7_RDrawableRequest
0011 
0012 #include <string>
0013 #include <cstdint>
0014 #include <memory>
0015 
0016 #include <ROOT/RDrawable.hxx>
0017 
0018 namespace ROOT {
0019 namespace Experimental {
0020 
0021 
0022 /** \class RDrawableReply
0023 \ingroup GpadROOT7
0024 \brief Base class for replies on RDrawableRequest
0025 \author Sergey Linev <s.linev@gsi.de>
0026 \date 2020-04-14
0027 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0028 */
0029 
0030 class RDrawableReply {
0031    uint64_t reqid{0}; ///< request id
0032 
0033 public:
0034 
0035    void SetRequestId(uint64_t _reqid) { reqid = _reqid; }
0036    uint64_t GetRequestId() const { return reqid; }
0037 
0038    virtual ~RDrawableReply();
0039 };
0040 
0041 
0042 /** \class RDrawableRequest
0043 \ingroup GpadROOT7
0044 \brief Base class for requests which can be submitted from the clients
0045 \author Sergey Linev <s.linev@gsi.de>
0046 \date 2020-04-14
0047 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0048 */
0049 
0050 class RDrawableRequest {
0051    std::string id; ///< drawable id
0052    uint64_t reqid{0}; ///< request id
0053 
0054    RDrawable::RDisplayContext fContext; ///<! display context
0055 
0056    //const RCanvas *fCanvas{nullptr}; ///<! pointer on canvas, can be used in Process
0057    //const RPadBase *fPad{nullptr};   ///<! pointer on pad with drawable, can be used in Process
0058    //RDrawable *fDrawable{nullptr};   ///<! pointer on drawable, can be used in Process
0059 
0060 public:
0061    const std::string &GetId() const { return id; }
0062    uint64_t GetRequestId() const { return reqid; }
0063 
0064    const RDrawable::RDisplayContext &GetContext() const { return fContext; }
0065    RDrawable::RDisplayContext &GetContext() { return fContext; }
0066 
0067    //void SetCanvas(const RCanvas *canv) { fCanvas = canv; }
0068    //void SetPad(const RPadBase *pad) { fPad = pad; }
0069    //void SetDrawable(RDrawable *dr) { fDrawable = dr; }
0070 
0071    virtual ~RDrawableRequest();
0072 
0073    bool ShouldBeReplyed() const { return GetRequestId() > 0; }
0074 
0075    virtual std::unique_ptr<RDrawableReply> Process() { return nullptr; }
0076 
0077    virtual bool NeedCanvasUpdate() const { return false; }
0078 };
0079 
0080 
0081 /** \class RDrawableExecRequest
0082 \ingroup GpadROOT7
0083 \brief Request execution of method of referenced drawable, no reply
0084 \author Sergey Linev <s.linev@gsi.de>
0085 \date 2020-04-14
0086 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0087 */
0088 
0089 class RDrawableExecRequest : public RDrawableRequest {
0090    std::string exec; ///< that to execute
0091 public:
0092    std::unique_ptr<RDrawableReply> Process() override;
0093 };
0094 
0095 } // namespace Experimental
0096 } // namespace ROOT
0097 
0098 
0099 #endif