head	1.9;
access;
symbols
	r0_10:1.9
	Eglin_alpha_1:1.9;
locks; strict;
comment	@// @;


1.9
date	93.05.27.11.19.42;	author thoth;	state Exp;
branches;
next	1.8;

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

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

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

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

1.4
date	93.01.19.14.56.07;	author jnw;	state Exp;
branches;
next	1.3;

1.3
date	92.11.14.09.46.07;	author jnw;	state Exp;
branches;
next	1.2;

1.2
date	92.11.13.13.50.18;	author jnw;	state Exp;
branches;
next	1.1;

1.1
date	92.10.05.11.45.05;	author jnw;	state Exp;
branches;
next	;


desc
@Initial revision
@


1.9
log
@Copyright Notices
@
text
@// Emacs: -*- C++ -*-

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


// $Log:	ErrorDI.h,v $
// Revision 1.8  93/05/18  21:40:31  thoth
// *** empty log message ***
// 
// Revision 1.7  93/03/10  13:34:56  thoth
// range method no longer returns valueset due to
// difficulties with template implementation.
// 
// Revision 1.6  93/02/20  15:12:09  thoth
// Many methods that throw have been removed (let the BaseDI throw for us).
// 
// Revision 1.5  93/02/08  12:59:59  thoth
// ErrorDI does not need another pointset and refcount.  BaseDI
// already takes care of this.
// Fixed memory leak.
// 
// Revision 1.4  93/01/19  14:56:07  jnw
// Modified to support IA_ naming convention
// 
// Revision 1.3  92/11/14  09:46:07  jnw
// modified to use () and [] instead of val and ref
// 
// Revision 1.2  92/11/13  13:50:18  jnw
//  Updated to include all sorts of new goodies
// 
// Revision 1.1  92/10/05  11:45:05  jnw
// Initial revision
// 

#ifndef ErrorDI_h_
#define ErrorDI_h_

#include <stdlib.h>
#include "BaseDI.h"

// ErrorDI generates members of a class of BaseDIs whose only valid operation
// is decr_ref().  This is used to trap operations occurring upon
// uninitialized images.

template <class T>
class IA_ErrorDI:public IA_BaseDI<T> {

public:

    IA_ErrorDI() :IA_BaseDI<T>(IA_IntPointSet()) { }

    int extensivep() const { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return 0;
    }

    T operator ()(const IA_IntPoint &) const { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return *(new T());
    }

    T& operator [](const IA_IntPoint &) { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return *(new T());
    }

#if 0
    T& operator [](int) { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return *(new T());
    }

    T operator ()(int) const {
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return *(new T());
    }
#endif

    static IA_DiscreteImageType s_type() { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return 0;
    }

    IA_DiscreteImageType type() const { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return 0;
    }

    IA_IntPointSet domain() const { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return this->ps;
    }

    IA_ValueSet<T> range() const { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return 0;
    }

    // ~IA_ErrorDI() { } // gratuitous

    IA_BaseDI<T>* clone_self_extensively() const {
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return (IA_BaseDI<T> *)this;
    }

    virtual ostream& print_this(ostream& o) const {
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return o;
    }
    
};

#endif
@


1.8
log
@*** empty log message ***
@
text
@d3 6
d10 3
@


1.7
log
@range method no longer returns valueset due to
difficulties with template implementation.
@
text
@d4 4
d88 1
a88 1
    T* range(unsigned *) const { 
@


1.6
log
@Many methods that throw have been removed (let the BaseDI throw for us).
@
text
@d4 3
d84 1
a84 1
    IA_ValueSet<T> range() const { 
d86 1
a86 1
	return IA_ValueSet<T>();
@


1.5
log
@ErrorDI does not need another pointset and refcount.  BaseDI
already takes care of this.
Fixed memory leak.
@
text
@d4 5
d37 1
a37 1
    IA_ErrorDI() :IA_BaseDI<T>(IA_IntPointSet()) {}
a43 13
    virtual int get_ref() { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return 0;
    }

    virtual int incr_ref() { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return 0;
    }

    // Make sure we can decrement references to disassociate these guys
    virtual int decr_ref() { return 1; }

d54 1
d64 1
a65 5
    int equal(const IA_BaseDI<T>*) const { 
	ia_throw( IA::IMAGE_REQUIRE_VALUE, __FILE__,__LINE__);
	return 0;
    }

d86 1
a86 1
    ~IA_ErrorDI() { }
@


1.4
log
@Modified to support IA_ naming convention
@
text
@d4 3
a28 2
protected:
    IA_IntPointSet ps;
a29 6
    // refcount counts the number of references to this BaseDI object
    //   from DiscreteImage container class objects.
    // It is maintained by container classes.
    int refcount;


d32 1
a32 1
    IA_ErrorDI() { refcount = 0; } 
d94 1
a94 1
	return *(new IA_ValueSet<T>);
@


1.3
log
@modified to use () and [] instead of val and ref
@
text
@d4 3
d25 1
a25 1
class ErrorDI:public BaseDI<T> {
d27 1
a27 1
    IntPointSet ps;
d37 1
a37 1
    ErrorDI() { refcount = 0; } 
d57 1
a57 1
    T operator ()(const IntPoint &) const { 
d62 1
a62 1
    T& operator [](const IntPoint &) { 
d77 1
a77 1
    int equal(const BaseDI<T>*) const { 
d82 1
a82 1
    static DiscreteImageType s_type() { 
d87 1
a87 1
    DiscreteImageType type() const { 
d92 1
a92 1
    IntPointSet domain() const { 
d97 1
a97 1
    ValueSet<T> range() const { 
d99 1
a99 1
	return *(new ValueSet<T>);
d102 1
a102 1
    ~ErrorDI() { }
d104 1
a104 1
    BaseDI<T>* clone_self_extensively() const {
d106 1
a106 1
	return (BaseDI<T> *)this;
@


1.2
log
@ Updated to include all sorts of new goodies
@
text
@d4 3
d64 6
a69 1
    T& ref(int) { 
@


1.1
log
@Initial revision
@
text
@d3 4
a6 1
// $Log$
a11 1
#include "ia.h"
d33 4
a36 1
    int extensivep() const { abort(); return 0; }
d38 4
a41 1
    virtual int get_ref() { abort(); return 0; }
d43 4
a46 1
    virtual int incr_ref() { abort(); return 0; }
d51 4
a54 1
    T operator ()(const IntPoint &) const { abort(); return *(new T()); }
d56 4
a59 1
    T& operator [](const IntPoint &) { abort(); return *(new T()); }
d61 4
a64 1
    T& ref(int) { abort(); return *(new T()); }
d66 4
a69 1
    int equal(const BaseDI<T>*) const { abort(); return 0; }
d71 4
a74 2
    static DiscreteImageType s_type() { abort(); return 0; }
    DiscreteImageType type() const { abort(); return 0; }
d76 4
a79 1
    ~ErrorDI() {};
d81 12
d94 2
a95 1
	abort(); return (BaseDI<T> *)this;
d99 2
a100 1
	abort(); return o;
@
