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.14;	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.07.16;	author thoth;	state Exp;
branches;
next	;

1.4.1.1
date	94.12.28.17.22.11;	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 a unary image operation.
@


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

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


//
// $Log: unary-op.templ,v $
// Revision 1.3  1994/01/07  15:15:14  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:07:16  thoth
// Initial revision
//
// Revision 1.2  93/05/27  11:49:04  thoth
// Copyright Notices
// 
// Revision 1.1  93/03/10  13:50:00  thoth
// Initial revision
// 

#ifndef vec_scalar_ATYPE_LTYPE_OPNAME
#define vec_scalar_ATYPE_LTYPE_OPNAME
static IA_Image<IA_Point<int>, ATYPE>
vec_uo_OPNAME(const IA_VectorI<IA_Point<int>, LTYPE> *lhs)
{
    const IA_Set<IA_Point<int> > domain = lhs->domain();
    const unsigned sz = domain.card();
    ATYPE *const vec = new ATYPE[sz];

    {
	ATYPE *ds = vec;
	const LTYPE *ls = lhs->vec;
	for (unsigned i=0; i<sz; i++) {
	    *(ds++) = SUBOP(*(ls++));
	}
    }
    return IA_Image<IA_Point<int>, ATYPE>(domain, vec, sz, 1);
}
#endif // vec_scalar_ATYPE_LTYPE_OPNAME

// scalar-scalar operation is trivial

#ifndef iter_scalar_ATYPE_LTYPE_OPNAME
#define iter_scalar_ATYPE_LTYPE_OPNAME
static IA_Image<IA_Point<int>, ATYPE>
iter_uo_OPNAME(IA_CoreImage<IA_Point<int>, LTYPE> lhs)
{
    const IA_Set<IA_Point<int> > domain = lhs.domain();
    const unsigned sz = domain.card();
    ATYPE *const vec = new ATYPE[sz];

    {
	ATYPE *ds = vec;
	LTYPE ltmp;
	IA_IVIter<IA_Point<int>, LTYPE>	liter(lhs);
	for (unsigned i=0; i<sz; i++) {
	    liter(ltmp);
	    *(ds++) = SUBOP(ltmp);
	}
    }
    return IA_Image<IA_Point<int>, ATYPE>(domain, vec, sz, 1);
}
#endif // iter_scalar_ATYPE_LTYPE_OPNAME

IA_Image<IA_Point<int>, ATYPE>
OP ( const IA_CoreImage<IA_Point<int>, LTYPE> &arg_)
{
    IA_Image<IA_Point<int>, LTYPE>	arg(arg_);
    if (arg.type() == IA_VectorI<IA_Point<int>, LTYPE>::s_type()) {
	return vec_uo_OPNAME((IA_VectorI<IA_Point<int>, LTYPE> *)arg.bip);
    } else if (arg.type() == IA_ConstI<IA_Point<int>, LTYPE>::s_type()) {
	return IA_Image<IA_Point<int>, ATYPE> (arg.domain(), SUBOP(((IA_ConstI<IA_Point<int>, LTYPE> *)arg.bip)->value));
    } else {
	return iter_uo_OPNAME(arg);
    }
}
@


1.4.1.1
log
@image operations are friends of FBI now.
@
text
@a10 3
// Revision 1.4  1994/07/25  17:26:39  thoth
// Name sanitization
//
a75 4

    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_uo_OPNAME((IA_VectorI<IA_Point<int>, LTYPE> *)bip);
d79 1
a79 1
	return IA_Image<IA_Point<int>, ATYPE> (arg.domain(), SUBOP(((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  17:22:11  thoth
// image operations are friends of FBI now.
//
d56 1
a56 1
iter_uo_OPNAME(IA_Image<IA_Point<int>, LTYPE> lhs)
d76 1
a76 1
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
d30 2
a31 2
static IA_Image<IA_IntPoint, ATYPE>
vec_uo_OPNAME(const IA_VectorI<IA_IntPoint, LTYPE> *lhs)
d33 1
a33 1
    const IA_IntPointSet domain = lhs->domain();
d44 1
a44 1
    return IA_Image<IA_IntPoint, ATYPE>(domain, vec, sz, 1);
d52 2
a53 2
static IA_Image<IA_IntPoint, ATYPE>
iter_uo_OPNAME(IA_CoreImage<IA_IntPoint, LTYPE> lhs)
d55 1
a55 1
    const IA_IntPointSet domain = lhs.domain();
d62 1
a62 1
	IA_IVIter<IA_IntPoint, LTYPE>	liter(lhs);
d68 1
a68 1
    return IA_Image<IA_IntPoint, ATYPE>(domain, vec, sz, 1);
d72 2
a73 2
IA_Image<IA_IntPoint, ATYPE>
OP ( const IA_CoreImage<IA_IntPoint, LTYPE> &arg_)
d75 5
a79 5
    IA_Image<IA_IntPoint, LTYPE>	arg(arg_);
    if (arg.type() == IA_VectorI<IA_IntPoint, LTYPE>::s_type()) {
	return vec_uo_OPNAME((IA_VectorI<IA_IntPoint, LTYPE> *)arg.bip);
    } else if (arg.type() == IA_ConstI<IA_IntPoint, LTYPE>::s_type()) {
	return IA_Image<IA_IntPoint, ATYPE> (arg.domain(), SUBOP(((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
d49 1
a49 1
iter_uo_OPNAME(IA_Image<IA_IntPoint, LTYPE> lhs)
d68 2
a69 2
/*PROMOTE*/IA_Image<IA_IntPoint, ATYPE>
OP ( const IA_Image<IA_IntPoint, LTYPE> &arg_)
d71 1
a71 1
    /*PROMOTE*/IA_Image<IA_IntPoint, LTYPE>	arg(arg_);
@


1.1
log
@Initial revision
@
text
@d10 4
a13 1
// $Log:	unary-op.templ,v $
d65 2
a66 2
IA_Image<IA_IntPoint, ATYPE>
OP ( const IA_Image<IA_IntPoint, LTYPE> &arg)
d68 1
@
