head	1.4;
access;
symbols
	bobbase:1.4
	bob:1.4.1
	r2_1:1.4
	r2_0:1.4
	r1_1_beta:1.4
	r1_1_alpha:1.3
	r1_0:1.3
	r0_11:1.3
	r0_10:1.3
	r0_9:1.1;
locks
	thoth:1.4.1.2; strict;
comment	@// @;


1.4
date	94.07.25.17.26.39;	author thoth;	state Exp;
branches
	1.4.1.1;
next	1.3;

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

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

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

1.4.1.1
date	94.12.28.18.19.22;	author thoth;	state Exp;
branches;
next	1.4.1.2;

1.4.1.2
date	95.01.13.19.37.42;	author thoth;	state Exp;
branches;
next	;


desc
@meta-code for an image reduction.
@


1.4
log
@Name sanitization
@
text
@// Emacs: -*- C++ -*-

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


//
// $Log: reduce_op_nz,v $
// Revision 1.3  1994/01/07  15:15:43  thoth
// Image class is now CoreImage and named image types are
// Image<P,T>.
//
// Revision 1.2  1993/12/29  17:33:18  thoth
// New operator scheme that prevents the need for trivial Image conversions.
//
// Revision 1.1  1993/09/15  13:05:07  thoth
// Initial revision
//
// Revision 1.3  93/05/27  11:49:00  thoth
// Copyright Notices
// 
// Revision 1.2  93/04/08  13:23:45  thoth
// const_reduce can be overridden in the including file.
// 
// Revision 1.1  93/03/10  13:49:34  thoth
// Initial revision
// 

static ATYPE vec_reduce_OPNAME(const IA_VectorI<IA_Point<int>, LTYPE> *arg)
{
    const LTYPE *ls = arg->vec;

    ATYPE	rval=*(ls++);

    const unsigned sz = arg->domain().card();
    for (unsigned i=1; i<sz; i++) {
	rval = ( (rval) SUBOP  (*(ls++)));
    }

    return rval;
}

#ifndef const_reduce_ATYPE_LTYPE_OPNAME
#define const_reduce_ATYPE_LTYPE_OPNAME
static ATYPE const_reduce_OPNAME(unsigned sz, LTYPE arg)
{
    ATYPE	rval=arg;
    for (unsigned i=1; i<sz; i++) {
	rval = ( (rval) SUBOP arg);
    }
    return rval;
}
#endif

static ATYPE iter_reduce_OPNAME(const IA_CoreImage<IA_Point<int>, LTYPE> &arg)
{
    IA_IVIter<IA_Point<int>, LTYPE>	iter(arg);

    LTYPE	temp;
    iter(temp);

    ATYPE	rval=temp;

    while(iter(temp)) {
	rval = ( (rval) SUBOP  temp);
    }

    return rval;
}

ATYPE OP ( const IA_CoreImage<IA_Point<int>, LTYPE> &arg_)
{
    if (arg_.domain().card()==0)
	return ( ZERO );
    IA_Image<IA_Point<int>, LTYPE>	arg(arg_);

    if (arg.type() == IA_VectorI<IA_Point<int>, LTYPE>::s_type()) {
	return vec_reduce_OPNAME((IA_VectorI<IA_Point<int>, LTYPE> *)arg.bip);
    } else if (arg.type() == IA_ConstI<IA_Point<int>, LTYPE>::s_type()) {
	return const_reduce_OPNAME(arg.domain().card(),
				   ((IA_ConstI<IA_Point<int>, LTYPE> *)arg.bip)->value);
    } else {
	return iter_reduce_OPNAME(arg);
    }
}
@


1.4.1.1
log
@Image operations are now friendly with FBI
@
text
@a10 3
// Revision 1.4  1994/07/25  17:26:39  thoth
// Name sanitization
//
a78 3
    IA_BaseImage<IA_Point<int>, LTYPE>	*bip =
	IA_FBI<IA_Point<int>,IA_Point<int>,LTYPE,LTYPE,LTYPE>
	    ::extract_baseptr(arg);
d80 1
a80 1
	return vec_reduce_OPNAME((IA_VectorI<IA_Point<int>, LTYPE> *)bip);
d82 2
a83 3
	return const_reduce_OPNAME
	    (arg.domain().card(),
	     ((IA_ConstI<IA_Point<int>, LTYPE> *)bip)->value);
@


1.4.1.2
log
@CoreImage has been re-merged with Image.  All special stuff should be
friends of FBI now.
@
text
@a10 3
// Revision 1.4.1.1  1994/12/28  18:19:22  thoth
// Image operations are now friendly with FBI
//
d60 1
a60 1
static ATYPE iter_reduce_OPNAME(const IA_Image<IA_Point<int>, LTYPE> &arg)
d76 1
a76 1
ATYPE OP ( const IA_Image<IA_Point<int>, LTYPE> &arg_)
@


1.3
log
@Image class is now CoreImage and named image types are
Image<P,T>.
@
text
@d11 4
d31 1
a31 1
static ATYPE vec_reduce_OPNAME(const IA_VectorI<IA_IntPoint, LTYPE> *arg)
d57 1
a57 1
static ATYPE iter_reduce_OPNAME(const IA_CoreImage<IA_IntPoint, LTYPE> &arg)
d59 1
a59 1
    IA_IVIter<IA_IntPoint, LTYPE>	iter(arg);
d73 1
a73 1
ATYPE OP ( const IA_CoreImage<IA_IntPoint, LTYPE> &arg_)
d77 1
a77 1
    IA_Image<IA_IntPoint, LTYPE>	arg(arg_);
d79 3
a81 3
    if (arg.type() == IA_VectorI<IA_IntPoint, LTYPE>::s_type()) {
	return vec_reduce_OPNAME((IA_VectorI<IA_IntPoint, LTYPE> *)arg.bip);
    } else if (arg.type() == IA_ConstI<IA_IntPoint, LTYPE>::s_type()) {
d83 1
a83 1
				   ((IA_ConstI<IA_IntPoint, LTYPE> *)arg.bip)->value);
@


1.2
log
@New operator scheme that prevents the need for trivial Image conversions.
@
text
@d11 3
d53 1
a53 1
static ATYPE iter_reduce_OPNAME(const IA_Image<IA_IntPoint, LTYPE> &arg)
d69 1
a69 1
ATYPE OP ( const IA_Image<IA_IntPoint, LTYPE> &arg_)
d73 1
a73 1
    /*PROMOTE*/IA_Image<IA_IntPoint, LTYPE>	arg(arg_);
@


1.1
log
@Initial revision
@
text
@d10 4
a13 1
// $Log:	reduce_op_nz,v $
d66 1
a66 1
ATYPE OP ( const IA_Image<IA_IntPoint, LTYPE> &arg)
d68 3
a70 2
    if (arg.domain().card()==0)
	abort(); // XXX unfinished code
@
