Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEmulatedCollectionProxy.h
Go to the documentation of this file.
1// @(#)root/io:$Id$
2// Author: Markus Frank 28/10/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11#ifndef ROOT_TEmulatedCollectionProxy
12#define ROOT_TEmulatedCollectionProxy
13
14#include "TGenCollectionProxy.h"
15
16#include <vector>
17
19
20 // Friend declaration
21 friend class TCollectionProxy;
22
23public:
24 // Container type definition
25 typedef std::vector<char> Cont_t;
26 // Pointer to container type
27 typedef Cont_t *PCont_t;
28protected:
29
30 // Some hack to avoid const-ness
31 TGenCollectionProxy* InitializeEx(Bool_t silent) override;
32
33 // Object input streamer
34 void ReadItems(int nElements, TBuffer &b);
35
36 // Object output streamer
37 void WriteItems(int nElements, TBuffer &b);
38
39 // Shrink the container
40 void Shrink(UInt_t nCurr, UInt_t left, Bool_t force);
41
42 // Expand the container
43 void Expand(UInt_t nCurr, UInt_t left);
44
45private:
47
48public:
49 // Virtual copy constructor
50 TVirtualCollectionProxy* Generate() const override;
51
52 // Copy constructor
54
55 // Initializing constructor
56 TEmulatedCollectionProxy(const char* cl_name, Bool_t silent);
57
58 // Standard destructor
60
61 // Virtual constructor
62 void* New() const override { return new Cont_t; }
63
64 // Virtual in-place constructor
65 void* New(void* memory) const override { return new(memory) Cont_t; }
66
67 // Virtual constructor
68 TClass::ObjectPtr NewObject() const override { return {new Cont_t, nullptr}; }
69
70 // Virtual in-place constructor
71 TClass::ObjectPtr NewObject(void* memory) const override { return {new(memory) Cont_t, nullptr}; }
72
73 // Virtual array constructor
74 void* NewArray(Int_t nElements) const override { return new Cont_t[nElements]; }
75
76 // Virtual in-place constructor
77 void* NewArray(Int_t nElements, void* memory) const override { return new(memory) Cont_t[nElements]; }
78
79 // Virtual array constructor
80 TClass::ObjectPtr NewObjectArray(Int_t nElements) const override { return {new Cont_t[nElements], nullptr}; }
81
82 // Virtual in-place constructor
83 TClass::ObjectPtr NewObjectArray(Int_t nElements, void* memory) const override { return {new(memory) Cont_t[nElements], nullptr}; }
84
85 // Virtual destructor
86 void Destructor(void* p, Bool_t dtorOnly = kFALSE) const override;
87
88 // Virtual array destructor
89 void DeleteArray(void* p, Bool_t dtorOnly = kFALSE) const override;
90
91 // TVirtualCollectionProxy overload: Return the sizeof the collection object.
92 UInt_t Sizeof() const override { return sizeof(Cont_t); }
93
94 // Return the address of the value at index 'idx'
95 void *At(UInt_t idx) override;
96
97 // Clear the container
98 void Clear(const char *opt = "") override;
99
100 // Resize the container
101 void Resize(UInt_t n, Bool_t force_delete) override;
102
103 // Return the current size of the container
104 UInt_t Size() const override;
105
106 // Block allocation of containees
107 void* Allocate(UInt_t n, Bool_t forceDelete) override;
108
109 // Block commit of containees
110 void Commit(void* env) override;
111
112 // Insert data into the container where data is a C-style array of the actual type contained in the collection
113 // of the given size. For associative container (map, etc.), the data type is the pair<key,value>.
114 void Insert(const void *data, void *container, size_t size) override;
115
116 // Read portion of the streamer
117 void ReadBuffer(TBuffer &buff, void *pObj) override;
118 void ReadBuffer(TBuffer &buff, void *pObj, const TClass *onfile) override;
119
120 // Streamer for I/O handling
121 void Streamer(TBuffer &refBuffer) override;
122
123 // Streamer I/O overload
124 void Streamer(TBuffer &buff, void *pObj, int siz) override
125 {
126 TGenCollectionProxy::Streamer(buff,pObj,siz);
127 }
128
129 // Check validity of the proxy itself
130 Bool_t IsValid() const;
131};
132
133#endif
#define b(i)
Definition RSha256.hxx:100
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Buffer base class used for serializing objects.
Definition TBuffer.h:43
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Streamer around an arbitrary STL like container, which implements basic container functionality.
TEmulatedCollectionProxy & operator=(const TEmulatedCollectionProxy &)
UInt_t Size() const override
Return the current number of elements in the container.
void Insert(const void *data, void *container, size_t size) override
Insert data into the container where data is a C-style array of the actual type contained in the coll...
TGenCollectionProxy * InitializeEx(Bool_t silent) override
Proxy initializer.
void * Allocate(UInt_t n, Bool_t forceDelete) override
Allocates space for storing at least n elements.
TClass::ObjectPtr NewObjectArray(Int_t nElements) const override
Construct an array of nElements container objects and return the base address of the array.
void * NewArray(Int_t nElements) const override
Construct an array of nElements container objects and return the base address of the array.
void Expand(UInt_t nCurr, UInt_t left)
TClass::ObjectPtr NewObject() const override
Construct a new container object and return its address.
void * New() const override
Construct a new container object and return its address.
void WriteItems(int nElements, TBuffer &b)
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
TVirtualCollectionProxy * Generate() const override
Returns a clean object of the actual class that derives from TVirtualCollectionProxy.
void Commit(void *env) override
Commits pending elements in a staging area (see Allocate() for more information).
void Streamer(TBuffer &buff, void *pObj, int siz) override
Streamer I/O overload.
void Clear(const char *opt="") override
Clear the container.
void * NewArray(Int_t nElements, void *memory) const override
Construct an array of nElements container objects at the address given by arena
void Shrink(UInt_t nCurr, UInt_t left, Bool_t force)
void * At(UInt_t idx) override
Return the address of the value at index idx
void ReadItems(int nElements, TBuffer &b)
TClass::ObjectPtr NewObjectArray(Int_t nElements, void *memory) const override
Construct an array of nElements container objects at the address given by arena
void Destructor(void *p, Bool_t dtorOnly=kFALSE) const override
Execute the container destructor.
void ReadBuffer(TBuffer &buff, void *pObj) override
void Streamer(TBuffer &refBuffer) override
Streamer Function.
void DeleteArray(void *p, Bool_t dtorOnly=kFALSE) const override
Execute the container array destructor.
UInt_t Sizeof() const override
Return the sizeof() of the collection object.
void Resize(UInt_t n, Bool_t force_delete) override
Resize the container.
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.
const Int_t n
Definition legend1.C:16