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 {
20
21 template <typename T, size_t BLOCK_SIZE>
22 class Tslab : public Slab
23 {
24 public:
25
26 Tslab(Allocator *backing_store,
27 Slab_block *initial_sb = 0)
28 : Slab(sizeof(T), BLOCK_SIZE, initial_sb, backing_store)
29 { }
30
31 T *first_object() { return (T *)Slab::first_used_elem(); }
32 };
33 }
34
35 #endif /* _INCLUDE__BASE__TSLAB_H_ */