/* * Copyright (c) 1995, 1996 Gunther Schadow. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "pg_config.h" IDENT("@(#) BaseUnit.cc (Gunther Schadow) 12/19/96"); #pragma implementation "BaseUnit.h" #include "BaseUnit.h" #include "iostream.h" base_unit_vector base_unit_vector::operator + (const base_unit_vector &x) const { base_unit_vector r; r.length = length + x.length; r.time = time + x.time; r.mass = mass + x.mass; r.charge = charge + x.charge; r.temperature = temperature + x.temperature; r.lumin_intens = lumin_intens + x.lumin_intens; r.angle = angle + x.angle; return r; } base_unit_vector base_unit_vector::operator - (const base_unit_vector& x) const { base_unit_vector r; r.length = length - x.length; r.time = time - x.time; r.mass = mass - x.mass; r.charge = charge - x.charge; r.temperature = temperature - x.temperature; r.lumin_intens = lumin_intens - x.lumin_intens; r.angle = angle - x.angle; return r; } base_unit_vector base_unit_vector::operator * (int x) const { base_unit_vector r; r.length = length * x; r.time = time * x; r.mass = mass * x; r.charge = charge * x; r.temperature = temperature * x; r.lumin_intens = lumin_intens * x; r.angle = angle * x; return r; } base_unit_vector base_unit_vector::operator - () const { base_unit_vector r; r.length = -length; r.time = -time; r.mass = -mass; r.charge = -charge; r.temperature = -temperature; r.lumin_intens = -lumin_intens; r.angle = -angle; return r; } base_unit_vector& base_unit_vector::operator += (const base_unit_vector &x) { length += x.length; time += x.time; mass += x.mass; charge += x.charge; temperature += x.temperature; lumin_intens += x.lumin_intens; angle += x.angle; return *this; } base_unit_vector& base_unit_vector::operator -= (const base_unit_vector &x) { length -= x.length; time -= x.time; mass -= x.mass; charge -= x.charge; temperature -= x.temperature; lumin_intens -= x.lumin_intens; angle -= x.angle; return *this; } base_unit_vector& base_unit_vector::operator *= (int x) { length *= x; time *= x; mass *= x; charge *= x; temperature *= x; lumin_intens *= x; angle *= x; return *this; } bool base_unit_vector::operator == (const base_unit_vector &x) const { return length == x.length && time == x.time && mass == x.mass && charge == x.charge && temperature == x.temperature && lumin_intens == x.lumin_intens && angle == x.angle; } ostream & base_unit_vector::show(ostream &os) const { return os << "[" << length << ", " << time << ", " << mass << ", " << charge << ", " << temperature << ", " << lumin_intens << ", " << angle << "]"; }