head	1.4;
access;
symbols
	bobbase:1.4
	bob:1.4
	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.2
	r0_9:1.2;
locks; strict;
comment	@// @;


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

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

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

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


desc
@Vector image declaration.
@


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

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


//
// $Log: VectorI.h,v $
// Revision 1.3  1994/03/14  15:48:33  thoth
// ValueSet has been replaced by container class Set.
//
// Revision 1.2  1993/11/17  18:29:17  thoth
// extensivep is now extensive.
//
// Revision 1.1  1993/09/15  12:57:46  thoth
// Initial revision
//

#ifndef VectorI_h_
#define VectorI_h_

#include "BaseI.h"

template < class P,class T> class IA_VectorIVIter;
template < class P,class T> class IA_VectorIPIter;

template < class P,class T>
class IA_VectorI: public IA_BaseImage<P,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_VectorI(const IA_Set<P>&);
    
    IA_VectorI(IA_Set<P>, T *, unsigned, int giveaway);
    
    IA_VectorI(const IA_Set<P>&, const T&);
    
    ~IA_VectorI() { delete [] this->vec; }
    
    int extensive() const { return 1; }
    
    T operator ()(const P& p) const {
	// not guaranteed safe
	return this->vec[this->ps.index(p)];
    }

    // XXX out of date:
    // 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 Image<T>) has insured that either the
    // refcount is 1 (as Image<T> does) or that there will
    // be no problem with returning a reference to a shared VectorI
    // pixel value.
    
    T& operator [](const P& 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::Type s_type() { return &dummy; }

    IA::Type type() const { return &dummy; }

    IA_Set<T> range() const;

    IA_Array<T> value_array() const;

    IA_BaseImage<P,T>* clone_self_extensively() const;

  private:
    static void vec_2_vec_structcopy(const T** source_vec, T** dest_vec,
				     const IA_SetStructure &ss);
  public:
#if 0
    IA_BaseImage<IA_Point<int>,T>* restricted_to
    (const IA_Set<IA_Point<int> > &) const;
    IA_BaseImage<P,T>* restricted_to(const IA_Set<IA_Point<double> > &) const;
#endif
    IA_BaseImage<P,T>* xlated_by(const P &) const;

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

    ostream& print_this(ostream&) const;

    friend class IA_VectorIVIter<P,T>;
    friend class IA_VectorIPIter<P,T>;
};

#endif
@


1.3
log
@ValueSet has been replaced by container class Set.
@
text
@d11 3
d80 1
a80 1
    static IA_ImageType s_type() { return &dummy; }
d82 1
a82 1
    IA_ImageType type() const { return &dummy; }
d95 3
a97 3
    IA_BaseImage<IA_IntPoint,T>* restricted_to
    (const IA_Set<IA_IntPoint> &) const;
    IA_BaseImage<P,T>* restricted_to(const IA_Set<IA_FloatPoint> &) const;
@


1.2
log
@extensivep is now extensive.
@
text
@d11 3
d81 1
a81 1
    IA_ValueSet<T> range() const;
@


1.1
log
@Initial revision
@
text
@d10 4
a13 1
// $Log:	VectorI.h,v $
d42 1
a42 1
    int extensivep() const { return 1; }
@
