File indexing completed on 2025-09-13 09:10:11
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 class RLogChannel;
0029
0030
0031 ROOT::RLogChannel &BrowserLog();
0032
0033 class RBrowserDataCleanup;
0034
0035 class RBrowserData {
0036
0037 friend class RBrowserDataCleanup;
0038
0039 std::shared_ptr<Browsable::RElement> fTopElement;
0040
0041 Browsable::RElementPath_t fWorkingPath;
0042
0043 std::vector<std::pair<Browsable::RElementPath_t, std::shared_ptr<Browsable::RElement>>> fCache;
0044
0045 Browsable::RElementPath_t fLastPath;
0046 std::shared_ptr<Browsable::RElement> fLastElement;
0047 std::vector<std::unique_ptr<Browsable::RItem>> fLastItems;
0048 bool fLastAllChilds{false};
0049 std::vector<const Browsable::RItem *> fLastSortedItems;
0050 std::string fLastSortMethod;
0051 bool fLastSortReverse{false};
0052 std::unique_ptr<TObject> fCleanupHandle;
0053
0054 void ResetLastRequestData(bool with_element);
0055
0056 bool ProcessBrowserRequest(const RBrowserRequest &request, RBrowserReply &reply);
0057
0058 public:
0059 RBrowserData();
0060
0061 RBrowserData(std::shared_ptr<Browsable::RElement> elem) : RBrowserData() { SetTopElement(elem); }
0062
0063 virtual ~RBrowserData();
0064
0065 void SetTopElement(std::shared_ptr<Browsable::RElement> elem);
0066
0067 void SetWorkingPath(const Browsable::RElementPath_t &path);
0068
0069 void CreateDefaultElements();
0070
0071 const Browsable::RElementPath_t &GetWorkingPath() const { return fWorkingPath; }
0072
0073 std::string ProcessRequest(const RBrowserRequest &request);
0074
0075 std::shared_ptr<Browsable::RElement> GetElement(const std::string &str);
0076 std::shared_ptr<Browsable::RElement> GetElementFromTop(const Browsable::RElementPath_t &path);
0077
0078 Browsable::RElementPath_t DecomposePath(const std::string &path, bool relative_to_work_element);
0079 std::shared_ptr<Browsable::RElement> GetSubElement(const Browsable::RElementPath_t &path);
0080
0081 void ClearCache();
0082
0083 bool RemoveFromCache(void *obj);
0084
0085 bool RemoveFromCache(const Browsable::RElementPath_t &path);
0086
0087 };
0088
0089
0090 }
0091
0092 #endif