#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Core/Container/Buffer/Buffer3d.hh" // This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2001, University of Surrey // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here #ifndef RAVL_BUFFER3D_HEADER #define RAVL_BUFFER3D_HEADER 1 /////////////////////////////////////////////////////// //! rcsid="$Id: Buffer3d.hh,v 1.3 2002/04/29 18:02:49 craftit Exp $" //! file="Ravl/Core/Container/Buffer/Buffer3d.hh" //! lib=RavlCore //! docentry="Ravl.Core.Arrays.Buffer" //! author="Charles Galambos" #include "Ravl/Buffer2d.hh" #include "Ravl/RBfAcc2d.hh" //: Ravl global namespace. namespace RavlN { //! userlevel=Develop //: Buffer2D // This holds a handle to data used in various 3d arrays. template class Buffer3dBodyC : public BufferBodyC > > { public: Buffer3dBodyC() {} //: Default constructor. Buffer3dBodyC(SizeT nsize1,SizeT nsize2,SizeT nsize3) : BufferBodyC > >(nsize1), dataIndex(nsize1 * nsize2), data(nsize1 * nsize2 * nsize3), size2(nsize2), size3(nsize3) {} //: Sized constructor. #if 0 Buffer3dBodyC(const BufferC &dat,const BufferC > &buf, IndexRangeC nrng2, IndexRangeC nrng3) : BufferBodyC >(buf), data(dat), size2(nrng2.Size()), size3(nrng3.Size()) {} //: Buffer constructor. #endif Buffer3dBodyC(const BufferC &dat,SizeT nrng1,SizeT nrng2,SizeT nrng3) : BufferBodyC > >(nrng1), data(dat), size2(nrng2), size3(nrng3) {} //: Buffer constructor. BufferC &Data() { return data; } //: Access data buffer. const BufferC &Data() const { return data; } //: Access data buffer. BufferC > &DataIndex() { return dataIndex; } //: Access data buffer. const BufferC > &DataIndex() const { return dataIndex; } //: Access data buffer. SizeT Size1() const { return BufferBodyC > >::Size(); } //: Get size of dimention 1 SizeT Size2() const { return size2; } //: Get size of dimention 2 SizeT Size3() const { return size3; } //: Get size of dimention 3 protected: BufferC > dataIndex; BufferC data; SizeT size2; SizeT size3; }; //! userlevel=Develop //: Buffer3D // This holds a handle to data used in various 3d arrays. template class Buffer3dC : public BufferC > > { public: Buffer3dC() {} //: Default constructor. // creates an invalid handle. Buffer3dC(SizeT size1,SizeT size2,SizeT size3) : BufferC > >(*new Buffer3dBodyC(size1,size2,size3)) {} //: Size constructor. #if 0 Buffer3dC(const BufferC &dat,const BufferC > &buf) : BufferC > >(*new Buffer3dBodyC(dat,buf)) {} //: Constructor. #endif Buffer3dC(const BufferC &dat,SizeT rng1,SizeT rng2,SizeT rng3) : BufferC > >(*new Buffer3dBodyC(dat,rng1,rng2,rng3)) {} //: Constructor. protected: Buffer3dBodyC &Body() { return static_cast &>(BufferC > >::Body()); } //: Access body. const Buffer3dBodyC &Body() const { return static_cast &>(BufferC > >::Body()); } //: Constant access to body. public: BufferC &Data() { return Body().Data(); } //: Access data buffer. const BufferC &Data() const { return Body().Data(); } //: Access data buffer. BufferC > &DataIndex() { return Body().DataIndex(); } //: Access data buffer. const BufferC > &DataIndex() const { return Body().DataIndex(); } //: Access data buffer. SizeT Size1() const { return Body().Size1(); } //: Get size of dimention 1 SizeT Size2() const { return Body().Size2(); } //: Get size of dimention 2 SizeT Size3() const { return Body().Size3(); } //: Get size of dimention 3 }; } #endif