Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Internal::RStringPool Class Reference

Used for string interning of repeated type names, field names, etc.

The call operator returns for every given string the one immutable pointer to that string in the pool. After calling Freeze(), no new string must be added and the pool is safe to use from multiple threads.

Definition at line 56 of file RNTupleUtils.hxx.

Public Member Functions

 RStringPool ()=default
 
 RStringPool (const RStringPool &other)=delete
 
 RStringPool (RStringPool &&other)=default
 
 ~RStringPool ()=default
 
void Freeze ()
 
const std::string * Intern (std::string_view str)
 Searches for str in the pool.
 
RStringPooloperator= (const RStringPool &other)=delete
 
RStringPooloperator= (RStringPool &&other)=default
 

Static Private Member Functions

static bool Less (const std::unique_ptr< std::string > &a, const std::string_view &b)
 

Private Attributes

bool fFrozen = false
 
std::vector< std::unique_ptr< std::string > > fStrings
 

#include <ROOT/RNTupleUtils.hxx>

Constructor & Destructor Documentation

◆ RStringPool() [1/3]

ROOT::Internal::RStringPool::RStringPool ( )
default

◆ ~RStringPool()

ROOT::Internal::RStringPool::~RStringPool ( )
default

◆ RStringPool() [2/3]

ROOT::Internal::RStringPool::RStringPool ( const RStringPool & other)
delete

◆ RStringPool() [3/3]

ROOT::Internal::RStringPool::RStringPool ( RStringPool && other)
default

Member Function Documentation

◆ Freeze()

void ROOT::Internal::RStringPool::Freeze ( )
inline

Definition at line 73 of file RNTupleUtils.hxx.

◆ Intern()

const std::string * ROOT::Internal::RStringPool::Intern ( std::string_view str)

Searches for str in the pool.

If not present, adds the string to the pool before returning a pointer to it. Throws if frozen and str is not yet in the pool.

Definition at line 53 of file RNTupleUtils.cxx.

◆ Less()

static bool ROOT::Internal::RStringPool::Less ( const std::unique_ptr< std::string > & a,
const std::string_view & b )
inlinestaticprivate

Definition at line 60 of file RNTupleUtils.hxx.

◆ operator=() [1/2]

RStringPool & ROOT::Internal::RStringPool::operator= ( const RStringPool & other)
delete

◆ operator=() [2/2]

RStringPool & ROOT::Internal::RStringPool::operator= ( RStringPool && other)
default

Member Data Documentation

◆ fFrozen

bool ROOT::Internal::RStringPool::fFrozen = false
private

Definition at line 58 of file RNTupleUtils.hxx.

◆ fStrings

std::vector<std::unique_ptr<std::string> > ROOT::Internal::RStringPool::fStrings
private

Definition at line 57 of file RNTupleUtils.hxx.

Libraries for ROOT::Internal::RStringPool:

The documentation for this class was generated from the following files: