From 32fe7b52427cb59d3881d9a6345c63c9bf91b203 Mon Sep 17 00:00:00 2001 From: Jan Vahrenhold Date: Fri, 20 Jan 2006 15:40:28 +0000 Subject: [PATCH] Added a trim() method. git-svn-id: http://svn.daimi.au.dk/svn/tpie/trunk/tpie@1378 669acd26-ddd2-4139-9e68-486997aa639d --- include/ami_stack.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/ami_stack.h b/include/ami_stack.h index e97318d0c..b8b40036e 100644 --- a/include/ami_stack.h +++ b/include/ami_stack.h @@ -4,7 +4,7 @@ // Author: Darren Vengroff // Created: 12/15/94 // -// $Id: ami_stack.h,v 1.11 2006-01-19 23:02:32 jan Exp $ +// $Id: ami_stack.h,v 1.12 2006-01-20 15:40:28 jan Exp $ // #ifndef _AMI_STACK_H #define _AMI_STACK_H @@ -138,6 +138,17 @@ class AMI_stack { return m_amiStream->persist(); } + //////////////////////////////////////////////////////////////////// + /// + /// Truncates the underlying stream to the exact size (rounded up + /// to the next block) of items. + /// + //////////////////////////////////////////////////////////////////// + + AMI_err trim() { + return m_amiStream->truncate(m_size); + } + //////////////////////////////////////////////////////////////////// /// /// Compute the memory used by the stack and the aggregated stream. @@ -268,7 +279,7 @@ AMI_stack::~AMI_stack() { delete[] m_block[1]; // Make sure there are no left-overs. - m_amiStream->truncate(m_size); + trim(); delete m_amiStream; }