1  /*
   2   * \brief  Typed slab allocator
   3   * \author Norman Feske
   4   * \date   2006-05-17
   5   */

   6  
   7  /*
   8   * Copyright (C) 2006-2013 Genode Labs GmbH
   9   *
  10   * This file is part of the Genode OS framework, which is distributed
  11   * under the terms of the GNU General Public License version 2.
  12   */

  13  
  14  #ifndef _INCLUDE__BASE__TSLAB_H_
  15  #define _INCLUDE__BASE__TSLAB_H_
  16  
  17  #include <base/slab.h>
  18  
  19  namespace Genode { template <typename, size_t> struct Tslab; }
  20  
  21  
  22  template <typename T, Genode::size_t BLOCK_SIZE>
  23  struct Genode::Tslab : Slab
  24  {
  25     Tslab(Allocator  *backing_store,
  26           Slab_block *initial_sb = 0)

  27     : Slab(sizeof(T), BLOCK_SIZE, initial_sb, backing_store)
  28     { }

  29  
  30     *first_object() { return (*)Slab::first_used_elem(); }

  31  }
;

  32  
  33  #endif /* _INCLUDE__BASE__TSLAB_H_ */