ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/ObjectService/interface/NamedObject.h
(Generate patch)

Comparing UserCode/MitProd/ObjectService/interface/NamedObject.h (file contents):
Revision 1.1 by loizides, Wed Jul 30 09:04:39 2008 UTC vs.
Revision 1.2 by loizides, Wed Jul 30 11:24:43 2008 UTC

# Line 1 | Line 1
1   //--------------------------------------------------------------------------------------------------
2   // $Id$
3   //
4 < // ObjectService
5 <      // Class for storing event objects:
6 <      // It assumes ownership of the object.
7 <      // It is needed to force the THashTable to call Hash on a TNamed
8 <      // to allow lookup using the hash value given the object's name
9 <      // (as opposed to its pointer value, as is done for TObject's).
4 > // NamedObject
5   //
6 + // 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   //
9   // Authors: C.Loizides
10   //--------------------------------------------------------------------------------------------------
# Line 23 | Line 20 | namespace mithep
20    class NamedObject : public TNamed
21    {
22      public:
23 <      NamedObject(T *ptr) : TNamed(((TObject*)ptr)->GetName(),0), fPtr(ptr) {}
24 <      NamedObject(T *ptr, const char *n) : TNamed(n,0), fPtr(ptr) {}
25 <      ~NamedObject() { delete fPtr; }
29 <      T             *Get()       { return fPtr; }
23 >      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        const T       *Get() const { return fPtr; }
27  
28      private:
29 <      T             *fPtr; //pointer to object
29 >      const T       *fPtr; //pointer to object
30    };
31   }
32   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines