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 {
27
28namespace Experimental {
29class RLogChannel;
30} // namespace Experimental
31
32/// Log channel for Browser diagnostics.
34
35class RBrowserDataCleanup;
36
38
39 friend class RBrowserDataCleanup;
40
41 std::shared_ptr<Browsable::RElement> fTopElement; ///<! top element
42
43 Browsable::RElementPath_t fWorkingPath; ///<! path showed in Breadcrumb
44
45 std::vector<std::pair<Browsable::RElementPath_t, std::shared_ptr<Browsable::RElement>>> fCache; ///<! already requested elements
46
47 Browsable::RElementPath_t fLastPath; ///<! path to last used element
48 std::shared_ptr<Browsable::RElement> fLastElement; ///<! last element used in request
49 std::vector<std::unique_ptr<Browsable::RItem>> fLastItems; ///<! created browser items - used in requests
50 bool fLastAllChilds{false}; ///<! if all chlds were extracted
51 std::vector<const Browsable::RItem *> fLastSortedItems; ///<! sorted child items, used in requests
52 std::string fLastSortMethod; ///<! last sort method
53 bool fLastSortReverse{false}; ///<! last request reverse order
54 std::unique_ptr<TObject> fCleanupHandle; ///<! cleanup handle for RecursiveRemove
55
56 void ResetLastRequestData(bool with_element);
57
58 bool ProcessBrowserRequest(const RBrowserRequest &request, RBrowserReply &reply);
59
60public:
62
63 RBrowserData(std::shared_ptr<Browsable::RElement> elem) : RBrowserData() { SetTopElement(elem); }
64
65 virtual ~RBrowserData();
66
67 void SetTopElement(std::shared_ptr<Browsable::RElement> elem);
68
70
72
74
75 std::string ProcessRequest(const RBrowserRequest &request);
76
77 std::shared_ptr<Browsable::RElement> GetElement(const std::string &str);
78 std::shared_ptr<Browsable::RElement> GetElementFromTop(const Browsable::RElementPath_t &path);
79
80 Browsable::RElementPath_t DecomposePath(const std::string &path, bool relative_to_work_element);
81 std::shared_ptr<Browsable::RElement> GetSubElement(const Browsable::RElementPath_t &path);
82
83 void ClearCache();
84
85 bool RemoveFromCache(void *obj);
86
88
89};
90
91
92} // namespace ROOT
93
94#endif
A log configuration for a channel, e.g.
Definition RLogger.hxx:101
Way to browse (hopefully) everything in ROOT.
void SetTopElement(std::shared_ptr< Browsable::RElement > elem)
set top element for browsing
std::vector< const Browsable::RItem * > fLastSortedItems
! sorted child items, used in requests
Browsable::RElementPath_t fWorkingPath
! path showed in Breadcrumb
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.
std::vector< std::pair< Browsable::RElementPath_t, std::shared_ptr< Browsable::RElement > > > fCache
! already requested elements
std::unique_ptr< TObject > fCleanupHandle
! cleanup handle for RecursiveRemove
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 ...
bool fLastAllChilds
! if all chlds were extracted
virtual ~RBrowserData()
Destructor.
bool ProcessBrowserRequest(const RBrowserRequest &request, RBrowserReply &reply)
Process browser request.
std::shared_ptr< Browsable::RElement > GetElementFromTop(const Browsable::RElementPath_t &path)
Returns element with path, specified as Browsable::RElementPath_t.
std::string fLastSortMethod
! last sort method
void ClearCache()
Clear internal objects cache.
std::string ProcessRequest(const RBrowserRequest &request)
Process browser request, returns string with JSON of RBrowserReply data.
std::vector< std::unique_ptr< Browsable::RItem > > fLastItems
! created browser items - used in requests
Browsable::RElementPath_t fLastPath
! path to last used element
void SetWorkingPath(const Browsable::RElementPath_t &path)
set working directory relative to top element
std::shared_ptr< Browsable::RElement > fTopElement
! top element
std::shared_ptr< Browsable::RElement > GetElement(const std::string &str)
Returns element with path, specified as string.
const Browsable::RElementPath_t & GetWorkingPath() const
RBrowserData(std::shared_ptr< Browsable::RElement > elem)
bool fLastSortReverse
! last request reverse order
void ResetLastRequestData(bool with_element)
Reset all data correspondent to last request.
std::shared_ptr< Browsable::RElement > fLastElement
! last element used in 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:20
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
ROOT::Experimental::RLogChannel & BrowserLog()
Log channel for Browser diagnostics.