/usr/include/root/TObjectSpy.h is in libroot-core-dev 5.34.19+dfsg-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | // @(#)root/base:$Id$
// Author: Matevz Tadel 16/08/2006
/*************************************************************************
* Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TObjectSpy
#define ROOT_TObjectSpy
//////////////////////////////////////////////////////////////////////////
// //
// TObjectSpy, TObjectRefSpy //
// //
// Monitors objects for deletion and reflects the deletion by reverting //
// the internal pointer to zero. When this pointer is zero we know the //
// object has been deleted. This avoids the unsafe TestBit(kNotDeleted) //
// hack. The spied object must have the kMustCleanup bit set otherwise //
// you will get an error. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TObject
#include "TObject.h"
#endif
class TObjectSpy : public TObject {
private:
TObjectSpy(const TObjectSpy& s); // Not implemented. : TObject(), fObj(s.fObj), fFixMustCleanupBit(s.fFixMustCleanupBit) { }
TObjectSpy& operator=(const TObjectSpy& s); // Not implemented. { fObj = s.fObj; fFixMustCleanupBit = s.fFixMustCleanupBit; return *this; }
protected:
TObject *fObj; // object being spied
Bool_t fResetMustCleanupBit; // flag saying that kMustCleanup needs to be reset in dtor
public:
TObjectSpy(TObject *obj = 0, Bool_t fixMustCleanupBit=kTRUE);
virtual ~TObjectSpy();
virtual void RecursiveRemove(TObject *obj);
TObject *GetObject() const { return fObj; }
void SetObject(TObject *obj, Bool_t fixMustCleanupBit=kTRUE);
ClassDef(TObjectSpy, 0); // Spy object pointer for deletion
};
class TObjectRefSpy : public TObject {
private:
TObjectRefSpy(const TObjectRefSpy& s); // Not implemented. : TObject(), fObj(s.fObj), fFixMustCleanupBit(s.fFixMustCleanupBit) { }
TObjectRefSpy& operator=(const TObjectRefSpy& s); // Not implemented. { fObj = s.fObj; fFixMustCleanupBit = s.fFixMustCleanupBit; return *this; }
protected:
TObject *&fObj; // object being spied
Bool_t fResetMustCleanupBit; // flag saying that kMustCleanup needs to be reset in dtor
public:
TObjectRefSpy(TObject *&obj, Bool_t fixMustCleanupBit=kTRUE);
virtual ~TObjectRefSpy();
virtual void RecursiveRemove(TObject *obj);
TObject *GetObject() const { return fObj; }
ClassDef(TObjectRefSpy, 0); // Spy object reference for deletion
};
#endif
|