File indexing completed on 2025-01-18 10:10:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT7_RBrowserData
0014 #define ROOT7_RBrowserData
0015
0016 #include <ROOT/Browsable/RElement.hxx>
0017
0018 #include <ROOT/RBrowserRequest.hxx>
0019 #include <ROOT/RBrowserReply.hxx>
0020
0021 #include <memory>
0022 #include <string>
0023 #include <vector>
0024 #include <utility>
0025
0026 namespace ROOT {
0027
0028 namespace Experimental {
0029 class RLogChannel;
0030 }
0031
0032
0033 ROOT::Experimental::RLogChannel &BrowserLog();
0034
0035 class RBrowserDataCleanup;
0036
0037 class RBrowserData {
0038
0039 friend class RBrowserDataCleanup;
0040
0041 std::shared_ptr<Browsable::RElement> fTopElement;
0042
0043 Browsable::RElementPath_t fWorkingPath;
0044
0045 std::vector<std::pair<Browsable::RElementPath_t, std::shared_ptr<Browsable::RElement>>> fCache;
0046
0047 Browsable::RElementPath_t fLastPath;
0048 std::shared_ptr<Browsable::RElement> fLastElement;
0049 std::vector<std::unique_ptr<Browsable::RItem>> fLastItems;
0050 bool fLastAllChilds{false};
0051 std::vector<const Browsable::RItem *> fLastSortedItems;
0052 std::string fLastSortMethod;
0053 bool fLastSortReverse{false};
0054 std::unique_ptr<TObject> fCleanupHandle;
0055
0056 void ResetLastRequestData(bool with_element);
0057
0058 bool ProcessBrowserRequest(const RBrowserRequest &request, RBrowserReply &reply);
0059
0060 public:
0061 RBrowserData();
0062
0063 RBrowserData(std::shared_ptr<Browsable::RElement> elem) : RBrowserData() { SetTopElement(elem); }
0064
0065 virtual ~RBrowserData();
0066
0067 void SetTopElement(std::shared_ptr<Browsable::RElement> elem);
0068
0069 void SetWorkingPath(const Browsable::RElementPath_t &path);
0070
0071 void CreateDefaultElements();
0072
0073 const Browsable::RElementPath_t &GetWorkingPath() const { return fWorkingPath; }
0074
0075 std::string ProcessRequest(const RBrowserRequest &request);
0076
0077 std::shared_ptr<Browsable::RElement> GetElement(const std::string &str);
0078 std::shared_ptr<Browsable::RElement> GetElementFromTop(const Browsable::RElementPath_t &path);
0079
0080 Browsable::RElementPath_t DecomposePath(const std::string &path, bool relative_to_work_element);
0081 std::shared_ptr<Browsable::RElement> GetSubElement(const Browsable::RElementPath_t &path);
0082
0083 void ClearCache();
0084
0085 bool RemoveFromCache(void *obj);
0086
0087 bool RemoveFromCache(const Browsable::RElementPath_t &path);
0088
0089 };
0090
0091
0092 }
0093
0094 #endif