Skip to content

Commit

Permalink
Added a trim() method.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.daimi.au.dk/svn/tpie/trunk/tpie@1378 669acd26-ddd2-4139-9e68-486997aa639d
  • Loading branch information
Jan Vahrenhold committed Jan 20, 2006
1 parent 3f5a8ea commit 32fe7b5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions include/ami_stack.h
Expand Up @@ -4,7 +4,7 @@
// Author: Darren Vengroff <darrenv@eecs.umich.edu>
// 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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -268,7 +279,7 @@ AMI_stack<T>::~AMI_stack() {
delete[] m_block[1];

// Make sure there are no left-overs.
m_amiStream->truncate(m_size);
trim();

delete m_amiStream;
}
Expand Down

0 comments on commit 32fe7b5

Please sign in to comment.