33using namespace std::string_literals;
110 auto comp = std::make_shared<Browsable::RGroup>(
"top",
"Root browser");
114 std::unique_ptr<Browsable::RHolder> rootfold = std::make_unique<Browsable::TObjectHolder>(
gROOT->GetRootFolder(),
kFALSE);
117 comp->Add(std::make_shared<Browsable::RWrapper>(
"root", elem_root));
119 std::unique_ptr<Browsable::RHolder> rootfiles = std::make_unique<Browsable::TObjectHolder>(
gROOT->GetListOfFiles(),
kFALSE);
122 auto files = std::make_shared<Browsable::RWrapper>(
"ROOT Files", elem_files);
123 files->SetExpandByDefault(
true);
126 if (elem_files->GetNumChilds() > 0)
164 arr.insert(arr.end(), arr2.begin(), arr2.end());
174 path.insert(path.end(), request.
path.begin(), request.
path.end());
179 if (!elem)
return false;
187 }
else if (request.
reload) {
197 if (!iter)
return false;
217 if (request.
sort.empty()) {
220 if (item->IsFolder())
223 if (!item->IsFolder())
230 if (request.
sort !=
"unsorted")
242 const std::regex expr(request.
regex);
248 if (!request.
hidden && item->IsHidden())
251 if (!request.
regex.empty() && !item->IsFolder() && !std::regex_match(item->GetName(), expr))
255 reply.
nodes.emplace_back(item);
317 for (
auto &entry :
fCache)
318 if (entry.first == path)
325 for (
auto &entry :
fCache) {
326 if (entry.first.size() >= path.size())
331 if ((comp > pos) && (comp == (
int) entry.first.size())) {
337 while (pos < (
int) path.size()) {
338 std::string subname = path[pos];
341 auto iter = elem->GetChildsIter();
345 if (!iter->Find(subname, indx)) {
348 iter = elem->GetChildsIter();
349 if (!iter || !iter->Find(subname))
353 elem = iter->GetElement();
359 subpath.resize(pos+1);
360 fCache.emplace_back(subpath, elem);
386 while (pos <
fCache.size()) {
387 if (obj ? !
fCache[pos].second->IsObject(obj) :
fCache[pos].second->CheckValid()) {
393 auto path =
fCache[pos].first;
408 if (path.size() == 0)
413 while (pos <
fCache.size()) {
RooAbsData * _data
Pointer to original input dataset.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
R__EXTERN TVirtualMutex * gROOTMutex
#define R__LOCKGUARD(mutex)
static int ExtractItemIndex(std::string &name)
Extract index from name Index coded by client with ###<indx>$$$ suffix Such coding used by browser to...
static int ComparePaths(const RElementPath_t &path1, const RElementPath_t &path2)
Compare two paths, Returns number of elements matches in both paths.
static RElementPath_t ParsePath(const std::string &str)
Parse string path to produce RElementPath_t One should avoid to use string pathes as much as possible...
Representation of single item in the browser.
static std::shared_ptr< RElement > Browse(std::unique_ptr< RHolder > &obj)
Create browsable element for the object Created element may take ownership over the object.
static RElementPath_t ProvideTopEntries(std::shared_ptr< RGroup > &comp, const std::string &workdir="")
Provide top entries for file system On windows it is list of existing drivers, on Linux it is "File s...
A log configuration for a channel, e.g.
RBrowserDataCleanup(RBrowserData &_data)
void RecursiveRemove(TObject *obj) override
Recursively remove this object from a list.
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.
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.
std::vector< std::string > path
reply path
std::vector< const Browsable::RItem * > nodes
list of pointers, no ownership!
int first
first node in returned list
int nchilds
total number of childs in the node
Request send from client to get content of path element.
int lastcycle
show only last cycle, -1 - off, 0 - not change, +1 on,
bool hidden
show hidden files
int number
number of childs to request, 0 - all childs
bool reverse
reverse item order
std::string sort
kind of sorting
std::vector< std::string > path
requested path
bool reload
force items reload
int first
first child to request
std::string regex
applied regex
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
@ kSkipTypeInfo
do not store typenames in JSON
@ kNoSpaces
no new lines plus remove all spaces around "," and ":" symbols
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
Mother of all ROOT objects.
const char * Data() const
std::vector< std::string > RElementPath_t
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.