/** * PANDA 3D SOFTWARE * Copyright (c) Carnegie Mellon University. All rights reserved. * * All use of this software is subject to the terms of the revised BSD * license. You should have received a copy of this license along * with this source code in a file named "LICENSE." * * @file pallocator.T * @author drose * @date 2001-06-05 */ template INLINE pallocator_single:: pallocator_single(TypeHandle type_handle) noexcept : _type_handle(type_handle) { } template INLINE Type *pallocator_single:: allocate(typename pallocator_single::size_type n, typename std::allocator::const_pointer) { TAU_PROFILE("pallocator_single:allocate()", " ", TAU_USER); // This doesn't support allocating arrays. assert(n == 1); return (Type *)ASSUME_ALIGNED(StaticDeletedChain::allocate(sizeof(Type), _type_handle), MEMORY_HOOK_ALIGNMENT); } template INLINE void pallocator_single:: deallocate(typename pallocator_single::pointer p, typename pallocator_single::size_type) { TAU_PROFILE("pallocator_single:deallocate()", " ", TAU_USER); StaticDeletedChain::deallocate(p, _type_handle); } template INLINE pallocator_array:: pallocator_array(TypeHandle type_handle) noexcept : _type_handle(type_handle) { } template INLINE Type *pallocator_array:: allocate(typename pallocator_array::size_type n, typename std::allocator::const_pointer) { return (typename pallocator_array::pointer) ASSUME_ALIGNED(_type_handle.allocate_array(n * sizeof(Type)), MEMORY_HOOK_ALIGNMENT); } template INLINE void pallocator_array:: deallocate(typename pallocator_array::pointer p, typename pallocator_array::size_type) { _type_handle.deallocate_array((void *)p); }