proto-1.0 11: Add Size1d and Size3d

Index: ChangeLog from Simon Odou <simon@lrde.epita.fr> * oln/basics1d.hh: Add size1d include. * oln/core/1d/size1d.hh: New. * oln/core/2d/size2d.hh: Fix a missing "this". * oln/core/3d/size3d.hh: New. * oln/basics3d.hh: Add size3d include. ChangeLog | 7 ++++ oln/basics1d.hh | 1 oln/basics3d.hh | 1 oln/core/1d/size1d.hh | 67 ++++++++++++++++++++++++++++++++++++++ oln/core/2d/size2d.hh | 3 + oln/core/3d/size3d.hh | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 164 insertions(+), 1 deletion(-) Index: ChangeLog --- ChangeLog (revision 10) +++ ChangeLog (working copy) @@ -1,5 +1,12 @@ 2005-01-21 Simon Odou <simon@lrde.epita.fr> + * oln/basics1d.hh: Add size1d include. + * oln/core/1d/size1d.hh: New. + * oln/core/3d/size3d.hh: New. + * oln/basics3d.hh: Add size3d include. + +2005-01-21 Simon Odou <simon@lrde.epita.fr> + * oln/basics1d.hh: New. * oln/core/1d/point1d.hh: New. * oln/core/3d: New. Index: oln/basics1d.hh --- oln/basics1d.hh (revision 10) +++ oln/basics1d.hh (working copy) @@ -4,6 +4,7 @@ # include <oln/basics.hh> +# include <oln/core/1d/size1d.hh> # include <oln/core/1d/point1d.hh> #endif // ! OLENA_BASICS1D_HH Index: oln/core/1d/size1d.hh --- oln/core/1d/size1d.hh (revision 0) +++ oln/core/1d/size1d.hh (revision 0) @@ -0,0 +1,67 @@ +#ifndef OLENA_CORE_1D_SIZE1D_HH +# define OLENA_CORE_1D_SIZE1D_HH + +# include <ostream> + +# include <oln/core/abstract/size.hh> +# include <oln/core/coord.hh> + +namespace oln { + + + struct size1d : public abstract::size< size1d > + { + size1d() : + nindices_(0) + {} + + size1d(coord_t nindices_) : + nindices_(nindices_), + border_(2) // FIXME: 2! + {} + + size1d(coord_t nindices_, coord_t border_) : + nindices_(nindices_), + border_(border_) + {} + + size1d(const size1d& rhs) : + nindices_(rhs.nindices_), + border_(rhs.border_) + {} + + void operator=(const size1d& rhs) + { + this->nindices_ = rhs.nindices_; + this->border_ = rhs.border_; + } + + unsigned long impl_npoints() const + { + return (unsigned long)nindices_; + } + + bool impl_eq(const size1d& rhs) const + { + return this->nindices_ == rhs.nindices_; + } + + const coord_t nindices() const { return nindices_; } + const coord_t border() const { return border_; } + + protected: + coord_t nindices_, border_; + }; + + +} // end of namespace oln + + +std::ostream& operator<<(std::ostream& ostr, const oln::size1d& s) +{ + return ostr << "(nindices=" << s.nindices() + << ", border=" << s.border() << ")"; +} + + +#endif // ! OLENA_CORE_1D_SIZE1D_HH Index: oln/core/2d/size2d.hh --- oln/core/2d/size2d.hh (revision 10) +++ oln/core/2d/size2d.hh (working copy) @@ -49,7 +49,8 @@ bool impl_eq(const size2d& rhs) const { - return nrows_ == rhs.nrows_ and ncols_ == rhs.ncols_; + return this->nrows_ == rhs.nrows_ and + this->ncols_ == rhs.ncols_; } const coord_t nrows() const { return nrows_; } Index: oln/core/3d/size3d.hh --- oln/core/3d/size3d.hh (revision 0) +++ oln/core/3d/size3d.hh (revision 0) @@ -0,0 +1,86 @@ +#ifndef OLENA_CORE_3D_SIZE3D_HH +# define OLENA_CORE_3D_SIZE3D_HH + +# include <ostream> + +# include <oln/core/abstract/size.hh> +# include <oln/core/coord.hh> + +namespace oln { + + + struct size3d : public abstract::size< size3d > + { + size3d() : + nslices_(0), + nrows_(0), + ncols_(0), + border_(0) + {} + + size3d(coord_t nslices_, coord_t nrows_, coord_t ncols_) : + nslices_(nslices_), + nrows_(nrows_), + ncols_(ncols_), + border_(2) // FIXME: 2! + {} + + size3d(coord_t nslices_, coord_t nrows_, coord_t ncols_, coord_t border_) : + nslices_(nslices_), + nrows_(nrows_), + ncols_(ncols_), + border_(border_) + {} + + size3d(const size3d& rhs) : + nslices_(rhs.nslices_), + nrows_(rhs.nrows_), + ncols_(rhs.ncols_), + border_(rhs.border_) + {} + + void operator=(const size3d& rhs) + { + this->nslices_ = rhs.nslices_; + this->nrows_ = rhs.nrows_; + this->ncols_ = rhs.ncols_; + this->border_ = rhs.border_; + } + + unsigned long impl_npoints() const + { + return (unsigned long)nslices_ * + (unsigned long)nslices_ * + (unsigned long)ncols_; + } + + bool impl_eq(const size3d& rhs) const + { + return this->nslices_ == rhs.nslices_ and + this->nrows_ == rhs.nrows_ and + this->ncols_ == rhs.ncols_; + } + + const coord_t nslices() const { return nslices_; } + const coord_t nrows() const { return nrows_; } + const coord_t ncols() const { return ncols_; } + const coord_t border() const { return border_; } + + protected: + coord_t nslices_, nrows_, ncols_, border_; + }; + + +} // end of namespace oln + + +std::ostream& operator<<(std::ostream& ostr, const oln::size3d& s) +{ + return ostr << "(nslices=" << s.nslices() + << ", nrows=" << s.nrows() + << ", ncols=" << s.ncols() + << ", border=" << s.border() << ")"; +} + + +#endif // ! OLENA_CORE_3D_SIZE3D_HH Index: oln/basics3d.hh --- oln/basics3d.hh (revision 10) +++ oln/basics3d.hh (working copy) @@ -4,6 +4,7 @@ # include <oln/basics.hh> +# include <oln/core/3d/size3d.hh> # include <oln/core/3d/point3d.hh> #endif // ! OLENA_BASICS3D_HH

Simon Odou <simon@lrde.epita.fr> writes:
Index: ChangeLog from Simon Odou <simon@lrde.epita.fr>
* oln/basics1d.hh: Add size1d include. * oln/core/1d/size1d.hh: New. * oln/core/2d/size2d.hh: Fix a missing "this". * oln/core/3d/size3d.hh: New. * oln/basics3d.hh: Add size3d include.
ChangeLog | 7 ++++ oln/basics1d.hh | 1 oln/basics3d.hh | 1 oln/core/1d/size1d.hh | 67 ++++++++++++++++++++++++++++++++++++++ oln/core/2d/size2d.hh | 3 + oln/core/3d/size3d.hh | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 164 insertions(+), 1 deletion(-)
Index: ChangeLog --- ChangeLog (revision 10) +++ ChangeLog (working copy) @@ -1,5 +1,12 @@ 2005-01-21 Simon Odou <simon@lrde.epita.fr>
+ * oln/basics1d.hh: Add size1d include. + * oln/core/1d/size1d.hh: New. + * oln/core/3d/size3d.hh: New. + * oln/basics3d.hh: Add size3d include. + +2005-01-21 Simon Odou <simon@lrde.epita.fr> + * oln/basics1d.hh: New. * oln/core/1d/point1d.hh: New. * oln/core/3d: New. Index: oln/basics1d.hh --- oln/basics1d.hh (revision 10) +++ oln/basics1d.hh (working copy) @@ -4,6 +4,7 @@
# include <oln/basics.hh>
+# include <oln/core/1d/size1d.hh> # include <oln/core/1d/point1d.hh>
#endif // ! OLENA_BASICS1D_HH Index: oln/core/1d/size1d.hh --- oln/core/1d/size1d.hh (revision 0) +++ oln/core/1d/size1d.hh (revision 0) @@ -0,0 +1,67 @@ +#ifndef OLENA_CORE_1D_SIZE1D_HH +# define OLENA_CORE_1D_SIZE1D_HH + +# include <ostream> + +# include <oln/core/abstract/size.hh> +# include <oln/core/coord.hh> + +namespace oln { + + + struct size1d : public abstract::size< size1d > + { + size1d() : + nindices_(0) + {} + + size1d(coord_t nindices_) : + nindices_(nindices_), + border_(2) // FIXME: 2! + {} + + size1d(coord_t nindices_, coord_t border_) : + nindices_(nindices_), + border_(border_) + {} + + size1d(const size1d& rhs) : + nindices_(rhs.nindices_), + border_(rhs.border_) + {} + + void operator=(const size1d& rhs) + { + this->nindices_ = rhs.nindices_; + this->border_ = rhs.border_; + } + + unsigned long impl_npoints() const + { + return (unsigned long)nindices_; + } + + bool impl_eq(const size1d& rhs) const + { + return this->nindices_ == rhs.nindices_; + } + + const coord_t nindices() const { return nindices_; } ncols() ? + const coord_t border() const { return border_; } + + protected: + coord_t nindices_, border_; ncols ? + }; + + +} // end of namespace oln + + +std::ostream& operator<<(std::ostream& ostr, const oln::size1d& s) +{ + return ostr << "(nindices=" << s.nindices() + << ", border=" << s.border() << ")"; +} + + +#endif // ! OLENA_CORE_1D_SIZE1D_HH Index: oln/core/2d/size2d.hh --- oln/core/2d/size2d.hh (revision 10) +++ oln/core/2d/size2d.hh (working copy) @@ -49,7 +49,8 @@
bool impl_eq(const size2d& rhs) const { - return nrows_ == rhs.nrows_ and ncols_ == rhs.ncols_; + return this->nrows_ == rhs.nrows_ and + this->ncols_ == rhs.ncols_;
Why don't you use the get methods ? ncols(), nrows() and nslices()
}
const coord_t nrows() const { return nrows_; } Index: oln/core/3d/size3d.hh --- oln/core/3d/size3d.hh (revision 0) +++ oln/core/3d/size3d.hh (revision 0) @@ -0,0 +1,86 @@ +#ifndef OLENA_CORE_3D_SIZE3D_HH +# define OLENA_CORE_3D_SIZE3D_HH + +# include <ostream> + +# include <oln/core/abstract/size.hh> +# include <oln/core/coord.hh> + +namespace oln { + + + struct size3d : public abstract::size< size3d > + { + size3d() : + nslices_(0), + nrows_(0), + ncols_(0), + border_(0) + {} + + size3d(coord_t nslices_, coord_t nrows_, coord_t ncols_) : + nslices_(nslices_), + nrows_(nrows_), + ncols_(ncols_), + border_(2) // FIXME: 2! + {} + + size3d(coord_t nslices_, coord_t nrows_, coord_t ncols_, coord_t border_) : + nslices_(nslices_), + nrows_(nrows_), + ncols_(ncols_), + border_(border_) + {} + + size3d(const size3d& rhs) : + nslices_(rhs.nslices_), + nrows_(rhs.nrows_), + ncols_(rhs.ncols_), + border_(rhs.border_) + {} + + void operator=(const size3d& rhs) + { + this->nslices_ = rhs.nslices_; + this->nrows_ = rhs.nrows_; + this->ncols_ = rhs.ncols_; + this->border_ = rhs.border_; + } + + unsigned long impl_npoints() const + { + return (unsigned long)nslices_ * + (unsigned long)nslices_ * + (unsigned long)ncols_; + } + + bool impl_eq(const size3d& rhs) const + { + return this->nslices_ == rhs.nslices_ and + this->nrows_ == rhs.nrows_ and + this->ncols_ == rhs.ncols_; + } + + const coord_t nslices() const { return nslices_; } + const coord_t nrows() const { return nrows_; } + const coord_t ncols() const { return ncols_; } + const coord_t border() const { return border_; } + + protected: + coord_t nslices_, nrows_, ncols_, border_; + }; + + +} // end of namespace oln + + +std::ostream& operator<<(std::ostream& ostr, const oln::size3d& s) +{ + return ostr << "(nslices=" << s.nslices() + << ", nrows=" << s.nrows() + << ", ncols=" << s.ncols() + << ", border=" << s.border() << ")"; +} + + +#endif // ! OLENA_CORE_3D_SIZE3D_HH Index: oln/basics3d.hh --- oln/basics3d.hh (revision 10) +++ oln/basics3d.hh (working copy) @@ -4,6 +4,7 @@
# include <oln/basics.hh>
+# include <oln/core/3d/size3d.hh> # include <oln/core/3d/point3d.hh>
#endif // ! OLENA_BASICS3D_HH
-- Damien Thivolle damien@lrde.epita.fr
participants (2)
-
Damien Thivolle
-
Simon Odou