11#ifndef ROOT_TEmulatedCollectionProxy
12#define ROOT_TEmulatedCollectionProxy
28 template <std::
size_t Align>
34 using Cont1_t = std::vector<AlignedStorage< 1>>;
35 using Cont2_t = std::vector<AlignedStorage< 2>>;
36 using Cont4_t = std::vector<AlignedStorage< 4>>;
37 using Cont8_t = std::vector<AlignedStorage< 8>>;
38 using Cont16_t = std::vector<AlignedStorage< 16>>;
39 using Cont32_t = std::vector<AlignedStorage< 32>>;
40 using Cont64_t = std::vector<AlignedStorage< 64>>;
41 using Cont128_t = std::vector<AlignedStorage< 128>>;
42 using Cont256_t = std::vector<AlignedStorage< 256>>;
43 using Cont512_t = std::vector<AlignedStorage< 512>>;
60 auto *
vcl = GetValueClass();
61 std::size_t align =
alignof(std::max_align_t);
64 align =
alignof(
void*);
67 align =
vcl->GetClassAlignment();
69 switch(
int(fVal->fKind) ) {
71 case kUChar_t: align =
alignof(char);
break;
73 case kUShort_t: align =
alignof(short);
break;
77 case kULong_t: align =
alignof(long);
break;
79 case kULong64_t:align =
alignof(
long long);
break;
81 case kFloat_t: align =
alignof(float);
break;
85 Fatal(
"TEmulatedCollectionProxy::WithCont",
"Unsupported value type %d for value class %s", fVal->fKind,
86 vcl ?
vcl->GetName() :
"<unknown>");
92 case 4096:
fn(
reinterpret_cast<Cont4096_t*
>(obj), std::size_t(4096));
break;
93 case 2048:
fn(
reinterpret_cast<Cont2048_t*
>(obj), std::size_t(2048));
break;
94 case 1024:
fn(
reinterpret_cast<Cont1024_t*
>(obj), std::size_t(1024));
break;
95 case 512:
fn(
reinterpret_cast<Cont512_t *
>(obj), std::size_t( 512));
break;
96 case 256:
fn(
reinterpret_cast<Cont256_t *
>(obj), std::size_t( 256));
break;
97 case 128:
fn(
reinterpret_cast<Cont128_t *
>(obj), std::size_t( 128));
break;
98 case 64:
fn(
reinterpret_cast<Cont64_t *
>(obj), std::size_t( 64));
break;
99 case 32:
fn(
reinterpret_cast<Cont32_t *
>(obj), std::size_t( 32));
break;
100 case 16:
fn(
reinterpret_cast<Cont16_t *
>(obj), std::size_t( 16));
break;
101 case 8:
fn(
reinterpret_cast<Cont8_t *
>(obj), std::size_t( 8));
break;
102 case 4:
fn(
reinterpret_cast<Cont4_t *
>(obj), std::size_t( 4));
break;
103 case 2:
fn(
reinterpret_cast<Cont2_t *
>(obj), std::size_t( 2));
break;
104 case 1:
fn(
reinterpret_cast<Cont1_t *
>(obj), std::size_t( 1));
break;
106 Fatal(
"TEmulatedCollectionProxy::WithCont",
"Unsupported alignment %zu for value class %s",
107 align,
vcl ?
vcl->GetName() :
"<unknown>");
144 void *
New()
const override
147 WithCont(
mem, [](
auto *
c, std::size_t) {
new (
c) std::decay_t<
decltype(*
c)>(); });
154 WithCont(
memory, [](
auto *
c, std::size_t) {
new (
c) std::decay_t<
decltype(*
c)>(); });
169 WithCont(
static_cast<char *
>(
arr) + i *
sizeof(
Cont_t),
170 [](
auto *
c, std::size_t) {
new (
c) std::decay_t<
decltype(*
c)>(); });
178 WithCont(
static_cast<char *
>(
memory) + i *
sizeof(
Cont_t),
179 [](
auto *
c, std::size_t) {
new (
c) std::decay_t<
decltype(*
c)>(); });
202 void *At(
UInt_t idx)
override;
205 void Clear(
const char *opt =
"")
override;
211 UInt_t Size()
const override;
217 void Commit(
void*
env)
override;
245 "The class requested (%s) for the branch \"%s\" "
246 "is an instance of an stl collection and does not have a compiled CollectionProxy. "
247 "Please generate the dictionary for this collection (%s) to avoid writing corrupted data.";
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
void ReadBuffer(char *&buffer) override
void Streamer(TBuffer &) override
Buffer base class used for serializing objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Streamer around an arbitrary STL like container, which implements basic container functionality.
TEmulatedCollectionProxy & operator=(const TEmulatedCollectionProxy &)
std::vector< AlignedStorage< 512 > > Cont512_t
std::vector< AlignedStorage< 2048 > > Cont2048_t
TClass::ObjectPtr NewObjectArray(Int_t nElements) const override
Construct an array of nElements container objects and return the base address of the array.
std::vector< AlignedStorage< 4096 > > Cont4096_t
std::vector< AlignedStorage< 8 > > Cont8_t
void * NewArray(Int_t nElements) const override
Construct an array of nElements container objects and return the base address of the array.
std::vector< AlignedStorage< 256 > > Cont256_t
friend class TCollectionProxy
std::vector< AlignedStorage< 1 > > Cont1_t
std::vector< AlignedStorage< 1024 > > Cont1024_t
TClass::ObjectPtr NewObject() const override
Construct a new container object and return its address.
std::vector< AlignedStorage< 64 > > Cont64_t
std::vector< AlignedStorage< 128 > > Cont128_t
std::vector< AlignedStorage< 2 > > Cont2_t
void * New() const override
Construct a new container object and return its address.
void * New(void *memory) const override
Construct a new container object at the address given by arena
TClass::ObjectPtr NewObject(void *memory) const override
Construct a new container object at the address given by arena
std::vector< char > Cont_t
std::vector< AlignedStorage< 16 > > Cont16_t
void Streamer(TBuffer &buff, void *pObj, int siz) override
Streamer I/O overload.
std::vector< AlignedStorage< 4 > > Cont4_t
void * NewArray(Int_t nElements, void *memory) const override
Construct an array of nElements container objects at the address given by arena
std::vector< AlignedStorage< 32 > > Cont32_t
void WithCont(void *obj, F &&fn) const
Invoke fn(typed_ptr, elemSize) where typed_ptr is the container pointer cast to the correct AlignedSt...
TClass::ObjectPtr NewObjectArray(Int_t nElements, void *memory) const override
Construct an array of nElements container objects at the address given by arena
UInt_t Sizeof() const override
Return the sizeof() of the collection object.
Proxy around an arbitrary container, which implements basic functionality and iteration.
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
Defines a common interface to inspect/change the contents of an object that represents a collection.
bool HasEmulatedProxy(TClass *cl)
void PrintWriteStlWithoutProxyMsg(const char *where, const char *clName, const char *BranchName)
constexpr bool IsValidAlignment(std::size_t align) noexcept
Return true if align is a valid C++ alignment value: strictly positive and a power of two.
Storage type whose alignment matches Align bytes.