Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

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(), ComputeMap::storeCompute(), PatchMap::unpack(), and ComputeMap::unpack().

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.

Referenced by ComputeMap::allocateCids(), PatchMap::unpack(), and ComputeMap::unpack().

00023 { blockSize = n; }


The documentation for this class was generated from the following file:
Generated on Mon Nov 23 05:00:01 2009 for NAMD by  doxygen 1.3.9.1