ObjectArena< Type > Class Template Reference

#include <ObjectArena.h>

List of all members.

Public Member Functions

 ObjectArena (void)
 ~ObjectArena (void)
void setBlockSize (int n)
Type * getNewArray (int n)


Detailed Description

template<class Type>
class ObjectArena< Type >

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 16 of file ObjectArena.h.


Constructor & Destructor Documentation

template<class Type>
ObjectArena< Type >::ObjectArena ( void   )  [inline]

Definition at line 18 of file ObjectArena.h.

00018 : blockSize(1024), alignment(1), pos(0), end(0) { };

template<class Type>
ObjectArena< Type >::~ObjectArena ( void   )  [inline]

Definition at line 19 of file ObjectArena.h.

00019                        {
00020       int i;
00021       for( i = 0; i < blocks.size(); ++i ) delete [] blocks[i];
00022     }


Member Function Documentation

template<class Type>
Type* ObjectArena< Type >::getNewArray ( int  n  )  [inline]

Definition at line 49 of file ObjectArena.h.

Referenced by ComputeNonbondedCUDA::build_exclusions(), and Molecule::receive_Molecule().

00049                                     {
00050       Type *rpos = pos;
00051       if ( n > (blockSize/2) ) {
00052         rpos = new Type[n];
00053         blocks.add(rpos);
00054       } else if ( ( pos += n ) > end ) {
00055         rpos = pos = new Type[blockSize];
00056         blocks.add(pos);
00057         end = rpos + blockSize;
00058         pos += n;
00059       }
00060       return rpos;
00061     }

template<class Type>
void ObjectArena< Type >::setBlockSize ( int  n  )  [inline]

Definition at line 23 of file ObjectArena.h.

00023 { blockSize = n; }


The documentation for this class was generated from the following file:
Generated on Tue Nov 21 01:17:20 2017 for NAMD by  doxygen 1.4.7