0022815: Missing delete operator for placement new
[occt.git] / src / NCollection / NCollection_TListNode.hxx
1 // File:        NCollection_TListNode.hxx
2 // Created:     Tue Apr 23 17:30:38 2002
3 // Author:      Alexander KARTOMIN (akm)
4 //              <akm@opencascade.com>
5
6 #ifndef NCollection_TListNode_HeaderFile
7 #define NCollection_TListNode_HeaderFile
8
9 #include <NCollection_ListNode.hxx>
10 #include <NCollection_BaseAllocator.hxx>
11 #include <NCollection_DefineAlloc.hxx>
12
13 /**
14  * Purpose:     Abstract list node class. Used by BaseList
15  * Remark:      Internal class
16  */              
17 template <class TheItemType> class NCollection_TListNode 
18   : public NCollection_ListNode
19 {
20  public:
21   //! Constructor
22   NCollection_TListNode (const TheItemType& theItem,
23                          NCollection_ListNode* theNext=NULL) :
24     NCollection_ListNode  (theNext) { myValue = theItem; }
25   //! Constant value access
26   const TheItemType& Value () const { return myValue; }
27   //! Variable value access
28   TheItemType& ChangeValue () { return myValue; }
29   //! Memory allocation
30   DEFINE_STANDARD_ALLOC
31   DEFINE_NCOLLECTION_ALLOC
32   //! Static deleter to be passed to BaseList
33   static void delNode (NCollection_ListNode * theNode, 
34                        Handle(NCollection_BaseAllocator)& theAl)
35   {
36     ((NCollection_TListNode *) theNode)->myValue.~TheItemType();
37     theAl->Free(theNode);
38   }
39
40   
41  protected:
42   TheItemType    myValue; //!< The item stored in the node
43   
44 };
45
46 #endif