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