head     1.3;
branch   ;
access   ;
symbols  ;
locks    ; strict;
comment  @// @;


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

1.2
date     93.01.19.14.55.14;  author jnw;  state Exp;
branches ;
next     1.1;

1.1
date     92.10.05.11.49.21;  author jnw;  state Exp;
branches ;
next     ;


desc
@Initial revision
@


1.3
log
@A futile attempt to get the compiler to not dump core.
@
text
@// Emacs: -*- C++ -*-

static char ArithDIrcsid[] = "$Id: ArithDI.m4c,v 1.2 93/01/19 14:55:14 jnw Exp Locker: thoth $";

// $Log:	ArithDI.m4c,v $
// Revision 1.2  93/01/19  14:55:14  jnw
// Modified to support IA_ naming convention
// 
// Revision 1.1  92/10/05  11:49:21  jnw
// Initial revision
// 

#include <stream.h>
#include "ia.h"
#include "DiscreteImage.h"
#include "ArithDI.h"
#include "IPSIter.h"


//Usage LAZY_..._CLASS(op symbol, op name)
// Code that follows generated by m4

#if 0
LAZY_COMMUTATIVE_CLASS(+,Add)
LAZY_NONCOMMUTATIVE_CLASS(-,Sub)
LAZY_COMMUTATIVE_CLASS(*,Mult)
LAZY_NONCOMMUTATIVE_CLASS(/,Div)
LAZY_UNARY_CLASS(-,UnaryMinus)
#endif

// End of code generated by m4

template <class T>
IA_DiscreteImage<T> IA_ArithDI<T>::operator ++()
{
    if (!this->extensivep()) {
	
	// Need to construct a Lazy result.
	
	IA_BaseDI<T> *result;
	
	result = (IA_BaseDI<T> *)
	    new IA_LazyAddDI<T>(*this, IA_DiscreteImage<T>(1,this->domain()));
	this->disassociate_image();
	*this = IA_ArithDI<T>(result);
    } else {
	for (int i=0; i < this->domain().card(); i++) {
	    this->bdip->ref(i)++;
	}
    }
    return *this;
}

template <class T>
IA_DiscreteImage<T> IA_ArithDI<T>::operator --()
{
    if (!this->extensivep()) {
	
	// Need to construct a Lazy result.
	
	IA_BaseDI<T> *result;
	
	result = (IA_BaseDI<T> *)
	    new IA_LazySubDI<T>(*this, IA_DiscreteImage<T>(1,this->domain()));
	this->disassociate_image();
	*this = IA_ArithDI<T>(result);
    } else {
	for (int i=0; i < this->domain().card(); i++) {
	    this->bdip->ref(i)--;
	}
    }
    return *this;
}

// Usage: ops(op symbol, op name, class argument name,
//			left scalar argument type, right scalar argument type)
//
// Following code gerated by m4

OPS(+,Add,IA_ArithDI,T&)
OPS(-,Sub,IA_ArithDI,T&)
OPS(*,Mult,IA_ArithDI,T&)
OPS(/,Div,IA_ArithDI,T&)
UNARY_OP(-,UnaryMinus, IA_ArithDI)
@


1.2
log
@Modified to support IA_ naming convention
@
text
@d3 1
a3 1
static char ArithDIrcsid[] = "$Id: ArithDI.m4c,v 1.1 92/10/05 11:49:21 jnw Exp Locker: jnw $";
d6 3
d23 1
d29 1
d34 1
a34 1
IA_ArithDI<T>& IA_ArithDI<T>::operator ++()
d55 1
a55 1
IA_ArithDI<T>& IA_ArithDI<T>::operator --()
d63 1
a63 1
	result = IA_(BaseDI<T> *)
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
static char ArithDIrcsid[] = "$Id$";
d5 4
a8 1
// $Log$
d29 1
a29 1
ArithDI<T>& ArithDI<T>::operator ++()
d35 1
a35 1
	BaseDI<T> *result;
d37 2
a38 2
	result = (BaseDI<T> *)
	    new LazyAddDI<T>(*this, DiscreteImage<T>(1,this->domain()));
d40 1
a40 1
	*this = ArithDI<T>(result);
d50 1
a50 1
ArithDI<T>& ArithDI<T>::operator --()
d56 1
a56 1
	BaseDI<T> *result;
d58 2
a59 2
	result = (BaseDI<T> *)
	    new LazySubDI<T>(*this, DiscreteImage<T>(1,this->domain()));
d61 1
a61 1
	*this = ArithDI<T>(result);
d75 5
a79 5
OPS(+,Add,ArithDI,T&)
OPS(-,Sub,ArithDI,T&)
OPS(*,Mult,ArithDI,T&)
OPS(/,Div,ArithDI,T&)
UNARY_OP(-,UnaryMinus, ArithDI)
@
