oln::morpho::attr::cube_type< I, Exact > Class Template Reference

Cube attribute. More...

#include <attributes.hh>

Inheritance diagram for oln::morpho::attr::cube_type< I, Exact >:

Inheritance graph
[legend]
Collaboration diagram for oln::morpho::attr::cube_type< I, Exact >:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { dim = point_traits<point_type>::dim }
typedef cube_type< I, Exact > self_type
 Self type of the class.
typedef mlc::exact_vt< self_type,
Exact >::ret 
exact_type
typedef oln::morpho::attr::attr_traits<
exact_type >::value_type 
value_type
typedef oln::morpho::attr::attr_traits<
exact_type >::env_type 
env_type
typedef oln::morpho::attr::attr_traits<
exact_type >::lambda_type 
lambda_type
typedef oln::abstract::image<
typename mlc::exact< I
>::ret > 
im_type
 Image type.
typedef mlc::exact< im_type
>::ret::point_type 
point_type
 Point type associated to im_type.
typedef mlc::exact< im_type
>::ret::dpoint_type 
dpoint_type
 Dpoint type associated to im_type.

Public Member Functions

 cube_type ()
 Basic Ctor.
 cube_type (const lambda_type &lambda)
 Ctor from a lambda_type value.
 cube_type (const im_type &, const point_type &p, const env_type &)
 Ctor from a point and an image.
int getMin (int i) const
 Accessor to minimums.
int getMax (int i) const
 Accessor to maximums.
int getMin_impl (int i) const
 Implementation of getMin(int i).
int getMax_impl (int i) const
 Implementation of getMax(int i).
void pe_impl (const cube_type &rhs)
 += operator implementation.
bool less_impl (const lambda_type &lambda) const
 "<" operator implementation.
bool ne_impl (const lambda_type &lambda) const
 != operator implementation.

Protected Attributes

std::vector< coordmins_
std::vector< coordmaxs_
value_type value_

Detailed Description

template<class I, class Exact = mlc::final>
class oln::morpho::attr::cube_type< I, Exact >

Cube attribute.

Parameters:
I Exact type of images to process.
Exact The exact type.

Definition at line 1413 of file morpho/attributes.hh.


Constructor & Destructor Documentation

template<class I, class Exact = mlc::final>
oln::morpho::attr::cube_type< I, Exact >::cube_type (  )  [inline]

Basic Ctor.

Warning:
After this call, the object is only instantiated (not initialized).

Definition at line 1431 of file morpho/attributes.hh.

01432           {
01433           }

template<class I, class Exact = mlc::final>
oln::morpho::attr::cube_type< I, Exact >::cube_type ( const lambda_type lambda  )  [inline]

Ctor from a lambda_type value.

Definition at line 1440 of file morpho/attributes.hh.

References oln::morpho::attr::cube_type< I, Exact >::maxs_, and oln::morpho::attr::cube_type< I, Exact >::mins_.

01440                                             :
01441           mins_(dim),
01442           maxs_(dim),
01443           value_(lambda)
01444           {
01445             for (int i = 0; i < point_traits<point_type>::dim; ++i)
01446               {
01447                 maxs_[i] = lambda;
01448                 mins_[i] = ntg_zero_val(coord);
01449               }
01450           };

template<class I, class Exact = mlc::final>
oln::morpho::attr::cube_type< I, Exact >::cube_type ( const im_type ,
const point_type p,
const env_type  
) [inline]

Ctor from a point and an image.

Definition at line 1457 of file morpho/attributes.hh.

References oln::morpho::attr::cube_type< I, Exact >::maxs_, and oln::morpho::attr::cube_type< I, Exact >::mins_.

01459                                    :
01460           mins_(dim), maxs_(dim), value_(ntg_zero_val(value_type))
01461           {
01462             for (int i = 0; i < dim; ++i)
01463               mins_[i] = maxs_[i] = p.nth(i);
01464           }


Member Function Documentation

template<class I, class Exact = mlc::final>
int oln::morpho::attr::cube_type< I, Exact >::getMin ( int  i  )  const [inline]

Accessor to minimums.

Virtual method.

Definition at line 1474 of file morpho/attributes.hh.

Referenced by oln::morpho::attr::cube_type< I, Exact >::pe_impl().

01475           {
01476             mlc_dispatch(getMin)(i);
01477           };

template<class I, class Exact = mlc::final>
int oln::morpho::attr::cube_type< I, Exact >::getMax ( int  i  )  const [inline]

Accessor to maximums.

Virtual method.

Definition at line 1487 of file morpho/attributes.hh.

Referenced by oln::morpho::attr::cube_type< I, Exact >::pe_impl().

01488           {
01489             mlc_dispatch(getMax)(i);
01490           };

template<class I, class Exact = mlc::final>
int oln::morpho::attr::cube_type< I, Exact >::getMin_impl ( int  i  )  const [inline]

Implementation of getMin(int i).

Override this method in order to provide a new version of getMin(int i).

Warning:
Do not call this method, use getMin() instead.

Definition at line 1501 of file morpho/attributes.hh.

References oln::morpho::attr::cube_type< I, Exact >::mins_.

01502           {
01503             precondition(i < dim);
01504             return mins_[i];
01505           };

template<class I, class Exact = mlc::final>
int oln::morpho::attr::cube_type< I, Exact >::getMax_impl ( int  i  )  const [inline]

Implementation of getMax(int i).

Override this method in order to provide a new version of getMax(int i).

Warning:
Do not call this method, use getMax() instead.

Definition at line 1515 of file morpho/attributes.hh.

References oln::morpho::attr::cube_type< I, Exact >::maxs_.

01516           {
01517             precondition(i < dim);
01518             return maxs_[i];
01519           };

template<class I, class Exact = mlc::final>
void oln::morpho::attr::cube_type< I, Exact >::pe_impl ( const cube_type< I, Exact > &  rhs  )  [inline]

+= operator implementation.

This is an implementation of the += operator. Override this method to provide a new implementation of this operator.

Warning:
This method SHOULDN'T directly be called.

Definition at line 1528 of file morpho/attributes.hh.

References oln::morpho::attr::cube_type< I, Exact >::getMax(), oln::morpho::attr::cube_type< I, Exact >::getMin(), oln::morpho::attr::cube_type< I, Exact >::maxs_, oln::morpho::attr::cube_type< I, Exact >::mins_, and oln::morpho::attr::cube_type< I, Exact >::value_.

01529           {
01530             for (int i = 0; i < dim; ++i)
01531               {
01532                 mins_[i] = ntg::min(mins_[i], rhs.getMin(i));
01533                 maxs_[i] = ntg::max(maxs_[i], rhs.getMax(i));
01534               }
01535             value_ = maxs_[0] - mins_[0];
01536             for (int i = 1; i < dim; ++i)
01537               if (value_ < value_type(maxs_[i] - mins_[i]))
01538                 value_ = maxs_[i] - mins_[i];
01539           }

template<class I, class Exact = mlc::final>
bool oln::morpho::attr::cube_type< I, Exact >::less_impl ( const lambda_type lambda  )  const [inline]

"<" operator implementation.

This is an implementation of the += operator. Override this method to provide a new implementation of this operator.

Warning:
This method SHOULDN'T directly be called.

Definition at line 1548 of file morpho/attributes.hh.

References oln::morpho::attr::cube_type< I, Exact >::value_.

01549           {
01550             return value_ < lambda;
01551           }

template<class I, class Exact = mlc::final>
bool oln::morpho::attr::cube_type< I, Exact >::ne_impl ( const lambda_type lambda  )  const [inline]

!= operator implementation.

This is an implementation of the += operator. Override this method to provide a new implementation of this operator.

Warning:
This method SHOULDN'T directly be called.

Definition at line 1560 of file morpho/attributes.hh.

References oln::morpho::attr::cube_type< I, Exact >::value_.

01561           {
01562             return value_ != lambda;
01563           };


The documentation for this class was generated from the following file:
Generated on Tue Feb 20 20:29:00 2007 for Olena by  doxygen 1.5.1