ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/ObjectService/interface/NamedObject.h
Revision: 1.2
Committed: Wed Jul 30 11:24:43 2008 UTC (16 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: MITHEP_2_0_x
Changes since 1.1: +8 -12 lines
Log Message:
Added ObjectService.

File Contents

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