Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::CmdLine Namespace Reference

Classes

struct  RootObjNode
struct  RootObjTree
 A representation of all objects involved in a rootls-style ROOT file listing. More...
struct  RootSource

Typedefs

using NodeIdx_t = std::uint32_t

Enumerations

enum  EGetMatchingPathsFlags { kRecursive = 1 << 0 , kIgnoreFailedMatches = 1 << 1 , kOpenFilesAsWritable = 1 << 2 }
enum class  ENodeFullPathOpt { kExcludeFilename , kIncludeFilename }

Functions

RootSource GetMatchingPathsInFile (std::string_view fileName, std::string_view pattern, std::uint32_t flags)
 Given a file and a "path pattern", returns a RootSource containing the tree of matched objects.
RootObjNode NodeFromKey (TKey &key)
std::string NodeFullPath (const RootObjTree &tree, NodeIdx_t nodeIdx, ENodeFullPathOpt opt)
 Given a node, returns its full path. If opt == kIncludeFilename, the path is prepended by "filename.root:".
RootSource ParseRootSource (std::string_view sourceRaw, std::uint32_t flags)
 Given a string like "file.root:dir/obj", converts it to a RootSource.
std::vector< ROOT::CmdLine::RootSourceParseRootSources (const std::vector< std::string > &sourcesRaw, std::uint32_t flags)
 Given a list of strings like "file.root:dir/obj", converts each string to a RootSource.
void PrintObjTree (const RootObjTree &tree, std::ostream &out=std::cout)
 Prints out the structure of the object tree. Helpful for debugging.
ROOT::RResult< std::pair< std::string_view, std::string_view > > SplitIntoFileNameAndPattern (std::string_view sourceRaw)
 Given a string like "root://file.root:a/b/c", splits it into { "root://file.root", "a/b/c" }.

Typedef Documentation

◆ NodeIdx_t

using ROOT::CmdLine::NodeIdx_t = std::uint32_t

Definition at line 29 of file RootObjTree.hxx.

Enumeration Type Documentation

◆ EGetMatchingPathsFlags

Enumerator
kRecursive 1 << 0 

Recurse into subdirectories when matching objects.

kIgnoreFailedMatches 1 << 1 
kOpenFilesAsWritable 1 << 2 

Definition at line 105 of file RootObjTree.hxx.

◆ ENodeFullPathOpt

Enumerator
kExcludeFilename 
kIncludeFilename 

Definition at line 92 of file RootObjTree.hxx.

Function Documentation

◆ GetMatchingPathsInFile()

ROOT::CmdLine::RootSource ROOT::CmdLine::GetMatchingPathsInFile ( std::string_view fileName,
std::string_view pattern,
std::uint32_t flags )

Given a file and a "path pattern", returns a RootSource containing the tree of matched objects.

If pattern is non-empty, not a single '*' and it doesn't match any object in fileName, an error will be appended to RootSource::fErrors unless kIgnoreFailedMatches is part of flags.

Parameters
fileNameThe name of the ROOT file to look into
patternA glob-like pattern (basically a ls pattern). May be empty to match anything.
flagsA bitmask of EGetMatchingPathsFlags

Definition at line 26 of file RootObjTree.cxx.

◆ NodeFromKey()

RootObjNode ROOT::CmdLine::NodeFromKey ( TKey & key)
inline

Definition at line 45 of file RootObjTree.hxx.

◆ NodeFullPath()

std::string ROOT::CmdLine::NodeFullPath ( const RootObjTree & tree,
NodeIdx_t nodeIdx,
ENodeFullPathOpt opt )

Given a node, returns its full path. If opt == kIncludeFilename, the path is prepended by "filename.root:".

Definition at line 254 of file RootObjTree.cxx.

◆ ParseRootSource()

ROOT::CmdLine::RootSource ROOT::CmdLine::ParseRootSource ( std::string_view sourceRaw,
std::uint32_t flags )

Given a string like "file.root:dir/obj", converts it to a RootSource.

As a result of a successful call, a ROOT file is opened and may be accessed from RootSource::fObjectTree.fFile. Note that the file will not be registered to the global list and doesn't have to be explicitly closed, being stored in a unique_ptr.

The string may start with one of the known file protocols: "http", "https", "root", "gs", "s3" (e.g. "https://file.root").

If the source fails to get created, its fErrors list will be non-empty.

Parameters
flagsA bitmask of EGetMatchingPathsFlags
Returns
The converted source.

Definition at line 181 of file RootObjTree.cxx.

◆ ParseRootSources()

std::vector< ROOT::CmdLine::RootSource > ROOT::CmdLine::ParseRootSources ( const std::vector< std::string > & sourcesRaw,
std::uint32_t flags )

Given a list of strings like "file.root:dir/obj", converts each string to a RootSource.

The string may start with one of the known file protocols: "http", "https", "root", "gs", "s3" (e.g. "https://file.root").

If one or more sources fail to get created, each sources's fErrors list will be non-empty.

Parameters
flagsA bitmask of EGetMatchingPathsFlags
Returns
The list of converted sources.

Definition at line 199 of file RootObjTree.cxx.

◆ PrintObjTree()

void ROOT::CmdLine::PrintObjTree ( const RootObjTree & tree,
std::ostream & out = std::cout )

Prints out the structure of the object tree. Helpful for debugging.

Definition at line 211 of file RootObjTree.cxx.

◆ SplitIntoFileNameAndPattern()

ROOT::RResult< std::pair< std::string_view, std::string_view > > ROOT::CmdLine::SplitIntoFileNameAndPattern ( std::string_view sourceRaw)

Given a string like "root://file.root:a/b/c", splits it into { "root://file.root", "a/b/c" }.

Returns
An error if the file prefix is unknown (e.g. "foo://file.root"), otherwise the result described above.

Definition at line 150 of file RootObjTree.cxx.