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