#ifndef ROOT_TGenCollectionProxy
#define ROOT_TGenCollectionProxy
#include "TVirtualCollectionProxy.h"
#include "TCollectionProxyFactory.h"
#include <typeinfo>
#include <string>
class TGenCollectionProxy
: public TVirtualCollectionProxy
{
friend class TCollectionProxyFactory;
public:
#ifdef R__HPUX
typedef const type_info& Info_t;
#else
typedef const std::type_info& Info_t;
#endif
enum {
kBIT_ISSTRING = 0x20000000,
kBIT_ISTSTRING = 0x40000000,
kBOOL_t = 21
};
struct Value {
ROOT::NewFunc_t fCtor;
ROOT::DesFunc_t fDtor;
ROOT::DelFunc_t fDelete;
unsigned int fCase;
TClassRef fType;
EDataType fKind;
size_t fSize;
Value(const Value& inside);
Value(const std::string& info);
void DeleteItem(void* ptr);
Bool_t IsValid();
};
union StreamHelper {
Bool_t boolean;
Char_t s_char;
Short_t s_short;
Int_t s_int;
Long_t s_long;
Long64_t s_longlong;
Float_t flt;
Double_t dbl;
UChar_t u_char;
UShort_t u_short;
UInt_t u_int;
ULong_t u_long;
ULong64_t u_longlong;
void* p_void;
void** pp_void;
char* kchar;
TString* tstr;
void* ptr() {
return *(&this->p_void);
}
std::string* str() {
return (std::string*)this;
}
const char* c_str() {
return ((std::string*)this)->c_str();
}
const char* c_pstr() {
return (*(std::string**)this)->c_str();
}
void set(void* p) {
*(&this->p_void) = p;
}
void read_std_string(TBuffer& b) {
TString s;
s.Streamer(b);
((std::string*)this)->assign(s.Data());
}
void* read_tstring(TBuffer& b) {
*((TString*)this) = "";
((TString*)this)->Streamer(b);
return this;
}
void read_std_string_pointer(TBuffer& b) {
TString s;
std::string* str2 = (std::string*)ptr();
if (!str2) str2 = new std::string();
s.Streamer(b);
*str2 = s;
set(str2);
}
void write_std_string_pointer(TBuffer& b) {
const char* c;
if (ptr()) {
std::string* strptr = (*(std::string**)this);
c = (const char*)(strptr->c_str());
} else c = "";
TString(c).Streamer(b);
}
void read_any_object(Value* v, TBuffer& b) {
void* p = ptr();
if ( p ) {
if ( v->fDelete ) {
(*v->fDelete)(p);
}
else if ( v->fType ) {
v->fType->Destructor(p);
}
else if ( v->fDtor ) {
(*v->fDtor)(p);
::operator delete(p);
}
else {
::operator delete(p);
}
}
set( b.ReadObjectAny(v->fType) );
}
void read_tstring_pointer(Bool_t vsn3, TBuffer& b) {
TString* s = (TString*)ptr();
if ( vsn3 ) {
if ( !s ) s = new TString();
s->Replace(0, s->Length(), 0, 0);
s->Streamer(b);
set(s);
return;
}
if ( s ) delete s;
set( b.ReadObjectAny(TString::Class()) );
}
void write_tstring_pointer(TBuffer& b) {
b.WriteObjectAny(ptr(), TString::Class());
}
};
class Method {
public:
typedef void* (*Call_t)(void*);
Call_t call;
Method() : call(0) { }
Method(Call_t c) : call(c) { }
Method(const Method& m) : call(m.call) { }
void* invoke(void* obj) const { return (*call)(obj); }
};
class Method0 {
public:
typedef void* (*Call_t)();
Call_t call;
Method0() : call(0) { }
Method0(Call_t c) : call(c) { }
Method0(const Method0& m) : call(m.call) { }
void* invoke() const { return (*call)(); }
};
protected:
typedef ROOT::TCollectionProxyInfo::Environ<char[64]> Env_t;
typedef ROOT::TCollectionProxyInfo::EnvironBase EnvironBase_t;
typedef std::vector<EnvironBase_t*> Proxies_t;
std::string fName;
Bool_t fPointers;
Method fClear;
Method fSize;
Method fResize;
Method fFirst;
Method fNext;
Method fConstruct;
Method fDestruct;
Method fFeed;
Method fCollect;
Method0 fCreateEnv;
Value* fValue;
Value* fVal;
Value* fKey;
EnvironBase_t*fEnv;
int fValOffset;
int fValDiff;
Proxies_t fProxyList;
Proxies_t fProxyKept;
int fSTL_type;
Info_t fTypeinfo;
TClass* fOnFileClass;
TGenCollectionProxy* Initialize() const;
virtual TGenCollectionProxy* InitializeEx();
virtual void DeleteItem(Bool_t force, void* ptr) const;
void CheckFunctions() const;
public:
virtual TVirtualCollectionProxy* Generate() const;
TGenCollectionProxy(const TGenCollectionProxy& copy);
TGenCollectionProxy(Info_t typ, size_t iter_size);
TGenCollectionProxy(const ROOT::TCollectionProxyInfo &info, TClass *cl);
virtual ~TGenCollectionProxy();
virtual TClass *GetCollectionClass();
virtual UInt_t Sizeof() const;
virtual void PushProxy(void *objstart);
virtual void PopProxy();
virtual Bool_t HasPointers() const;
virtual TClass *GetValueClass();
virtual void SetValueClass(TClass *newcl);
virtual EDataType GetType();
virtual void *At(UInt_t idx);
virtual void Clear(const char *opt = "");
virtual void Resize(UInt_t n, Bool_t force_delete);
virtual UInt_t Size() const;
virtual void* Allocate(UInt_t n, Bool_t forceDelete);
virtual void Commit(void* env);
virtual void Streamer(TBuffer &refBuffer);
virtual void Streamer(TBuffer &refBuffer, void *pObject, int siz);
virtual void operator()(TBuffer &refBuffer, void *pObject);
virtual void SetOnFileClass( TClass* cl ) { fOnFileClass = cl; }
virtual TClass* GetOnFileClass() const { return fOnFileClass; }
};
template <typename T>
struct AnyCollectionProxy : public TGenCollectionProxy {
AnyCollectionProxy()
: TGenCollectionProxy(typeid(T::Cont_t),sizeof(T::Iter_t))
{
fValDiff = sizeof(T::Value_t);
fValOffset = T::value_offset();
fSize.call = T::size;
fResize.call = T::resize;
fNext.call = T::next;
fFirst.call = T::first;
fClear.call = T::clear;
fConstruct.call = T::construct;
fDestruct.call = T::destruct;
fFeed.call = T::feed;
CheckFunctions();
}
virtual ~AnyCollectionProxy() { }
};
#endif
TGenCollectionProxy.h:100 TGenCollectionProxy.h:101 TGenCollectionProxy.h:102 TGenCollectionProxy.h:103 TGenCollectionProxy.h:104 TGenCollectionProxy.h:105 TGenCollectionProxy.h:106 TGenCollectionProxy.h:107 TGenCollectionProxy.h:108 TGenCollectionProxy.h:109 TGenCollectionProxy.h:110 TGenCollectionProxy.h:111 TGenCollectionProxy.h:112 TGenCollectionProxy.h:113 TGenCollectionProxy.h:114 TGenCollectionProxy.h:115 TGenCollectionProxy.h:116 TGenCollectionProxy.h:117 TGenCollectionProxy.h:118 TGenCollectionProxy.h:119 TGenCollectionProxy.h:120 TGenCollectionProxy.h:121 TGenCollectionProxy.h:122 TGenCollectionProxy.h:123 TGenCollectionProxy.h:124 TGenCollectionProxy.h:125 TGenCollectionProxy.h:126 TGenCollectionProxy.h:127 TGenCollectionProxy.h:128 TGenCollectionProxy.h:129 TGenCollectionProxy.h:130 TGenCollectionProxy.h:131 TGenCollectionProxy.h:132 TGenCollectionProxy.h:133 TGenCollectionProxy.h:134 TGenCollectionProxy.h:135 TGenCollectionProxy.h:136 TGenCollectionProxy.h:137 TGenCollectionProxy.h:138 TGenCollectionProxy.h:139 TGenCollectionProxy.h:140 TGenCollectionProxy.h:141 TGenCollectionProxy.h:142 TGenCollectionProxy.h:143 TGenCollectionProxy.h:144 TGenCollectionProxy.h:145 TGenCollectionProxy.h:146 TGenCollectionProxy.h:147 TGenCollectionProxy.h:148 TGenCollectionProxy.h:149 TGenCollectionProxy.h:150 TGenCollectionProxy.h:151 TGenCollectionProxy.h:152 TGenCollectionProxy.h:153 TGenCollectionProxy.h:154 TGenCollectionProxy.h:155 TGenCollectionProxy.h:156 TGenCollectionProxy.h:157 TGenCollectionProxy.h:158 TGenCollectionProxy.h:159 TGenCollectionProxy.h:160 TGenCollectionProxy.h:161 TGenCollectionProxy.h:162 TGenCollectionProxy.h:163 TGenCollectionProxy.h:164 TGenCollectionProxy.h:165 TGenCollectionProxy.h:166 TGenCollectionProxy.h:167 TGenCollectionProxy.h:168 TGenCollectionProxy.h:169 TGenCollectionProxy.h:170 TGenCollectionProxy.h:171 TGenCollectionProxy.h:172 TGenCollectionProxy.h:173 TGenCollectionProxy.h:174 TGenCollectionProxy.h:175 TGenCollectionProxy.h:176 TGenCollectionProxy.h:177 TGenCollectionProxy.h:178 TGenCollectionProxy.h:179 TGenCollectionProxy.h:180 TGenCollectionProxy.h:181 TGenCollectionProxy.h:182 TGenCollectionProxy.h:183 TGenCollectionProxy.h:184 TGenCollectionProxy.h:185 TGenCollectionProxy.h:186 TGenCollectionProxy.h:187 TGenCollectionProxy.h:188 TGenCollectionProxy.h:189 TGenCollectionProxy.h:190 TGenCollectionProxy.h:191 TGenCollectionProxy.h:192 TGenCollectionProxy.h:193 TGenCollectionProxy.h:194 TGenCollectionProxy.h:195 TGenCollectionProxy.h:196 TGenCollectionProxy.h:197 TGenCollectionProxy.h:198 TGenCollectionProxy.h:199 TGenCollectionProxy.h:200 TGenCollectionProxy.h:201 TGenCollectionProxy.h:202 TGenCollectionProxy.h:203 TGenCollectionProxy.h:204 TGenCollectionProxy.h:205 TGenCollectionProxy.h:206 TGenCollectionProxy.h:207 TGenCollectionProxy.h:208 TGenCollectionProxy.h:209 TGenCollectionProxy.h:210 TGenCollectionProxy.h:211 TGenCollectionProxy.h:212 TGenCollectionProxy.h:213 TGenCollectionProxy.h:214 TGenCollectionProxy.h:215 TGenCollectionProxy.h:216 TGenCollectionProxy.h:217 TGenCollectionProxy.h:218 TGenCollectionProxy.h:219 TGenCollectionProxy.h:220 TGenCollectionProxy.h:221 TGenCollectionProxy.h:222 TGenCollectionProxy.h:223 TGenCollectionProxy.h:224 TGenCollectionProxy.h:225 TGenCollectionProxy.h:226 TGenCollectionProxy.h:227 TGenCollectionProxy.h:228 TGenCollectionProxy.h:229 TGenCollectionProxy.h:230 TGenCollectionProxy.h:231 TGenCollectionProxy.h:232 TGenCollectionProxy.h:233 TGenCollectionProxy.h:234 TGenCollectionProxy.h:235 TGenCollectionProxy.h:236 TGenCollectionProxy.h:237 TGenCollectionProxy.h:238 TGenCollectionProxy.h:239 TGenCollectionProxy.h:240 TGenCollectionProxy.h:241 TGenCollectionProxy.h:242 TGenCollectionProxy.h:243 TGenCollectionProxy.h:244 TGenCollectionProxy.h:245 TGenCollectionProxy.h:246 TGenCollectionProxy.h:247 TGenCollectionProxy.h:248 TGenCollectionProxy.h:249 TGenCollectionProxy.h:250 TGenCollectionProxy.h:251 TGenCollectionProxy.h:252 TGenCollectionProxy.h:253 TGenCollectionProxy.h:254 TGenCollectionProxy.h:255 TGenCollectionProxy.h:256 TGenCollectionProxy.h:257 TGenCollectionProxy.h:258 TGenCollectionProxy.h:259 TGenCollectionProxy.h:260 TGenCollectionProxy.h:261 TGenCollectionProxy.h:262 TGenCollectionProxy.h:263 TGenCollectionProxy.h:264 TGenCollectionProxy.h:265 TGenCollectionProxy.h:266 TGenCollectionProxy.h:267 TGenCollectionProxy.h:268 TGenCollectionProxy.h:269 TGenCollectionProxy.h:270 TGenCollectionProxy.h:271 TGenCollectionProxy.h:272 TGenCollectionProxy.h:273 TGenCollectionProxy.h:274 TGenCollectionProxy.h:275 TGenCollectionProxy.h:276 TGenCollectionProxy.h:277 TGenCollectionProxy.h:278 TGenCollectionProxy.h:279 TGenCollectionProxy.h:280 TGenCollectionProxy.h:281 TGenCollectionProxy.h:282 TGenCollectionProxy.h:283 TGenCollectionProxy.h:284 TGenCollectionProxy.h:285 TGenCollectionProxy.h:286 TGenCollectionProxy.h:287 TGenCollectionProxy.h:288 TGenCollectionProxy.h:289 TGenCollectionProxy.h:290 TGenCollectionProxy.h:291 TGenCollectionProxy.h:292 TGenCollectionProxy.h:293 TGenCollectionProxy.h:294 TGenCollectionProxy.h:295 TGenCollectionProxy.h:296 TGenCollectionProxy.h:297 TGenCollectionProxy.h:298 TGenCollectionProxy.h:299 TGenCollectionProxy.h:300 TGenCollectionProxy.h:301 TGenCollectionProxy.h:302 TGenCollectionProxy.h:303 TGenCollectionProxy.h:304 TGenCollectionProxy.h:305 TGenCollectionProxy.h:306 TGenCollectionProxy.h:307 TGenCollectionProxy.h:308 TGenCollectionProxy.h:309 TGenCollectionProxy.h:310 TGenCollectionProxy.h:311 TGenCollectionProxy.h:312 TGenCollectionProxy.h:313 TGenCollectionProxy.h:314 TGenCollectionProxy.h:315 TGenCollectionProxy.h:316 TGenCollectionProxy.h:317 TGenCollectionProxy.h:318 TGenCollectionProxy.h:319 TGenCollectionProxy.h:320 TGenCollectionProxy.h:321 TGenCollectionProxy.h:322 TGenCollectionProxy.h:323 TGenCollectionProxy.h:324 TGenCollectionProxy.h:325 TGenCollectionProxy.h:326 TGenCollectionProxy.h:327 TGenCollectionProxy.h:328 TGenCollectionProxy.h:329 TGenCollectionProxy.h:330 TGenCollectionProxy.h:331 TGenCollectionProxy.h:332 TGenCollectionProxy.h:333 TGenCollectionProxy.h:334 TGenCollectionProxy.h:335 TGenCollectionProxy.h:336 TGenCollectionProxy.h:337 TGenCollectionProxy.h:338 TGenCollectionProxy.h:339 TGenCollectionProxy.h:340 TGenCollectionProxy.h:341 TGenCollectionProxy.h:342 TGenCollectionProxy.h:343 TGenCollectionProxy.h:344 TGenCollectionProxy.h:345 TGenCollectionProxy.h:346 TGenCollectionProxy.h:347 TGenCollectionProxy.h:348 TGenCollectionProxy.h:349 TGenCollectionProxy.h:350 TGenCollectionProxy.h:351 TGenCollectionProxy.h:352 TGenCollectionProxy.h:353 TGenCollectionProxy.h:354 TGenCollectionProxy.h:355 TGenCollectionProxy.h:356 TGenCollectionProxy.h:357