Warning, file /include/root/TClassRef.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TClassRef
0013 #define ROOT_TClassRef
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TClass.h"
0025
0026 #include <string>
0027
0028 class TClassRef {
0029
0030 private:
0031 std::string fClassName;
0032 TClass *const*fClassPtr;
0033
0034 friend class TClass;
0035
0036 void Assign(const TClassRef &);
0037 void Assign(TClass *);
0038 TClass *InternalGetClass() const;
0039 public:
0040 TClassRef() : fClassName(), fClassPtr(nullptr) {}
0041 TClassRef(TClass *cl);
0042 TClassRef(const char *classname);
0043 TClassRef(const TClassRef&);
0044 inline TClassRef &operator=(const TClassRef &rhs) {
0045
0046 if (this != &rhs && (!fClassPtr || fClassPtr != rhs.fClassPtr)) {
0047 this->Assign(rhs);
0048 }
0049 return *this;
0050 }
0051 inline TClassRef &operator=(TClass *rhs) {
0052
0053 if ( !this->fClassPtr|| *(this->fClassPtr) != rhs) {
0054 this->Assign(rhs);
0055 }
0056 return *this;
0057 }
0058
0059 ~TClassRef() { };
0060
0061 void SetName(const char* new_name) {
0062 if ( fClassPtr && fClassName != new_name ) Reset();
0063 fClassName = new_name;
0064 }
0065 const char *GetClassName() { return fClassName.c_str(); }
0066 TClass *GetClass() const { return (fClassPtr && *fClassPtr) ? *fClassPtr : InternalGetClass(); }
0067 void Reset() { fClassPtr = nullptr; }
0068
0069 TClass* operator->() const { return (fClassPtr && *fClassPtr) ? *fClassPtr : InternalGetClass(); }
0070 operator TClass*() const { return (fClassPtr && *fClassPtr )? *fClassPtr : InternalGetClass(); }
0071
0072 };
0073
0074 #endif