Polaris: Array< T > Class Template Reference

Array< T > Class Template Reference

A template for an array of objects. More...

#include <Array.h>

List of all members.

Public Member Functions

 Array ()
 Array (int size)
 Array (const Array< T > &other)
 ~Array ()
int entries () const
 Return the size of the array.
const T & operator[] (int sub) const
T & operator[] (int sub)
 Access an element in the array.
void clear ()
 Delete all the elements of the array and set the size to zero.
void resize (int size)
 Resize the array to the given value.
void print (ostream &out) const
 gcc-2.96 need the stupid "<>" pair inline friend ostream & operator << (ostream &o, const Array<T> & a);
void print (ostream &out, char *sep) const
 Print Array with 'sep' separating each element.
Array< T > & operator= (const Array< T > &l)
 Copy the contents of the other array into myself.
int structures_OK () const
 Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.

Friends

ostream & operator<< (ostream &o, const Array< T > &a)
 Print Array as a comma separated list where each element is printed out in the form subscript:object.


Detailed Description

template<class T>
class Array< T >

A template for an array of objects.

Polaris Base

See also:
Array.h

Array.h

Overview

This class is a template for forming an array of objects.

Description

The Array class offers three improvements from a simple array of objects; It knows its size, it can be resized, and it knows how to print itself. This class differs from the List class in that random access is cheap to perform while resizing is expensive.

The objects stored in Array must have two methods: a constructor that takes no arguments, and operator=().

Arrays are indexed from 0.

Definition at line 36 of file Array.h.


Constructor & Destructor Documentation

template<class T>
Array< T >::Array  )  [inline]
 

Definition at line 88 of file Array.h.

References register_instance().

template<class T>
Array< T >::Array int  size  )  [inline]
 

Definition at line 100 of file Array.h.

References register_instance(), and Array< T >::resize().

template<class T>
Array< T >::Array const Array< T > &  other  )  [inline]
 

Definition at line 113 of file Array.h.

References register_instance().

template<class T>
Array< T >::~Array  )  [inline]
 

Definition at line 126 of file Array.h.

References unregister_instance().


Member Function Documentation

template<class T>
int Array< T >::entries  )  const [inline]
 

Return the size of the array.

Definition at line 138 of file Array.h.

Referenced by _delete_dead_code(), PropConstMap::all_non_const(), PropConstIntMap::all_non_const(), build_expr(), PropConstMap::entries(), PropConstIntMap::entries(), GSAPathMap::GSAPathMap(), PredicateRepository::ins(), PredicateElem::ins_AND(), PredicateElem::ins_OR(), PropConstMap::intersect(), PropConstIntMap::intersect(), main(), GSAPathExpr::operator *=(), GSAPathExpr::operator/=(), PropConstMap::operator==(), PropConstIntMap::operator==(), GSAPathExpr::operator|=(), InterProcConstProp::pgms_can_be_called_externally(), PropConstMap::pretty_print(), PropConstIntMap::pretty_print(), GSAPathMap::print(), SimBiGraph::SimBiGraph(), and PropConstMap::structures_OK().

template<class T>
const T & Array< T >::operator[] int  sub  )  const [inline]
 

Definition at line 145 of file Array.h.

References sub().

template<class T>
T & Array< T >::operator[] int  sub  )  [inline]
 

Access an element in the array.

Definition at line 155 of file Array.h.

References sub().

template<class T>
void Array< T >::clear  )  [inline]
 

Delete all the elements of the array and set the size to zero.

Definition at line 165 of file Array.h.

Referenced by main().

template<class T>
void Array< T >::resize int  size  )  [inline]
 

Resize the array to the given value.

Definition at line 177 of file Array.h.

Referenced by ar_subregion(), Array< T >::Array(), SimGraph::calc_similarity(), SimBiGraph::calc_similarity(), GSAPathMap::GSAPathMap(), PredicateRepository::ins(), PredicateElem::ins_AND(), PredicateElem::ins_OR(), intersect_ARDs(), invert_match(), main(), GSAPathExpr::operator *=(), GSAPathExpr::operator/=(), Array< T >::operator=(), GSAPathExpr::operator|=(), PredicateElem::PredicateElem(), PredicateRepository::PredicateRepository(), SimBiGraph::SimBiGraph(), SimBiGraphIterator::SimBiGraphIterator(), SimGraph::SimGraph(), and SimGraphIterator::SimGraphIterator().

template<class T>
void Array< T >::print ostream &  out  )  const [inline]
 

gcc-2.96 need the stupid "<>" pair inline friend ostream & operator << (ostream &o, const Array<T> & a);

Definition at line 223 of file Array.h.

Referenced by main(), operator<<(), PropConstMap::print(), and PropConstIntMap::print().

template<class T>
void Array< T >::print ostream &  out,
char *  sep
const [inline]
 

Print Array with 'sep' separating each element.

The subscripts are not printed.

Definition at line 211 of file Array.h.

template<class T>
Array< T > & Array< T >::operator= const Array< T > &  l  )  [inline]
 

Copy the contents of the other array into myself.

Definition at line 198 of file Array.h.

References Array< T >::resize().

template<class T>
int Array< T >::structures_OK  )  const [inline]
 

Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.

Definition at line 242 of file Array.h.

Referenced by main(), PropConstMap::structures_OK(), and PropConstIntMap::structures_OK().


Friends And Related Function Documentation

template<class T>
ostream& operator<< ostream &  o,
const Array< T > &  a
[friend]
 

Print Array as a comma separated list where each element is printed out in the form subscript:object.

Definition at line 234 of file Array.h.


The documentation for this class was generated from the following file:
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:06:42 2005