Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RPageAllocator.cxx
Go to the documentation of this file.
1 /// \file RPageAllocator.cxx
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 
17 #include <ROOT/RPageAllocator.hxx>
18 
19 #include <TError.h>
20 
21 ROOT::Experimental::Detail::RPage ROOT::Experimental::Detail::RPageAllocatorHeap::NewPage(
22  ColumnId_t columnId, std::size_t elementSize, std::size_t nElements)
23 {
24  R__ASSERT((elementSize > 0) && (nElements > 0));
25  auto nbytes = elementSize * nElements;
26  auto buffer = new unsigned char[nbytes];
27  return RPage(columnId, buffer, nbytes, elementSize);
28 }
29 
30 void ROOT::Experimental::Detail::RPageAllocatorHeap::DeletePage(const RPage& page)
31 {
32  delete[] reinterpret_cast<unsigned char *>(page.GetBuffer());
33 }