29 virtual ~DynamicType() {}
32 typedef std::map<const void*, TClass*> ClassMap_t;
33 inline ClassMap_t *GetMap(
const void*
p)
35 return (ClassMap_t*)
p;
38 inline ClassMap_t::value_type* ToPair(
void*
p)
40 return (ClassMap_t::value_type*)
p;
49 : fType(&typ),
fClass(nullptr),
50 fSubTypesReaders(0), fSubTypesWriteLockTaken(
kFALSE), fNextLastSlot(0),
53 static_assert(
sizeof(ClassMap_t)<=
sizeof(
fSubTypes),
"ClassMap size is to large for array");
92 if ( !
fClass )
return nullptr;
106 DynamicType* ptr = (DynamicType*)obj;
107 const std::type_info* typ = &
typeid(*ptr);
109 if ( typ ==
fType ) {
112 for(
auto& slot :
fLasts) {
113 auto last = ToPair(slot);
114 if ( last && typ == last->first ) {
121 if ( last ==
nullptr ) {
132 UChar_t expected_value = next + 1;
134 fNextLastSlot.compare_exchange_strong(expected_value, next + 1);
138 return last ? last->second :
nullptr;
146 bool needToWait =
kTRUE;
160 void* returnValue =
nullptr;
163 auto found = map->find(
type);
164 if(found != map->end()) {
165 returnValue = &(*found);
186 auto ret = map->emplace(
type,cls);
189 (*ret.first).second = cls;
193 return &(*(ret.first));
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
#define R__WRITE_LOCKGUARD(mutex)
TClass instances represent classes, structs and namespaces in the ROOT type system.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Atomic_t< UInt_t > fSubTypesReaders
void * CacheSubType(const std::type_info *, TClass *)
Record the TClass found for a std::type_info, so that we can retrieved it faster.
virtual ~TIsAProxy()
Standard destructor.
TClass * operator()(const void *obj) override
IsA callback.
Atomic_t< UChar_t > fNextLastSlot
const std::type_info * fType
Atomic_t< Bool_t > fSubTypesWriteLockTaken
Atomic_t< void * > fLasts[fgMaxLastSlot]
void * FindSubType(const std::type_info *) const
See if we have already cached the TClass that correspond to this std::type_info.
static constexpr UInt_t fgMaxLastSlot
void SetClass(TClass *cl) override
Set class pointer This method is not thread safe.
TIsAProxy(const TIsAProxy &)=delete
R__EXTERN TVirtualRWMutex * gCoreMutex