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


1.12
date	93.05.27.11.22.45;	author thoth;	state Exp;
branches;
next	1.11;

1.11
date	93.05.26.17.04.03;	author thoth;	state Exp;
branches;
next	1.10;

1.10
date	93.04.17.18.45.13;	author thoth;	state Exp;
branches;
next	1.9;

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

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

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

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

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

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

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

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

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


desc
@Initial Revision
@


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

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


// $Log:	VectorDI.h,v $
// Revision 1.11  93/05/26  17:04:03  thoth
// new value_array() method.
// 
// Revision 1.10  93/04/17  18:45:13  thoth
// Iterator support is no longer based on a switch statement.  We now
// use a virtual method.  The user can now provide faster iterators.
// 
// Revision 1.9  93/04/08  13:21:44  thoth
// new pointset restriction method.
// new translation method.
// 
// Revision 1.8  93/03/10  13:37:13  thoth
// range method no longer returns valueset due to
// difficulties with template implementation.
// 
// Revision 1.7  93/02/20  15:15:11  thoth
// The size member is now constant.  VectorDIs are therefore no longer
// as mutable.
// The pointset should go first in an image constructor.
// Generic equality testing is not the domain of the BaseDI derived classes.
// Operations to index the vector directly are no longer supported.
// 
// Revision 1.6  93/02/17  11:05:04  thoth
// VectorDI is now a struct since it will have lots of friends.
// 
// Revision 1.5  93/02/08  13:05:27  thoth
// static dummy member belongs in the .c file.
// 
// Revision 1.4  93/01/19  14:56:41  jnw
// Modified to support IA_ naming convention
// 
// Revision 1.3  92/11/14  09:34:47  jnw
// Substituted () and [] for val and ref
// 
// Revision 1.2  92/11/13  13:50:40  jnw
//  Updated to include all sorts of new goodies
// 
// Revision 1.1  92/10/05  11:43:55  jnw
// Initial revision
// 

#ifndef VectorDI_h_
#define VectorDI_h_

#include "BaseDI.h"

template <class T> class IA_VectorDIVIter;
template <class T> class IA_VectorDIPIter;

template <class T>
class IA_VectorDI: public IA_BaseDI<T>{
//private:
  public: // public because we have too many friends.  Every operator on
    // images will want to play with our privates.
    T *vec;
    const int size;
    
    static char dummy;
  public:
    //IA_VectorDI(const IA_IntPointSet&);
    
    IA_VectorDI(IA_IntPointSet, T *, unsigned, int giveaway);
    
    IA_VectorDI(const IA_IntPointSet&, const T&);
    
    ~IA_VectorDI() { delete [] this->vec; }
    
    int extensivep() const { return 1; }
    
    T operator ()(const IA_IntPoint& p) const {
	// not guaranteed safe
	return this->vec[this->ps.index(p)];
    }
    
    // The &T operator[] is inherently unsafe, in that it returns
    // a reference to heap storage associated with an object.
    // The image of interest may go out of scope while the reference
    // is still alive.
    //
    // An additional assumption is that the user of this image object
    // (normally DiscreteImage<T>) has insured that either the
    // refcount is 1 (as DiscreteImage<T> does) or that there will
    // be no problem with returning a reference to a shared VectorDI
    // pixel value.
    
    T& operator [](const IA_IntPoint& p) {
	// not guaranteed safe
	return this->vec[this->ps.index(p)];
    }
    
#if 0
    // T& operator [](int) is unsafe in the same way as &T operator[].
    
    T& operator [](int i) { return this->vec[i]; }
    
    T operator ()(int i) const { return this->vec[i]; }
#endif

    static IA_DiscreteImageType s_type() { return &dummy; }

    IA_DiscreteImageType type() const { return &dummy; }

    IA_ValueSet<T> range() const;

    IA_Array<T> value_array() const;

    IA_BaseDI<T>* clone_self_extensively() const;

  private:
    static void vec_2_vec_structcopy(const T** source_vec, T** dest_vec,
				     const IA_SetStructure &ss);
  public:
    IA_BaseDI<T>* restricted_to(const IA_IntPointSet &) const;

    IA_BaseDI<T>* xlated_by(const IA_IntPoint &) const;

    IA_BaseDIVIter<T> *value_iterator() const;
    IA_BaseDIPIter<T> *pixel_iterator() const;

    ostream& print_this(ostream&) const;

    friend class IA_VectorDIVIter<T>;
    friend class IA_VectorDIPIter<T>;
};

#endif
@


1.11
log
@new value_array() method.
@
text
@d3 6
d10 3
@


1.10
log
@Iterator support is no longer based on a switch statement.  We now
use a virtual method.  The user can now provide faster iterators.
@
text
@d4 4
d103 3
a105 1
    T* range(unsigned *sz) const;
@


1.9
log
@new pointset restriction method.
new translation method.
@
text
@d4 4
a43 1

d110 3
@


1.8
log
@range method no longer returns valueset due to
difficulties with template implementation.
@
text
@d4 4
d55 1
a55 1
    IA_VectorDI(IA_IntPointSet, T *, unsigned, int);
d100 7
@


1.7
log
@The size member is now constant.  VectorDIs are therefore no longer
as mutable.
The pointset should go first in an image constructor.
Generic equality testing is not the domain of the BaseDI derived classes.
Operations to index the vector directly are no longer supported.
@
text
@d4 7
d92 1
a92 1
    IA_ValueSet<T> range() const;
@


1.6
log
@VectorDI is now a struct since it will have lots of friends.
@
text
@d4 3
d38 1
a38 1
    int size;
d42 1
a42 1
    IA_VectorDI(const IA_IntPointSet&);
d44 1
a44 1
    IA_VectorDI(T *, IA_IntPointSet, unsigned, int);
d46 1
a46 1
    //IA_VectorDI(T * const &, const IA_IntPointSet&, unsigned, int);
a47 2
    IA_VectorDI(const T&, const IA_IntPointSet&);
    
d73 1
a73 1
    
d79 1
a85 2

    int equal(const IA_BaseDI<T>*) const;
@


1.5
log
@static dummy member belongs in the .c file.
@
text
@d4 3
d31 3
a33 1
private:
d38 1
a38 1
public:
d41 1
a41 1
    IA_VectorDI(T *&, const IA_IntPointSet&, const int, const int);
d43 1
a43 1
    IA_VectorDI(T * const &, const IA_IntPointSet&, const int, const int);
@


1.4
log
@Modified to support IA_ naming convention
@
text
@d4 3
d22 1
a22 2
template <class T>
class IA_VectorDIVIter;
d24 1
a24 2
template <class T>
class IA_VectorDIPIter;
d47 1
d63 1
a89 3

template <class T>
char IA_VectorDI<T>::dummy = 0;
@


1.3
log
@Substituted () and [] for val and ref
@
text
@d4 3
d20 1
a20 1
class VectorDIVIter;
d23 1
a23 1
class VectorDIPIter;
d26 1
a26 1
class VectorDI: public BaseDI<T>{
d33 1
a33 1
    VectorDI(const IntPointSet&);
d35 1
a35 1
    VectorDI(T *&, const IntPointSet&, const int, const int);
d37 1
a37 1
    VectorDI(T * const &, const IntPointSet&, const int, const int);
d39 1
a39 1
    VectorDI(const T&, const IntPointSet&);
d41 1
a41 1
    ~VectorDI() { delete [] this->vec; }
d45 1
a45 1
    T operator ()(const IntPoint& p) const {
d60 3
a62 1
    T& operator [](const IntPoint& p) { return this->vec[this->ps.index(p)]; }
d71 1
a71 1
    static DiscreteImageType s_type() { return &dummy; }
d73 1
a73 1
    DiscreteImageType type() const { return &dummy; }
d75 1
a75 1
    ValueSet<T> range() const;
d77 1
a77 1
    int equal(const BaseDI<T>*) const;
d79 1
a79 1
    BaseDI<T>* clone_self_extensively() const;
d84 2
a85 2
    friend class VectorDIVIter<T>;
    friend class VectorDIPIter<T>;
d89 1
a89 1
char VectorDI<T>::dummy = 0;
@


1.2
log
@ Updated to include all sorts of new goodies
@
text
@d4 3
d42 3
a44 3
//    T operator ()(const IntPoint& p) const {
//	return this->vec[this->ps.index(p)];
//    }
d60 1
a60 1
    // member function ref(int) is unsafe in the same way as &T operator[].
d62 1
a62 1
    T& ref(int i) { return this->vec[i]; }
d64 1
a64 1
    T val(int i) const { return this->vec[i]; }
@


1.1
log
@Initial revision
@
text
@d3 4
a6 1
// $Log$
d14 1
a14 1
class VectorDIIter;
d24 1
a24 1

d28 1
a28 1

d30 1
a30 1

d32 1
a32 1

d34 1
a34 1

d36 1
a36 1

d38 1
a38 1

d42 1
a42 1

d53 1
a53 1

d55 2
a56 2


d58 1
a58 1

d60 2
d64 1
d67 2
d76 1
a76 1
    friend class VectorDIIter<T>;
@
