rt_list.hpp

00001 #ifndef ORO_OS_RT_LIST_HPP
00002 #define ORO_OS_RT_LIST_HPP
00003 
00004 #include <list>
00005 #include "oro_allocator.hpp"
00006 
00007 namespace RTT { namespace OS {
00008 
00017     template<class T, class Alloc = std::allocator<T> >
00018     struct rt_list
00019         : public std::list<T, local_allocator<T,Alloc> >
00020     {
00021     protected:
00022         typedef typename std::list<T, local_allocator<T,Alloc> >::_Node ItemType;
00023     public:
00024         ~rt_list() {
00025             rt_shrink(1); // cleanup if possible.
00026             // this prevents leaking the node allocated
00027             // by list<>.
00028         }
00033         void rt_grow(std::size_t items)
00034         {
00035             local_allocator<ItemType> la;
00036             la.grow( items );
00037         }
00038 
00042         void rt_shrink(std::size_t items)
00043         {
00044             local_allocator<ItemType> la;
00045             la.shrink( items );
00046         }
00047     };
00048 
00049 
00050 }}
00051 
00052 #endif
Generated on Thu Dec 23 13:22:38 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3