// $Id$ // // Copyright (C) 2007 // Fraunhofer Institute for Open Communication Systems (FOKUS) // // The contents of this file are subject to the Fraunhofer FOKUS Public License // Version 1.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // http://senf.berlios.de/license.html // // The Fraunhofer FOKUS Public License Version 1.0 is based on, // but modifies the Mozilla Public License Version 1.1. // See the full license text for the amendments. // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License // for the specific language governing rights and limitations under the License. // // The Original Code is Fraunhofer FOKUS code. // // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. // (registered association), Hansastraße 27 c, 80686 Munich, Germany. // All Rights Reserved. // // Contributor(s): // Stefan Bund /** \file \brief pool_alloc_mixin inline template implementation */ //#include "pool_alloc_mixin.ih" // Custom includes #include #define prefix_ inline //-///////////////////////////////////////////////////////////////////////////////////////////////// template prefix_ void * senf::pool_alloc_mixin::operator new(size_t size) { // When deriving from Self you may not change the class's size without // inheriting from pool_alloc_mixin again. See pool_alloc_mixin documentation. SENF_ASSERT( size <= sizeof(Self), "senf::pool_alloc_mixin::operator new(): " "Bad object size. Missing pool_alloc_mixin base in derived class?" ); #ifdef SENF_DEBUG allocCounter(1); #endif return boost::singleton_pool< pool_alloc_mixin_tag, sizeof(Self) >::malloc(); } template prefix_ void senf::pool_alloc_mixin::operator delete(void * p, size_t size) { #ifdef SENF_DEBUG allocCounter(-1); #endif boost::singleton_pool< pool_alloc_mixin_tag, sizeof(Self) >::free(p); } #ifdef SENF_DEBUG template prefix_ unsigned long senf::pool_alloc_mixin::allocCounter() { return allocCounter(0); } template prefix_ unsigned long senf::pool_alloc_mixin::allocCounter(long delta) { static unsigned long counter (0); counter += delta; return counter; } #endif //-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" // comment-column: 40 // End: