head	1.8;
access;
symbols
	bobbase:1.8
	bob:1.8
	r2_1:1.8
	r2_0:1.7
	r1_1_beta:1.6
	r1_1_alpha:1.5
	r1_0:1.5
	r0_11:1.5
	r0_10:1.3
	r0_9:1.2;
locks; strict;
comment	@// @;


1.8
date	94.09.16.14.57.11;	author thoth;	state Exp;
branches;
next	1.7;

1.7
date	94.08.22.15.20.29;	author thoth;	state Exp;
branches;
next	1.6;

1.6
date	94.07.25.17.26.39;	author thoth;	state Exp;
branches;
next	1.5;

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

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

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

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

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


desc
@Discrete Template handle class implementation.
@


1.8
log
@more DOS-inspired renaming.
@
text
@// Emacs: -*- C++ -*-

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


//
// $Log: DDTempl.c,v $
// Revision 1.7  1994/08/22  15:20:29  thoth
// DOS-inspired name rework.
//
// Revision 1.6  1994/07/25  17:26:39  thoth
// Name sanitization
//
// Revision 1.5  1994/03/30  13:55:17  thoth
// New zero-argument constructor that builds an unusable template as a
// space-holder.
//
// Revision 1.4  1994/03/15  14:22:53  thoth
// Add constructor that assumes the White Hole.
//
// Revision 1.3  1994/01/07  15:16:26  thoth
// Copy constructor and assignment were missing.  This was bad.
//
// Revision 1.2  1993/10/05  19:33:08  thoth
// Move to new Closure naming convention.
//
// Revision 1.1  1993/09/15  12:51:40  thoth
// Initial revision
//
// Revision 1.3  93/05/27  11:28:18  thoth
// Copyright Notices
// 
// Revision 1.2  93/04/08  13:10:04  thoth
// Templates are now separate from images.
// 
// Revision 1.1  93/03/18  11:02:14  thoth
// Initial revision
// 

#include "IntPoint.h"
#include "DDTempl.h"
#include "IntPS.h"
#include "ErrorDT.h"
#include "InvDT.h"
#include "FuncDT.h"
#include "ClosureDT.h"



template <class I>
void IA_DDTemplate<I>::set_and_reference_template(IA_BaseDT<I> *t)
{
    t->incr_ref();
    this->bdtp = t;
}

template <class I>
void IA_DDTemplate<I>::disassociate_template()
{
    if (this->bdtp->decr_ref() <= 0)
	delete this->bdtp;
    this->bdtp = 0;
}

//
//

template <class I>
IA_DDTemplate<I>::IA_DDTemplate()
{
    set_and_reference_template(new IA_ErrorDT<I>());
}

template <class I>
IA_DDTemplate<I>::IA_DDTemplate(const IA_DDTemplate<I> &arg)
{
    set_and_reference_template(arg.bdtp);
}

template <class I>
IA_DDTemplate<I>::IA_DDTemplate(const IA_Set<IA_Point<int> > &ps, const I &i)
{
    set_and_reference_template(new IA_InvariantDT<I>(ps, i));
}

template <class I>
IA_DDTemplate<I>::IA_DDTemplate(unsigned dim, const I &i)
{
    set_and_reference_template(new IA_InvariantDT<I>(IA_WhiteHole(dim), i));
}

#if 0
// causes ambiguities
template <class I>
IA_DDTemplate<I>::IA_DDTemplate(const I &i)
{
    set_and_reference_template(new IA_InvariantDT<I>
			       (IA_WhiteHole(i.domain().dim()), i));
}
#endif

template <class I>
IA_DDTemplate<I>::IA_DDTemplate(const IA_Set<IA_Point<int> > &ps,
				I (*f)(const IA_Point<int>&))
{
    set_and_reference_template(new IA_FunctionDT<I>(ps, f));
}

template <class I>
IA_DDTemplate<I>::IA_DDTemplate(const IA_ClosureDT<I> &o)
{
    set_and_reference_template(o.clone_self());
}

template <class I>
IA_DDTemplate<I>::~IA_DDTemplate()
{
    disassociate_template();
}

template <class I>
IA_DDTemplate<I> & IA_DDTemplate<I>::operator=(const IA_DDTemplate<I>&arg)
{
    IA_BaseDT<I>	*temp = arg.bdtp;

    temp->incr_ref();

    if (this->bdtp->decr_ref() <= 0)
	delete this->bdtp;

    this->bdtp = temp;

    return *this;
}
@


1.7
log
@DOS-inspired name rework.
@
text
@d11 3
d47 2
a48 2
#include "InvariantDT.h"
#include "FunctionDT.h"
@


1.6
log
@Name sanitization
@
text
@d11 3
d42 1
a42 1
#include "IntPointSet.h"
@


1.5
log
@New zero-argument constructor that builds an unusable template as a
space-holder.
@
text
@d11 4
d78 1
a78 1
IA_DDTemplate<I>::IA_DDTemplate(const IA_IntPointSet &ps, const I &i)
d100 2
a101 2
IA_DDTemplate<I>::IA_DDTemplate(const IA_IntPointSet &ps,
				I (*f)(const IA_IntPoint&))
@


1.4
log
@Add constructor that assumes the White Hole.
@
text
@a8 2
static char DDTempl_rcsid[] = "$Id: DDTempl.c,v 1.3 1994/01/07 15:16:26 thoth Exp thoth $";

d11 3
d33 1
d36 1
d58 9
d125 2
@


1.3
log
@Copy constructor and assignment were missing.  This was bad.
@
text
@d9 1
a9 1
static char DDTempl_rcsid[] = "$Id: DDTempl.c,v 1.2 1993/10/05 19:33:08 thoth Exp $";
d13 3
d66 16
@


1.2
log
@Move to new Closure naming convention.
@
text
@d9 1
a9 1
static char DDTempl_rcsid[] = "$Id: DDTempl.c,v 1.1 1993/09/15 12:51:40 thoth Exp thoth $";
d13 3
d53 6
d81 13
@


1.1
log
@Initial revision
@
text
@d9 1
a9 1
static char DDTempl_rcsid[] = "$Id: DDTempl.c,v 1.3 93/05/27 11:28:18 thoth Exp $";
d12 4
a15 1
// $Log:	DDTempl.c,v $
d30 1
a30 1
#include "OtherDT.h"
d63 1
a63 1
IA_DDTemplate<I>::IA_DDTemplate(const IA_OtherDT<I> &o)
@
