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.12.35;	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.04.51;	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_fn_nz,v $
// Revision 1.3  1994/01/07  15:12:35  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:04:51  thoth
// Initial revision
//
// Revision 1.2  93/05/27  11:49:03  thoth
// Copyright Notices
// 
// Revision 1.1  93/03/10  13:49:13  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 = SUBOP( rval, (*(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 = SUBOP(rval, 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 = SUBOP(rval, 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
//
a75 3
    IA_BaseImage<IA_Point<int>, LTYPE>	*bip =
	IA_FBI<IA_Point<int>,IA_Point<int>,LTYPE,LTYPE,LTYPE>
	    ::extract_baseptr(arg);
d77 1
a77 1
	return vec_reduce_OPNAME((IA_VectorI<IA_Point<int>, LTYPE> *)bip);
d79 2
a80 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
//
d57 1
a57 1
static ATYPE iter_reduce_OPNAME(const IA_Image<IA_Point<int>, LTYPE> &arg)
d73 1
a73 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
d28 1
a28 1
static ATYPE vec_reduce_OPNAME(const IA_VectorI<IA_IntPoint, LTYPE> *arg)
d54 1
a54 1
static ATYPE iter_reduce_OPNAME(const IA_CoreImage<IA_IntPoint, LTYPE> &arg)
d56 1
a56 1
    IA_IVIter<IA_IntPoint, LTYPE>	iter(arg);
d70 1
a70 1
ATYPE OP ( const IA_CoreImage<IA_IntPoint, LTYPE> &arg_)
d74 1
a74 1
    IA_Image<IA_IntPoint, LTYPE>	arg(arg_);
d76 3
a78 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()) {
d80 1
a80 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
d50 1
a50 1
static ATYPE iter_reduce_OPNAME(const IA_Image<IA_IntPoint, LTYPE> &arg)
d66 1
a66 1
ATYPE OP ( const IA_Image<IA_IntPoint, LTYPE> &arg_)
d70 1
a70 1
    /*PROMOTE*/IA_Image<IA_IntPoint, LTYPE>	arg(arg_);
@


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