2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief pool_alloc_mixin inline template implementation */
17 //#include "pool_alloc_mixin.ih"
20 #include <senf/Utils/senfassert.hh>
22 #define prefix_ inline
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 prefix_ void * senf::pool_alloc_mixin<Self>::operator new(size_t size)
28 // When deriving from Self you may not change the class's size without
29 // inheriting from pool_alloc_mixin again. See pool_alloc_mixin documentation.
30 SENF_ASSERT( size <= sizeof(Self),
31 "senf::pool_alloc_mixin::operator new(): "
32 "Bad object size. Missing pool_alloc_mixin base in derived class?" );
36 return boost::singleton_pool< pool_alloc_mixin_tag, sizeof(Self) >::malloc();
40 prefix_ void senf::pool_alloc_mixin<Self>::operator delete(void * p, size_t size)
45 boost::singleton_pool< pool_alloc_mixin_tag, sizeof(Self) >::free(p);
51 prefix_ unsigned long senf::pool_alloc_mixin<Self>::allocCounter()
53 return allocCounter(0);
57 prefix_ unsigned long senf::pool_alloc_mixin<Self>::allocCounter(long delta)
59 static unsigned long counter (0);
66 //-/////////////////////////////////////////////////////////////////////////////////////////////////
73 // c-file-style: "senf"
74 // indent-tabs-mode: nil
75 // ispell-local-dictionary: "american"
76 // compile-command: "scons -u test"