// This may look like C code, but it is really -*- C++ -*- /* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) This file is part of GNU CC. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the GNU CC General Public License for full details. Everyone is granted permission to copy, modify and redistribute GNU CC, but only under the conditions described in the GNU CC General Public License. A copy of this license is supposed to have been given to you along with GNU CC so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ #ifndef _AVec_h #ifdef __GNUG__ #pragma once #pragma interface #endif #define _AVec_h 1 #include ".Vec.h" class AVec : public Vec { protected: void check_len(int l); * vec(); AVec(int l, * d); public: AVec (); AVec (int l); AVec (int l, fill_value); AVec (AVec&); ~AVec (); AVec& operator = (AVec& a); AVec& operator = ( fill_value); // vector by scalar -> vector operations friend AVec operator + (AVec& a, b); friend AVec operator - (AVec& a, b); friend AVec operator * (AVec& a, b); friend AVec operator / (AVec& a, b); AVec& operator += ( b); AVec& operator -= ( b); AVec& operator *= ( b); AVec& operator /= ( b); // vector by vector -> vector operations friend AVec operator + (AVec& a, AVec& b); friend AVec operator - (AVec& a, AVec& b); AVec& operator += (AVec& b); AVec& operator -= (AVec& b); AVec operator - (); friend AVec product(AVec& a, AVec& b); AVec& product(AVec& b); friend AVec quotient(AVec& a, AVec& b); AVec& quotient(AVec& b); // vector -> scalar operations friend operator * (AVec& a, AVec& b); sum(); min(); max(); sumsq(); // indexing int min_index(); int max_index(); // redundant but necesssary friend AVec concat(AVec& a, AVec& b); friend AVec map(Mapper f, AVec& a); friend AVec merge(AVec& a, AVec& b, Comparator f); friend AVec combine(Combiner f, AVec& a, AVec& b); friend AVec reverse(AVec& a); AVec at(int from = 0, int n = -1); }; #if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) inline AVec::AVec() {} inline AVec::AVec(int l) :Vec(l) {} inline AVec::AVec(int l, fill_value) : Vec (l, fill_value) {} inline AVec::AVec(AVec& v) :(v) {} inline AVec::AVec(int l, * d) :Vec(l, d) {} inline AVec::~AVec() {} inline * AVec::vec() { return s; } inline void AVec::check_len(int l) { if (l != len) error("nonconformant vectors."); } #endif #endif