Array Class Template Reference

Template class for the Dakota bookkeeping array. More...

List of all members.

Public Member Functions

 Array ()
 Default constructor.
 Array (size_t size)
 Constructor which takes an initial size.
 Array (size_t size, const T &initial_val)
 Constructor which takes an initial size and an initial value.
 Array (const Array< T > &a)
 Copy constructor.
 Array (const T *p, size_t size)
 Constructor which copies size entries from T*.
 ~Array ()
 Destructor.
Array< T > & operator= (const Array< T > &a)
 Normal const assignment operator.
Array< T > & operator= (Array< T > &a)
 Normal assignment operator.
Array< T > & operator= (const T &ival)
 Sets all elements in self to the value ival.
 operator T * () const
 Converts the Array to a standard C-style array. Use with care!
T & operator[] (int i)
 alternate bounds-checked indexing operator for int indices
const T & operator[] (int i) const
 alternate bounds-checked const indexing operator for int indices
T & operator[] (size_t i)
 Index operator, returns the ith value of the array.
const T & operator[] (size_t i) const
 Index operator const, returns the ith value of the array.
T & operator() (size_t i)
 Index operator, not bounds checked.
const T & operator() (size_t i) const
 Index operator const, not bounds checked.
void read (istream &s)
 Reads an Array from an istream.
void write (ostream &s) const
 Writes an Array to an output stream.
void write (ostream &s, const Array< String > &label_array) const
 Writes an Array and associated label array to an output stream.
void write_aprepro (ostream &s, const Array< String > &label_array) const
 aprepro format
void write_annotated (ostream &s, bool write_len) const
 Writes an Array to an output stream in annotated format.
void read (BiStream &s)
 Reads an Array from a binary input stream.
void write (BoStream &s) const
 Writes an Array to a binary output stream.
void read (MPIUnpackBuffer &s)
 Reads an Array from a buffer after an MPI receive.
void write (MPIPackBuffer &s) const
 Writes an Array to a buffer prior to an MPI send.
size_t length () const
 Returns size of array.
void reshape (size_t sz)
 Resizes array to size sz.
size_t index (const T &a) const
 Returns the index of the first array item which matches the object a.
bool contains (const T &a) const
 Checks if the array contains an object which matches the object a.
size_t count (const T &a) const
 Returns the number of items in the array matching the object a.
const T * data () const
 Returns pointer T* to continuous data.


Detailed Description

template<class T>
class Dakota::Array< T >

Template class for the Dakota bookkeeping array.

An array class template that provides additional functionality that is specific to Dakota's needs. The Array class adds additional functionality needed by Dakota to the inherited base array class. The Array class can inherite from either the STL or RW vector classes.


Constructor & Destructor Documentation

Array ( const T *  p,
size_t  size 
) [inline]

Constructor which copies size entries from T*.

Assigns size values from p into array.


Member Function Documentation

Array< T > & operator= ( const T &  ival  )  [inline]

Sets all elements in self to the value ival.

Assigns all values of array to the value passed in as ival. For the Rogue Wave case, utilizes base class operator=(ival), while for the ANSI case, uses the STL assign() method.

operator T * (  )  const [inline]

Converts the Array to a standard C-style array. Use with care!

The operator() returns a c style pointer to the data within the array. Calls the data() method. USE WITH CARE.

T & operator[] ( size_t  i  )  [inline]

Index operator, returns the ith value of the array.

Index operator; calls the STL method at() which is bounds checked. Mimics the RW vector class. Note: the at() method is not supported by the __GNUC__ STL implementation or by builds omitting exceptions (e.g., SIERRA).

const T & operator[] ( size_t  i  )  const [inline]

Index operator const, returns the ith value of the array.

A const version of the index operator; calls the STL method at() which is bounds checked. Mimics the RW vector class. Note: the at() method is not supported by the __GNUC__ STL implementation or by builds omitting exceptions (e.g., SIERRA).

T & operator() ( size_t  i  )  [inline]

Index operator, not bounds checked.

Non bounds check index operator, calls the STL operator[] which is not bounds checked. Needed to mimic the RW vector class

const T & operator() ( size_t  i  )  const [inline]

Index operator const, not bounds checked.

A const version of the non-bounds check index operator, calls the STL operator[] which is not bounds checked. Needed to mimic the RW vector class

const T * data (  )  const [inline]

Returns pointer T* to continuous data.

Returns a C style pointer to the data within the array. USE WITH CARE. Needed to mimic RW vector class, is used in the operator(). Uses the STL front method.


The documentation for this class was generated from the following file:
Generated on Wed Nov 5 19:54:06 2008 for DAKOTA by  doxygen 1.5.1