diff --git a/src/libCom/cxxTemplates/README b/src/libCom/cxxTemplates/README index 566497b6a..ba9a29bb8 100644 --- a/src/libCom/cxxTemplates/README +++ b/src/libCom/cxxTemplates/README @@ -3,13 +3,14 @@ C++ templates: tsSLList.h - type safe single linked list template tsDLList.h - type safe double linked list template resourceLib.h - hash table template +tsFreeeList.h - free list allocator / deallocator the test subdir contains examples Since I am using templates the linked lists are type safe (no casting of pointers ala ellList and dllList). Also, the node class in embedded in the item on the -list (more efficent use of pool). +list (more efficient use of pool). The file resourceLib.h provides a core hashing library "resTable " where "itemClass" objects diff --git a/src/libCom/cxxTemplates/tsDLList.h b/src/libCom/cxxTemplates/tsDLList.h index 229c76348..071d776b6 100644 --- a/src/libCom/cxxTemplates/tsDLList.h +++ b/src/libCom/cxxTemplates/tsDLList.h @@ -761,7 +761,7 @@ inline tsDLIterBD tsDLIterBD::operator -- (int) // postfix -- return tmp; } -#include +#include "tsDLListDeprecated.h" #endif // tsDLListH_include diff --git a/src/libCom/cxxTemplates/tsFreeList.h b/src/libCom/cxxTemplates/tsFreeList.h index 2b0cc3251..c7b050f47 100644 --- a/src/libCom/cxxTemplates/tsFreeList.h +++ b/src/libCom/cxxTemplates/tsFreeList.h @@ -10,6 +10,31 @@ * Author: Jeff Hill */ +// +// To allow your class to be allocated off of a free list +// using the new operator: +// +// 1) add the following static, private free list data member +// to your class +// +// static tsFreeList < class classXYZ, 1024 > freeList; +// +// 2) add the following member functions to your class +// +// inline void * classXYZ::operator new ( size_t size ) +// { +// return classXYZ::freeList.allocate ( size ); +// } +// +// inline void classXYZ::operator delete ( void *pCadaver, size_t size ) +// { +// classXYZ::freeList.release ( pCadaver, size ); +// } +// +// If you wish to force use of the new operator, then declare your class's +// destructor as a private member function. +// + #include #include #include "osiMutex.h" @@ -18,7 +43,6 @@ # pragma warning ( disable : 4291 ) #endif - template < class T, unsigned DEBUG_LEVEL > union tsFreeListItem { public: