head	1.9;
access;
symbols
	bobbase:1.5
	bob:1.5.1
	r2_1:1.5
	r2_0:1.4
	r1_1_beta:1.4
	r1_1_alpha:1.4
	r1_0:1.4
	r0_11:1.4
	r0_10:1.3
	r0_9:1.2;
locks; strict;
comment	@// @;


1.9
date	95.02.02.21.01.46;	author fjsoria;	state Exp;
branches;
next	1.8;

1.8
date	95.01.21.20.21.21;	author fjsoria;	state Exp;
branches;
next	1.7;

1.7
date	95.01.11.15.43.25;	author fjsoria;	state Exp;
branches;
next	1.6;

1.6
date	94.12.22.21.36.12;	author fjsoria;	state Exp;
branches;
next	1.5;

1.5
date	94.09.16.14.57.11;	author thoth;	state Exp;
branches
	1.5.1.1;
next	1.4;

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

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

1.2
date	93.11.17.18.18.51;	author thoth;	state Exp;
branches;
next	1.1;

1.1
date	93.09.15.12.52.49;	author thoth;	state Exp;
branches;
next	;

1.5.1.1
date	94.12.28.16.56.06;	author thoth;	state Exp;
branches;
next	;


desc
@User-supplied function image implementation.
@


1.9
log
@*** empty log message ***
@
text
@// Emacs: -*- C++ -*-

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


//
// $Log: FuncI.c,v $
// Revision 1.8  1995/01/21  20:21:21  fjsoria
// fixing opperator<< with dummy_op
//
// Revision 1.7  1995/01/11  15:43:25  fjsoria
// patched problem with operator<< with dummy_op()
//
// Revision 1.6  1994/12/22  21:36:12  fjsoria
// static data member template fix
//
// Revision 1.5  1994/09/16  14:57:11  thoth
// more DOS-inspired renaming.
//
// Revision 1.4  1994/02/26  16:02:08  thoth
// operator() of the container now relies upon the contained classes
// to check if p is contained in the domain.  This means that users
// could possibly write an erroneous operator().
//
// Revision 1.3  1993/12/29  16:54:24  thoth
// Added FunctionI that accepts functions with simple T type instead of
// const T&
//
// Revision 1.2  1993/11/17  18:18:51  thoth
// IPSIter is now PSIter<IntPoint>.
// extensivep is now extensive.
//
// Revision 1.1  1993/09/15  12:52:49  thoth
// Initial revision
//

#include "FuncI.h"
#include "PSIter.h"

#ifndef IA_NO_AUTOINST_OF_STATIC_DATA 
template < class P,class T>
char IA_FunctionRefI<P,T>::dummy = 0;

#endif


template < class P,class T>
T IA_FunctionRefI<P,T>::operator ()(const P& p) const {
    if (!domain().contains(p)) {
	ia_throw(IA::IMAGE_POINT_OUTSIDE_DOMAIN, __FILE__,__LINE__);
    }
    return (*(this->func))(p);
}

template < class P,class T>
ostream& IA_FunctionRefI<P,T>::print_this(ostream& o) const
{
#ifndef IA_UNRESOLVED_OPERATOR
    o << "FunctionRefI -";
    if (this->ps.extensive()){
      IA_PSIter<P> iter(this->ps);
      P p;
      
      o << "(point,value) pairs follow:\n";
      while(iter(p)) {
	o << "(" << p << "," << (*this->func)(p) << ") ";
      }
    } else {
      o << " Function : " << (int)(this->func) <<
	", PointSet : Comprehensive";
    }
#else
    o <<"function ostream& IA_FunctionRefI<P,T>::print_this(ostream& o) const\n";
    o << "not implemented for g++";
#endif
    return o << "\n";

}

//
//
//
#ifndef IA_NO_AUTOINST_OF_STATIC_DATA
template < class P,class T>
char IA_FunctionI<P,T>::dummy = 0;
#endif
    
template < class P,class T>
T IA_FunctionI<P,T>::operator ()(const P& p) const {
    if (!domain().contains(p)) {
	ia_throw(IA::IMAGE_POINT_OUTSIDE_DOMAIN, __FILE__,__LINE__);
    }
    return (*(this->func))(p);
}

template < class P,class T>
ostream& IA_FunctionI<P,T>::print_this(ostream& o) const
{
#ifndef IA_UNRESOLVED_OPERATOR
  o << "FunctionI -";
  if (this->ps.extensive()){
    IA_PSIter<P> iter(this->ps);
    P p;
    o << "(point,value) pairs follow:\n";
    while(iter(p)) {
      o << "(" << p << "," << (*this->func)(p) << ") ";
    }
  } else {
    o << " Function : " << (int)(this->func) <<
      ", PointSet : Comprehensive";
  }
#else
  o << "function ostream& IA_FunctionI<P,T>::print_this(ostream& o) const\n"; 
  o << "is not implemented for g++";
#endif
return o << "\n";
}
@


1.8
log
@fixing opperator<< with dummy_op
@
text
@d11 3
d46 1
d61 1
d64 11
a74 9
	IA_PSIter<P> iter(this->ps);
	P p;
	
	o << "(point,value) pairs follow:\n";
#ifdef IA_UNRESOLVED_OPERATOR
	while(iter(p)) {
	 dummy_op(dummy_op(o << "(", p) << ",",
		  (*this->func)(p)) << ") ";
	}
d76 2
a77 3
	while(iter(p)) {
	  o << "(" << p << "," << (*this->func)(p) << ") ";
	}
a78 4
    } else {
	o << " Function : " << (int)(this->func) <<
	    ", PointSet : Comprehensive";
    }
d80 1
d102 13
a114 9
    o << "FunctionI -";
    if (this->ps.extensive()){
	IA_PSIter<P> iter(this->ps);
	P p;
	
	o << "(point,value) pairs follow:\n";
	while(iter(p)) {
#ifdef IA_UNRESOLVED_OPERATOR
	  dummy_op(dummy_op(o << "(", p) << "," , (*this->func)(p)) << ") ";
d116 2
a117 1
	  o << "(" << p << "," << (*this->func)(p) << ") ";
d119 1
a119 7

	}
    } else {
	o << " Function : " << (int)(this->func) <<
	    ", PointSet : Comprehensive";
    }
    return o << "\n";
@


1.7
log
@patched problem with operator<< with dummy_op()
@
text
@d11 3
a42 11
#endif




#ifdef IA_UNRESOLVED_OPERATOR
template <class T>
static ostream& dummy_op (ostream& o, T val)
{
  return o << val;
}
@


1.6
log
@static data member template fix
@
text
@d11 3
d42 12
d71 1
d73 2
a74 1
	    o << "(" << p << "," << (*this->func)(p) << ") ";
d76 5
d91 1
a91 1

d94 2
a95 1

d114 6
a119 1
	    o << "(" << p << "," << (*this->func)(p) << ") ";
@


1.5
log
@more DOS-inspired renaming.
@
text
@d11 3
d34 1
d37 1
@


1.5.1.1
log
@Conversion to classes for throw.
@
text
@a10 3
// Revision 1.5  1994/09/16  14:57:11  thoth
// more DOS-inspired renaming.
//
a29 1
#include "image_errors.h"
d37 1
a37 1
	ia_throw(Image_PointOutsideDomain_Exception(__FILE__,__LINE__));
d71 1
a71 1
	ia_throw(Image_PointOutsideDomain_Exception(__FILE__,__LINE__));
@


1.4
log
@operator() of the container now relies upon the contained classes
to check if p is contained in the domain.  This means that users
could possibly write an erroneous operator().
@
text
@d10 6
a15 1
// $Log: FunctionI.c,v $
d28 1
a28 1
#include "FunctionI.h"
@


1.3
log
@Added FunctionI that accepts functions with simple T type instead of
const T&
@
text
@d11 4
d31 3
a33 2
    //if (!this->ps.contains(p))
    //ia_throw( IA::IMAGE_DOMAIN_ERROR, __FILE__, __LINE__);
d65 3
a67 2
    //if (!this->ps.contains(p))
    //ia_throw( IA::IMAGE_DOMAIN_ERROR, __FILE__, __LINE__);
@


1.2
log
@IPSIter is now PSIter<IntPoint>.
extensivep is now extensive.
@
text
@d10 5
a14 1
// $Log: FuncRefI.c,v $
d19 1
a19 1
#include "FuncRefI.h"
d36 33
@


1.1
log
@Initial revision
@
text
@d10 4
a13 1
// $Log:	FunctionRefDI.c,v $
d16 1
a16 1
#include "IPSIter.h"
d32 1
a32 1
    if (this->ps.extensivep()){
@
