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


1.6
date     93.02.17.10.57.48;  author thoth;  state Exp;
branches ;
next     1.5;

1.5
date     93.02.08.11.31.26;  author thoth;  state Exp;
branches ;
next     1.4;

1.4
date     93.01.19.14.55.29;  author jnw;  state Exp;
branches ;
next     1.3;

1.3
date     92.12.10.09.56.37;  author jnw;  state Exp;
branches ;
next     1.2;

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

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


desc
@Initial revision
@


1.6
log
@The assignment operator is difficult to define when you use multiple
inheritance.
Fixed the return types of many operations, but almost all need to be
friends.
@
text
@// Emacs: -*- C++ -*-

// $Log:	ArithDI.m4h,v $
// Revision 1.5  93/02/08  11:31:26  thoth
// fixed typos
// 
// Revision 1.4  93/01/19  14:55:29  jnw
// Modified to support IA_ naming convention
// 
// Revision 1.3  92/12/10  09:56:37  jnw
// Made operator = punt to DiscreteImage<T>
// 
// Revision 1.2  92/11/13  13:53:11  jnw
// Extensively modified
// 
// Revision 1.1  92/10/05  11:49:30  jnw
// Initial revision
// 

#ifndef ArithDI_h_
#define ArithDI_h_

#include "IntPointSet.h"
#include "LazyDI.h"
#include "VectorDI.h"
#include "DiscreteImage.h"


// Following code generated by m4
LAZY_BINARY(Add)
LAZY_BINARY(Sub)
LAZY_BINARY(Mult)
LAZY_BINARY(Div)
LAZY_UNARY(UnaryMinus)
// End of code generated by m4

template <class T>
class IA_ArithDI: public virtual IA_DiscreteImage<T> {

protected:
public:
    IA_ArithDI():IA_DiscreteImage<T>() { }

// ?? Check to see if this is needed
    IA_ArithDI(IA_BaseDI<T>* base)
    : IA_DiscreteImage<T>(base) { }

    IA_ArithDI(const IA_DiscreteImage<T>& di)
    : IA_DiscreteImage<T>(di) { }

// ?? Do we even need this now?
    IA_ArithDI(const IA_ArithDI& adi)
    : IA_DiscreteImage<T>( (IA_DiscreteImage<T>)adi) { }
    
    IA_DiscreteImage<T>&   operator +=  (const IA_DiscreteImage<T>&);
    IA_DiscreteImage<T>&   operator -=  (const IA_DiscreteImage<T>&);
    IA_DiscreteImage<T>&   operator *=  (const IA_DiscreteImage<T>&);
    IA_DiscreteImage<T>&   operator /=  (const IA_DiscreteImage<T>&);

    IA_DiscreteImage<T>&   operator +=  (const T&);
    IA_DiscreteImage<T>&   operator -=  (const T&);
    IA_DiscreteImage<T>&   operator *=  (const T&);
    IA_DiscreteImage<T>&   operator /=  (const T&);
    
    IA_DiscreteImage<T> operator + (const IA_DiscreteImage<T>&);
    IA_DiscreteImage<T> operator - (const IA_DiscreteImage<T>&);
    IA_DiscreteImage<T> operator * (const IA_DiscreteImage<T>&);
    IA_DiscreteImage<T> operator / (const IA_DiscreteImage<T>&);
#if 0

    friend IA_DiscreteImage<T> operator + (const T&, const IA_DiscreteImage<T>&);
    friend IA_DiscreteImage<T> operator - (const T&, const IA_DiscreteImage<T>&);
    friend IA_DiscreteImage<T> operator * (const T&, const IA_DiscreteImage<T>&);
    friend IA_DiscreteImage<T> operator / (const T&, const IA_DiscreteImage<T>&);

    friend IA_DiscreteImage<T> operator + (const IA_DiscreteImage<T>&, const T&);
    friend IA_DiscreteImage<T> operator - (const IA_DiscreteImage<T>&, const T&);
    friend IA_DiscreteImage<T> operator * (const IA_DiscreteImage<T>&, const T&);
    friend IA_DiscreteImage<T> operator / (const IA_DiscreteImage<T>&, const T&);
#endif

    IA_DiscreteImage<T>   operator ++  ();
    IA_DiscreteImage<T>   operator --  ();

    IA_DiscreteImage<T>    operator -   () const;
};

#endif
@


1.5
log
@fixed typos
@
text
@d4 3
a54 5
    IA_ArithDI& operator =(const IA_DiscreteImage<T>& a) {
	(IA_DiscreteImage<T>)(*this) = a;
	return *this;
    }

d69 1
d71 4
a74 4
//    friend IA_DiscreteImage<T> operator + (const T&, const IA_DiscreteImage<T>&);
//    friend IA_DiscreteImage<T> operator - (const T&, const IA_DiscreteImage<T>&);
//    friend IA_DiscreteImage<T> operator * (const T&, const IA_DiscreteImage<T>&);
//    friend IA_DiscreteImage<T> operator / (const T&, const IA_DiscreteImage<T>&);
d76 5
a80 4
//    friend IA_DiscreteImage<T> operator + (const IA_DiscreteImage<T>&, const T&);
//    friend IA_DiscreteImage<T> operator - (const IA_DiscreteImage<T>&, const T&);
//    friend IA_DiscreteImage<T> operator * (const IA_DiscreteImage<T>&, const T&);
//    friend IA_DiscreteImage<T> operator / (const IA_DiscreteImage<T>&, const T&);
d82 2
a83 2
    IA_DiscreteImage<T>&   operator ++  ();
    IA_DiscreteImage<T>&   operator --  ();
@


1.4
log
@Modified to support IA_ naming convention
@
text
@d4 3
d70 1
a70 1
   IA_ DiscreteImage<T> operator / (const IA_DiscreteImage<T>&);
@


1.3
log
@Made operator = punt to DiscreteImage<T>
@
text
@d4 3
d32 1
a32 1
class ArithDI: public /* virtual */ DiscreteImage<T> {
d36 1
a36 1
    ArithDI():DiscreteImage<T>() { }
d39 2
a40 2
    ArithDI(BaseDI<T>* base)
    : DiscreteImage<T>(base) { }
d42 2
a43 2
    ArithDI(const DiscreteImage<T>& di)
    : DiscreteImage<T>(di) { }
d46 2
a47 2
    ArithDI(const ArithDI& adi)
    : DiscreteImage<T>( (DiscreteImage<T>)adi) { }
d49 2
a50 2
    ArithDI& operator =(const DiscreteImage<T>& a) {
	(DiscreteImage<T>)(*this) = a;
d54 4
a57 4
    DiscreteImage<T>&   operator +=  (const DiscreteImage<T>&);
    DiscreteImage<T>&   operator -=  (const DiscreteImage<T>&);
    DiscreteImage<T>&   operator *=  (const DiscreteImage<T>&);
    DiscreteImage<T>&   operator /=  (const DiscreteImage<T>&);
d59 4
a62 4
    DiscreteImage<T>&   operator +=  (const T&);
    DiscreteImage<T>&   operator -=  (const T&);
    DiscreteImage<T>&   operator *=  (const T&);
    DiscreteImage<T>&   operator /=  (const T&);
d64 4
a67 4
    DiscreteImage<T> operator + (const DiscreteImage<T>&);
    DiscreteImage<T> operator - (const DiscreteImage<T>&);
    DiscreteImage<T> operator * (const DiscreteImage<T>&);
    DiscreteImage<T> operator / (const DiscreteImage<T>&);
d69 4
a72 4
//    friend DiscreteImage<T> operator + (const T&, const DiscreteImage<T>&);
//    friend DiscreteImage<T> operator - (const T&, const DiscreteImage<T>&);
//    friend DiscreteImage<T> operator * (const T&, const DiscreteImage<T>&);
//    friend DiscreteImage<T> operator / (const T&, const DiscreteImage<T>&);
d74 4
a77 4
//    friend DiscreteImage<T> operator + (const DiscreteImage<T>&, const T&);
//    friend DiscreteImage<T> operator - (const DiscreteImage<T>&, const T&);
//    friend DiscreteImage<T> operator * (const DiscreteImage<T>&, const T&);
//    friend DiscreteImage<T> operator / (const DiscreteImage<T>&, const T&);
d79 2
a80 2
    DiscreteImage<T>&   operator ++  ();
    DiscreteImage<T>&   operator --  ();
d82 1
a82 1
    DiscreteImage<T>    operator -   () const;
@


1.2
log
@Extensively modified
@
text
@d4 3
d47 1
a47 1
	this->bdip = a.bdip;
d81 2
@


1.1
log
@Initial revision
@
text
@d3 4
a6 1
// $Log$
d30 1
a30 1
    ArithDI(BaseDI<T>* base): DiscreteImage<T>(base) {}
d32 12
a43 1
    ArithDI& operator =(const ArithDI& a) {
d48 4
a51 1
    ArithDI():DiscreteImage<T>() {}
d53 4
a56 4
    ArithDI(const T& t, const IntPointSet& ps)
    : DiscreteImage<T>(t, ps) {}

    ArithDI(const DiscreteImage<T>& di): DiscreteImage<T>(di) {}
d58 4
a61 4
    ArithDI&   operator +=  (const ArithDI&);
    ArithDI&   operator -=  (const ArithDI&);
    ArithDI&   operator *=  (const ArithDI&);
    ArithDI&   operator /=  (const ArithDI&);
d63 4
a66 9
    ArithDI&   operator +=  (const T&);
    ArithDI&   operator -=  (const T&);
    ArithDI&   operator *=  (const T&);
    ArithDI&   operator /=  (const T&);
    
    friend ArithDI<T> operator + (const ArithDI<T>&, const ArithDI<T>&);
    friend ArithDI<T> operator - (const ArithDI<T>&, const ArithDI<T>&);
    friend ArithDI<T> operator * (const ArithDI<T>&, const ArithDI<T>&);
    friend ArithDI<T> operator / (const ArithDI<T>&, const ArithDI<T>&);
d68 4
a71 4
    friend ArithDI<T> operator + (const T&, const ArithDI<T>&);
    friend ArithDI<T> operator - (const T&, const ArithDI<T>&);
    friend ArithDI<T> operator * (const T&, const ArithDI<T>&);
    friend ArithDI<T> operator / (const T&, const ArithDI<T>&);
d73 2
a74 4
    friend ArithDI<T> operator + (const ArithDI<T>&, const T&);
    friend ArithDI<T> operator - (const ArithDI<T>&, const T&);
    friend ArithDI<T> operator * (const ArithDI<T>&, const T&);
    friend ArithDI<T> operator / (const ArithDI<T>&, const T&);
d76 1
a76 4
    ArithDI&   operator ++  ();
    ArithDI&   operator --  ();

    ArithDI   operator -   () const;
a77 40

template <class T>
ArithDI<T> operator + (const ArithDI<T>&, const ArithDI<T>&);

template <class T>
ArithDI<T> operator - (const ArithDI<T>&, const ArithDI<T>&);

template <class T>
ArithDI<T> operator * (const ArithDI<T>&, const ArithDI<T>&);

template <class T>
ArithDI<T> operator / (const ArithDI<T>&, const ArithDI<T>&);


template <class T>
ArithDI<T> operator + (const T&, const ArithDI<T>&);

template <class T>
ArithDI<T> operator - (const T&, const ArithDI<T>&);

template <class T>
ArithDI<T> operator * (const T&, const ArithDI<T>&);

template <class T>
ArithDI<T> operator / (const T&, const ArithDI<T>&);


template <class T>
ArithDI<T> operator + (const ArithDI<T>&, const T&);

template <class T>
ArithDI<T> operator - (const ArithDI<T>&, const T&);

template <class T>
ArithDI<T> operator * (const ArithDI<T>&, const T&);

template <class T>
ArithDI<T> operator / (const ArithDI<T>&, const T&);

#endif
@
