head	1.5;
access;
symbols
	r0_10:1.5
	Eglin_alpha_1:1.5;
locks; strict;
comment	@// @;


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

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

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

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

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


desc
@Initial revision
@


1.5
log
@Copyright Notices
@
text
@// Emacs: -*- C++ -*-

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


static char FunctionRefDIrcsid[] = "$Id: FunctionRefDI.c,v 1.4 93/02/23 14:18:58 thoth Exp Locker: thoth $";

// $Log:	FunctionRefDI.c,v $
// Revision 1.4  93/02/23  14:18:58  thoth
// equal does not belong in here.
// 
// Revision 1.3  93/02/08  13:02:16  thoth
// static dummy member belongs in the .c file.
// equal method no longer loops infinitely.
// 
// Revision 1.2  93/01/19  14:56:20  jnw
// Modified to support IA_ naming convention
// 
// Revision 1.1  92/10/05  11:44:46  jnw
// Initial revision
// 

#include "FunctionRefDI.h"
#include "VectorDI.h"
#include "IPSIter.h"

template <class T>
char IA_FunctionRefDI<T>::dummy = 0;

template <class T>
T IA_FunctionRefDI<T>::operator ()(const IA_IntPoint& p) const {
    //if (!this->ps.contains(p))
    //ia_throw( IA::IMAGE_DOMAIN_ERROR, __FILE__, __LINE__);
    return (*(this->func))(p);
}

#if 0
template <class T>
IA_BaseDI<T>* IA_FunctionRefDI<T>::clone_self_extensively() const
{
    if (this->ps.extensivep()) {
	T *vec;
	
	vec = new T[this->ps.card()];

	IA_IPSIter iter(this->ps);
	IA_IntPoint p;
	int i=0;
	while(iter(p)) {
	    vec[i++] = (*this->func)(p);
	}
	return new IA_VectorDI<T>(vec, this->ps, this->ps.card(),1);
	
    } else {
	ia_throw( IA::PSET_REQUIRE_EXTENSIVE
		  , __FILE__, __LINE__);
    }
    
}
#endif

template <class T>
ostream& IA_FunctionRefDI<T>::print_this(ostream& o) const
{
    o << "FunctionIntDI -";
    if (this->ps.extensivep()){
	IA_IPSIter iter(this->ps);
	IA_IntPoint p;
	
	o << "(point,value) pairs follow:\n";
	while(iter(p)) {
	    o << "(" << p << "," << (*this->func)(p) << ") ";
	}
    } else {
	o << ", Function : " << (int)(this->func) <<
	    ", PointSet : Comprehensive";
    }
    return o << "\n";
}
@


1.4
log
@equal does not belong in here.
@
text
@d3 4
a6 1
static char FunctionRefDIrcsid[] = "$Id: FunctionRefDI.c,v 1.3 93/02/08 13:02:16 thoth Exp Locker: thoth $";
d8 3
d12 3
@


1.3
log
@static dummy member belongs in the .c file.
equal method no longer loops infinitely.
@
text
@d3 1
a3 1
static char FunctionRefDIrcsid[] = "$Id: FunctionRefDI.c,v 1.2 93/01/19 14:56:20 jnw Exp Locker: thoth $";
d6 4
d26 2
a27 2
    if (!this->ps.contains(p))
	ia_throw( IA::IMAGE_DOMAIN_ERROR, __FILE__, __LINE__);
d31 1
a32 30
int IA_FunctionRefDI<T>::equal(const IA_BaseDI<T>* other) const
{
    IA_FunctionRefDI<T>* ot = (IA_FunctionRefDI<T> *)other;

    if  ( this->domain() == other->domain()
	  && this->type()==other->type() ){
	// PointSet and type match.  Check value function
	if (this->func == ot->func) {
	    // exact value function match
	    return 1;
	} else if (this->ps.extensivep() && ot->ps.extensivep()) {
	    // evaluate value function at each point to check for match

	    IA_IPSIter iter(this->ps);
	    IA_IntPoint p;
	    
	    while(iter(p)) {
		if ((*(this->func))(p) != (*(ot->func))(p))
		    // one value didn't match!
		    return 0;
	    }
	    return 1;
	} else 
	    return 0;
    } else
	return 0;
}


template <class T>
d54 1
d69 1
a69 1
	o << ", Valueset : " << (int)(this->func) <<
@


1.2
log
@Modified to support IA_ naming convention
@
text
@d3 1
a3 1
static char FunctionRefDIrcsid[] = "$Id: FunctionRefDI.c,v 1.1 92/10/05 11:44:46 jnw Exp Locker: jnw $";
d6 3
d18 3
d32 1
a32 1
    if  ( ((IA_BaseDI<T> *)this)->equal(other)
a61 2
	IA_IPSIter iter(this->ps);
	IA_IntPoint p;
d65 2
d71 1
a71 2
	return (IA_BaseDI<T> *) new
	    IA_VectorDI<T>(vec, this->ps, this->ps.card(),0);
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
static char FunctionRefDIrcsid[] = "$Id$";
d5 4
a8 1
// $Log$
d15 1
a15 1
T FunctionRefDI<T>::operator ()(const IntPoint& p) const {
d22 1
a22 1
int FunctionRefDI<T>::equal(const BaseDI<T>* other) const
d24 1
a24 1
    FunctionRefDI<T>* ot = (FunctionRefDI<T> *)other;
d26 1
a26 1
    if  ( ((BaseDI<T> *)this)->equal(other)
d35 2
a36 2
	    IPSIter iter(this->ps);
	    IntPoint p;
d52 1
a52 1
BaseDI<T>* FunctionRefDI<T>::clone_self_extensively() const
d56 2
a57 2
	IPSIter iter(this->ps);
	IntPoint p;
d65 2
a66 2
	return (BaseDI<T> *) new
	    VectorDI<T>(vec, this->ps, this->ps.card(),0);
d76 1
a76 1
ostream& FunctionRefDI<T>::print_this(ostream& o) const
d80 2
a81 2
	IPSIter iter(this->ps);
	IntPoint p;
@
