head	1.8;
access;
symbols
	bobbase:1.6
	bob:1.6.1
	r2_1:1.6
	C_8:1.6
	r2_0:1.6
	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
	fjsoria:1.8
	thoth:1.6.1.2; strict;
comment	@// @;


1.8
date	95.01.16.22.13.54;	author fjsoria;	state Exp;
branches;
next	1.7;

1.7
date	95.01.02.17.32.49;	author fjsoria;	state Exp;
branches;
next	1.6;

1.6
date	94.07.25.17.24.13;	author thoth;	state Exp;
branches
	1.6.1.1;
next	1.5;

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

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

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

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

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

1.6.1.1
date	94.12.28.15.41.13;	author thoth;	state Exp;
branches;
next	1.6.1.2;

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


desc
@Base image declaration
@


1.8
log
@fixing operator<< overload problem for IA_Point<int>
@
text
@// Emacs: -*- C++ -*-

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


//
// $Log: BaseI.h,v $
// Revision 1.7  1995/01/02  17:32:49  fjsoria
// none
//
// Revision 1.6  1994/07/25  17:24:13  thoth
// Name sanitization
//
// Revision 1.5  1994/03/14  15:48:33  thoth
// ValueSet has been replaced by container class Set.
//
// Revision 1.4  1994/02/26  16:02:08  thoth
// operator() of the container now relies upon the contained classes
// to check if p is contained in the domain.  This means that users
// could possibly write an erroneous operator().
//
// 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/11/17  18:11:39  thoth
// extensivep is now extensive
//
// Revision 1.1  1993/09/15  12:50:22  thoth
// Initial revision
//

#ifndef BaseI_h_
#define BaseI_h_

#include <iostream.h>
#include "ia.h"
#include "Point.h"
#include "Set.h"

template <class P,class T> class IA_CoreImage;
template <class P,class T> class IA_BaseIVIter;
template <class P,class T> class IA_BaseIPIter;


#ifdef  IA_UNRESOLVED_OPERATOR
template <class T>
static ostream& dummy_op (ostream& o, T val)
{
  return o << val;
}
#endif




template < class P,class T>
class IA_BaseImage {
  protected:
    IA_Set<P>	ps;
    
    // refcount counts the number of references to this BaseI object
    //   from Image container class objects.
    // It is maintained by container classes.
    int refcount;

public:
    // Constructor for BaseI takes care of initting the refcount.
    // Derived classes need not frob it.
    // It is the responsibility of the container to maintain the refcount!

    IA_BaseImage(const IA_Set<P> &ps_) : ps(ps_) {
	refcount = 0;
    }

    int get_ref() { return refcount; }
    int incr_ref() { return ++refcount; }
    int decr_ref() { return --refcount; }

    // If the following method returns nonzero, then operator[]
    // is meaningful and clone_self_extensively is not necessary
    // unless the image is shared.
    virtual int extensive() const =0;

    // For the next two functions, we must personally trap
    // out-of-bounds points
    virtual T operator ()(const P &) const =0;

    // This method returns a modifiable reference to a value in the
    // image.  It should not be called for objects that return
    // extensive()==0.  Modifying through the reference returned
    // alters the image, so make sure the image is not shared.
    virtual T& operator [](const P &);

    // Each class derived from BaseImage must support the member function
    // type which returns a ImageType value (a pointer to an int).
    // To distinguish between the different classes derived from BaseImage,
    // we make certain that type will be distinct for each of these classes
    // as follows:
    //	Each class derived from BaseImage defines a static function member dummy:
    //		static int dummy;
    //  The class definition for derived class "classname" must also be
    //	followed by a declaration of form
    //		template <class T> int classname<T>::dummy = 0;
    //	The member function type() in each class derived from BaseImage returns
    //	the address of dummy.
    // Thus each class returns a unique value for a call of type().

    virtual IA::Type type() const = 0;

    virtual ~IA_BaseImage() {};

    // The default version of this is not blazingly fast.
    // If you can do faster in a specific implementation, please do.
    virtual IA_BaseImage* clone_self_extensively() const;

    IA_Set<P> domain() const { return this->ps; }

    // The default version of this is not blazingly fast.
    // If you can do faster in a specific implementation, please do.
    virtual IA_Set<T> range() const;

    virtual IA_Array<T> value_array() const;

    virtual IA_BaseImage<IA_Point<int>,T> * restricted_to
    (const IA_Set<IA_Point<int> > &) const;
    virtual IA_BaseImage *restricted_to(const IA_Set<IA_Point<double> > &) const;

    virtual IA_BaseImage *xlated_by(const P &) const;

    virtual IA_BaseIVIter<P,T> *value_iterator() const;
    virtual IA_BaseIPIter<P,T> *pixel_iterator() const;

    virtual ostream& print_this(ostream&) const = 0;
    
    friend ostream& operator <<(ostream&, const IA_BaseImage<P,T>&);

    friend class IA_CoreImage<P,T>;
};

#endif // BaseI_h_
@


1.7
log
@none
@
text
@d11 3
d47 12
@


1.6
log
@Name sanitization
@
text
@d11 3
a39 1

@


1.6.1.1
log
@new reflection method.
@
text
@a10 3
// Revision 1.6  1994/07/25  17:24:13  thoth
// Name sanitization
//
a36 1
#include "Array.h"
a115 1
    virtual IA_BaseImage *reflection() const;
@


1.6.1.2
log
@CoreImage has been re-merged with Image.  All special stuff should be
friends of FBI now.
@
text
@a10 3
// Revision 1.6.1.1  1994/12/28  15:41:13  thoth
// new reflection method.
//
d43 1
a43 1
template <class P,class T> class IA_Image;
d129 1
a129 1
    friend class IA_Image<P,T>;
@


1.5
log
@ValueSet has been replaced by container class Set.
@
text
@d11 3
a37 1
typedef const char* IA_ImageType;
d95 1
a95 1
    virtual IA_ImageType type() const = 0;
d111 3
a113 3
    virtual IA_BaseImage<IA_IntPoint,T> * restricted_to
    (const IA_Set<IA_IntPoint> &) const;
    virtual IA_BaseImage *restricted_to(const IA_Set<IA_FloatPoint> &) const;
@


1.4
log
@operator() of the container now relies upon the contained classes
to check if p is contained in the domain.  This means that users
could possibly write an erroneous operator().
@
text
@d11 5
a33 1
#include "ValueSet.h"
d105 1
a105 1
    virtual IA_ValueSet<T> range() const;
@


1.3
log
@Image class is now CoreImage and named image types are
Image<P,T>.
@
text
@d11 4
d65 1
a65 1
    // For the next two functions, we expect our container to trap
@


1.2
log
@extensivep is now extensive
@
text
@d11 3
d29 1
a29 1
template <class P,class T> class IA_Image;
d114 1
a114 1
    friend class IA_Image<P,T>;
@


1.1
log
@Initial revision
@
text
@d10 4
a13 1
// $Log:	BaseDI.h,v $
d56 1
a56 1
    virtual int extensivep() const =0;
d64 1
a64 1
    // extensivep()==0.  Modifying through the reference returned
@
