An Array of Objects of Type T for ParmParse
This class implements an array of objects of the parameterized type T. In contrast with the predefined C++ array type, an `PP_Array<T>' object knows its length, can be dynamically resized, and provides automatic bounds checking. The bounds checking can be turned off by specifying the -DNDEBUG flag on the command line when compiling the BOXLIB library. The main reason for defining the PP_Array class is that it is used, either by composition or inheritance, to implement many of the other classes in the BOXLIB library.The `PP_Array<T>' class works by storing copies of the objects it contains. If the objects are large, such as `FARRAYBOX's it is probably better to use the `PArray' class which is an array class that stores pointers to the objects (avoiding expensive copies). The `PP_Array<T>' class destructs all objects in the array when it is itself destructed. If this is not the desired action, the `PArray' class should be used.
In the PP_Array<T> class, there are two different concepts of size: the amount of space allocated, and the amount of space actually used. Obviously, the allocated space must be larger than the used space. We separate these two concepts to allow the user to optionally avoid memory allocation costs. Rather than construct and destroy a temporary PP_Array<T> many times, it may be less expensive to allocate it once with enough memory to handle all uses, and resize the PP_Array<T> for each particular use. See the member functions `reserve', `shrinkWrap', and `resize'.
Note that care must be taken when deriving classes from `PP_Array<T>'. It is a concrete class, not a polymorphic one.
This class does NOT provide an assignment operator for assigning an integer to an PP_Array<T>.
This is a convenience class for ParmParse and will not be in any way supported by anyone at ANAG.
This software is copyright (C) by the Lawrence Berkeley National Laboratory. Permission is granted to reproduce this software for non-commercial purposes provided that this notice is left intact.
It is acknowledged that the U.S. Government has rights to this software under Contract DE-AC03-765F00098 between the U.S. Department of Energy and the University of California.
This software is provided as a professional and academic contribution for joint exchange. Thus it is experimental, is provided ``as is'', with no warranties of any kind whatsoever, no support, no promise of updates, or printed documentation. By using this software, you acknowledge that the Lawrence Berkeley National Laboratory and Regents of the University of California shall have no liability with respect to the infringement of other copyrights by any part of this software.