Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RBrowserData.hxx
Go to the documentation of this file.
1// Author: Sergey Linev <S.Linev@gsi.de>
2// Date: 2019-10-14
3// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
4
5/*************************************************************************
6 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT7_RBrowserData
14#define ROOT7_RBrowserData
15
17
20
21#include <memory>
22#include <string>
23#include <vector>
24#include <utility>
25
26namespace ROOT {
27namespace Experimental {
28
29class RLogChannel;
30/// Log channel for Browser diagnostics.
31RLogChannel &BrowserLog();
32
33class RBrowserDataCleanup;
34
36
37 friend class RBrowserDataCleanup;
38
39 std::shared_ptr<Browsable::RElement> fTopElement; ///<! top element
40
41 Browsable::RElementPath_t fWorkingPath; ///<! path showed in Breadcrumb
42
43 std::vector<std::pair<Browsable::RElementPath_t, std::shared_ptr<Browsable::RElement>>> fCache; ///<! already requested elements
44
45 Browsable::RElementPath_t fLastPath; ///<! path to last used element
46 std::shared_ptr<Browsable::RElement> fLastElement; ///<! last element used in request
47 std::vector<std::unique_ptr<Browsable::RItem>> fLastItems; ///<! created browser items - used in requests
48 bool fLastAllChilds{false}; ///<! if all chlds were extracted
49 std::vector<const Browsable::RItem *> fLastSortedItems; ///<! sorted child items, used in requests
50 std::string fLastSortMethod; ///<! last sort method
51 bool fLastSortReverse{false}; ///<! last request reverse order
52 std::unique_ptr<RBrowserDataCleanup> fCleanupHandle; ///<! cleanup handle for RecursiveRemove
53
54 void ResetLastRequestData(bool with_element);
55
56 bool ProcessBrowserRequest(const RBrowserRequest &request, RBrowserReply &reply);
57
58public:
60
61 RBrowserData(std::shared_ptr<Browsable::RElement> elem) : RBrowserData() { SetTopElement(elem); }
62
63 virtual ~RBrowserData();
64
65 void SetTopElement(std::shared_ptr<Browsable::RElement> elem);
66
68
70
72
73 std::string ProcessRequest(const RBrowserRequest &request);
74
75 std::shared_ptr<Browsable::RElement> GetElement(const std::string &str);
76 std::shared_ptr<Browsable::RElement> GetElementFromTop(const Browsable::RElementPath_t &path);
77
78 Browsable::RElementPath_t DecomposePath(const std::string &path, bool relative_to_work_element);
79 std::shared_ptr<Browsable::RElement> GetSubElement(const Browsable::RElementPath_t &path);
80
81 void ClearCache();
82
83 bool RemoveFromCache(void *obj);
84
86
87};
88
89
90} // namespace Experimental
91} // namespace ROOT
92
93#endif
Way to browse (hopefully) everything in ROOT.
void SetTopElement(std::shared_ptr< Browsable::RElement > elem)
set top element for browsing
std::string fLastSortMethod
! last sort method
bool RemoveFromCache(void *obj)
Remove object from cache If nullptr specified - removes no-longer-valid elements Returns true if any ...
std::shared_ptr< Browsable::RElement > GetSubElement(const Browsable::RElementPath_t &path)
Returns sub-element starting from top, using cached data.
const Browsable::RElementPath_t & GetWorkingPath() const
Browsable::RElementPath_t DecomposePath(const std::string &path, bool relative_to_work_element)
Decompose path to elements Returns array of names for each element in the path, first element either ...
virtual ~RBrowserData()
Destructor.
bool ProcessBrowserRequest(const RBrowserRequest &request, RBrowserReply &reply)
Process browser request.
std::vector< std::pair< Browsable::RElementPath_t, std::shared_ptr< Browsable::RElement > > > fCache
! already requested elements
std::shared_ptr< Browsable::RElement > GetElementFromTop(const Browsable::RElementPath_t &path)
Returns element with path, specified as Browsable::RElementPath_t.
RBrowserData(std::shared_ptr< Browsable::RElement > elem)
void ClearCache()
Clear internal objects cache.
std::vector< const Browsable::RItem * > fLastSortedItems
! sorted child items, used in requests
bool fLastAllChilds
! if all chlds were extracted
std::string ProcessRequest(const RBrowserRequest &request)
Process browser request, returns string with JSON of RBrowserReply data.
Browsable::RElementPath_t fWorkingPath
! path showed in Breadcrumb
bool fLastSortReverse
! last request reverse order
Browsable::RElementPath_t fLastPath
! path to last used element
std::shared_ptr< Browsable::RElement > fTopElement
! top element
void SetWorkingPath(const Browsable::RElementPath_t &path)
set working directory relative to top element
std::shared_ptr< Browsable::RElement > fLastElement
! last element used in request
std::unique_ptr< RBrowserDataCleanup > fCleanupHandle
! cleanup handle for RecursiveRemove
std::shared_ptr< Browsable::RElement > GetElement(const std::string &str)
Returns element with path, specified as string.
std::vector< std::unique_ptr< Browsable::RItem > > fLastItems
! created browser items - used in requests
void ResetLastRequestData(bool with_element)
Reset all data correspondent to last request.
void CreateDefaultElements()
Create default elements shown in the RBrowser.
RBrowserData()
Default constructor.
Reply on browser request.
Request send from client to get content of path element.
std::vector< std::string > RElementPath_t
Definition RElement.hxx:21
RLogChannel & BrowserLog()
Log channel for Browser diagnostics.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.