head	1.4;
access;
symbols
	r2_1:1.4
	r2_0:1.4
	r1_1_beta:1.4
	r1_1_alpha:1.4
	r1_0:1.4
	r0_11:1.4
	r0_10:1.4
	r0_9:1.4
	Eglin_alpha_1:1.4;
locks; strict;
comment	@// @;


1.4
date	93.06.10.16.47.35;	author thoth;	state Exp;
branches;
next	1.3;

1.3
date	93.05.26.16.28.21;	author thoth;	state Exp;
branches;
next	1.2;

1.2
date	93.05.19.14.42.34;	author thoth;	state Exp;
branches;
next	1.1;

1.1
date	92.10.27.16.34.51;	author thoth;	state Exp;
branches;
next	;


desc
@generic dynamic array
@


1.4
log
@Let the system define abort().
@
text
@// Emacs: -*- C++ -*-

//
//	Copyright 1993, Center for Computer Vision and Visualization,
//	University of Florida.  All rights reserved.
//

// 
// $Log:	Array.h,v $
// Revision 1.3  93/05/26  16:28:21  thoth
// Copyright Notices.
// 
// Revision 1.2  93/05/19  14:42:34  thoth
// Renamed to IA_Array.
// new operator() which is const.
// 
// Revision 1.1  92/10/27  16:34:51  thoth
// Initial revision
// 
//

#ifndef Array_h_
#define Array_h_

#include <stdlib.h>

template <class T>
class IA_Array {
private:
  T	*data;
  unsigned length;
  unsigned size;
public:
  IA_Array(unsigned size_=16);
  IA_Array(T*data_, unsigned size_, int giveaway=0);
  IA_Array(const IA_Array&);
  IA_Array& operator=(const IA_Array&);
  ~IA_Array() { delete[] data; }

  T& operator[](unsigned);
  T operator[](unsigned) const;
  T operator()(unsigned) const;
  T& after_last() { return (*this)[length]; }
  T& last() {
      if (length<1)
	  abort();
      return (*this)[length-1];
  }
  T last() const { return (*this)[length-1]; }

  T* data_start() { return data; }
  const T* data_start() const { return data; }

  unsigned len() const { return length; }
  unsigned shorten(unsigned newlen);
  unsigned lengthen(unsigned newlen);
  unsigned resize(unsigned);
};

#endif
@


1.3
log
@Copyright Notices.
@
text
@d10 3
d25 1
a25 3
extern "C" {
    int abort(...);
}
@


1.2
log
@Renamed to IA_Array.
new operator() which is const.
@
text
@d3 5
d10 4
@


1.1
log
@Initial revision
@
text
@d4 4
a7 1
// $Log:	IntPointSet.h,v $
d18 1
a18 1
class Array {
d24 5
a28 5
  Array(unsigned size_=16);
  Array(T*data_, unsigned size_, int giveaway=0);
  Array(const Array&);
  Array& operator=(const Array&);
  ~Array() { delete[] data; }
d32 1
@
