Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_RBrowserData
13#define ROOT7_RBrowserData
14
16
19
20#include <memory>
21#include <string>
22#include <vector>
23#include <utility>
24
25namespace ROOT {
26
27class RLogChannel;
28
29/// Log channel for Browser diagnostics.
31
32class RBrowserDataCleanup;
33
35
36 friend class RBrowserDataCleanup;
37
38 std::shared_ptr<Browsable::RElement> fTopElement; ///<! top element
39
40 Browsable::RElementPath_t fWorkingPath; ///<! path showed in Breadcrumb
41
42 std::vector<std::pair<Browsable::RElementPath_t, std::shared_ptr<Browsable::RElement>>> fCache; ///<! already requested elements
43
44 Browsable::RElementPath_t fLastPath; ///<! path to last used element
45 std::shared_ptr<Browsable::RElement> fLastElement; ///<! last element used in request
46 std::vector<std::unique_ptr<Browsable::RItem>> fLastItems; ///<! created browser items - used in requests
47 bool fLastAllChilds{false}; ///<! if all chlds were extracted
48 std::vector<const Browsable::RItem *> fLastSortedItems; ///<! sorted child items, used in requests
49 std::string fLastSortMethod; ///<! last sort method
50 bool fLastSortReverse{false}; ///<! last request reverse order
51 std::unique_ptr<TObject> fCleanupHandle; ///<! cleanup handle for RecursiveRemove
52
54
56
57public:
59
60 RBrowserData(std::shared_ptr<Browsable::RElement> elem) : RBrowserData() { SetTopElement(elem); }
61
62 virtual ~RBrowserData();
63
64 void SetTopElement(std::shared_ptr<Browsable::RElement> elem);
65
67
69
71
72 std::string ProcessRequest(const RBrowserRequest &request);
73
74 std::shared_ptr<Browsable::RElement> GetElement(const std::string &str);
75 std::shared_ptr<Browsable::RElement> GetElementFromTop(const Browsable::RElementPath_t &path);
76
78 std::shared_ptr<Browsable::RElement> GetSubElement(const Browsable::RElementPath_t &path);
79
80 void ClearCache();
81
82 bool RemoveFromCache(void *obj);
83
85
86};
87
88
89} // namespace ROOT
90
91#endif
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.
A log configuration for a channel, e.g.
Definition RLogger.hxx:98
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::RLogChannel & BrowserLog()
Log channel for Browser diagnostics.