ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/ObjectService/interface/NamedObjectOwned.h
Revision: 1.1
Committed: Wed Jul 30 21:39:13 2008 UTC (16 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: MITHEP_2_0_x
Log Message:
Throw, and fix for event objects (not used so far)

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: NamedObject.h,v 1.2 2008/07/30 11:24:43 loizides Exp $
3 //
4 // NamedObjectOwned
5 //
6 // Class for storing objects in a THashTable. Objects are owned and will therefore be
7 // deleted. This class is only used internally by the ObjectService.
8 //
9 // Authors: C.Loizides
10 //--------------------------------------------------------------------------------------------------
11
12 #ifndef MITPROD_NAMEDOBJECTOWNED_H
13 #define MITPROD_NAMEDOBJECTOWNED_H
14
15 #include <TNamed.h>
16
17 namespace mithep
18 {
19 template<class T>
20 class NamedObjectOwned : public TNamed
21 {
22 public:
23 NamedObjectOwned(T *ptr) : TNamed(((TObject*)ptr)->GetName(),0), fPtr(ptr) {}
24 NamedObjectOwned(T *ptr, const char *n) : TNamed(n,0), fPtr(ptr) {}
25 ~NamedObjectOwned() { delete fPtr; }
26 const T *Get() const { return fPtr; }
27
28 private:
29 T *fPtr; //pointer to object
30 };
31 }
32 #endif