Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RPageAllocator.hxx
Go to the documentation of this file.
1/// \file ROOT/RPageAllocator.hxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2019-06-25
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT7_RPageAllocator
17#define ROOT7_RPageAllocator
18
19#include <ROOT/RNTupleUtil.hxx>
20#include <ROOT/RPage.hxx>
21
22#include <cstddef>
23#include <functional>
24
25namespace ROOT {
26namespace Experimental {
27namespace Internal {
28
29// clang-format off
30/**
31\class ROOT::Experimental::Internal::RPageAllocator
32\ingroup NTuple
33\brief Abstract interface to allocate and release pages
34
35The page allocator acquires and releases memory for pages. It does not load the page data, the returned pages
36are empty but guaranteed to have enough contiguous space for the given number of elements.
37The page allocator must be thread-safe.
38*/
39// clang-format on
41 friend class RPage;
42
43protected:
44 /// Releases the memory pointed to by page and resets the page's information. Note that the memory of the
45 /// zero page must not be deleted. Called by the RPage destructor.
46 virtual void DeletePage(RPage &page) = 0;
47
48public:
49 virtual ~RPageAllocator() = default;
50
51 /// Reserves memory large enough to hold nElements of the given size. The page is immediately tagged with
52 /// a column id. Returns a default constructed page on out-of-memory condition.
53 virtual RPage NewPage(std::size_t elementSize, std::size_t nElements) = 0;
54};
55
56// clang-format off
57/**
58\class ROOT::Experimental::Internal::RPageAllocatorHeap
59\ingroup NTuple
60\brief Uses standard C++ memory allocation for the column data pages
61*/
62// clang-format on
64protected:
65 void DeletePage(RPage &page) final;
66
67public:
68 RPage NewPage(std::size_t elementSize, std::size_t nElements) final;
69};
70
71} // namespace Internal
72} // namespace Experimental
73} // namespace ROOT
74
75#endif
Uses standard C++ memory allocation for the column data pages.
RPage NewPage(std::size_t elementSize, std::size_t nElements) final
Reserves memory large enough to hold nElements of the given size.
void DeletePage(RPage &page) final
Releases the memory pointed to by page and resets the page's information.
Abstract interface to allocate and release pages.
virtual void DeletePage(RPage &page)=0
Releases the memory pointed to by page and resets the page's information.
virtual RPage NewPage(std::size_t elementSize, std::size_t nElements)=0
Reserves memory large enough to hold nElements of the given size.
A page is a slice of a column that is mapped into memory.
Definition RPage.hxx:47
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...