Model class

TOC

Description

All colors are alias of model for some specified category.
Every color model/format can be instantiated by using of this class.

Declaration

template< typename category_name >
  class model;

Definition ( without implementation )


    template< typename category_name >
     class model
      {
       public:
        typedef category_name category_type;

        typedef  typename ::color:trait::index< category_type>::instance_type     index_type;
        typedef  unspecified     index_return_image_type;
        typedef  unspecified     index_input_const_type

        typedef  typename ::color:trait::component< category_type>::instance_type     component_type;
        typedef  unspecified     component_input_const_type;
        typedef  unspecified     component_return_const_type;

        typedef  typename ::color:trait::container< category_type>::instance_type     container_type;
        typedef  unspecified     container_return_const_type;
        typedef  unspecified     container_return_original_type;
        typedef  unspecified     container_input_const_type;

        typedef  typename ::color:trait::size< category_type>::instance_type     size_type;

        typedef  unspecified     set_return_type;

        typedef  model< typename category_name >     this_type;

                 model();

        explicit model( container_input_const_type container );

        template< typename tag_name >
         explicit model( ::color::constant::base< tag_name > const& constant );

        explicit model( std::initializer_list<component_type> const& ilist );

        model( ::color::model<category_type> const& that );

        template< typename other_category_name >
         explicit model( ::color::model<other_category_name> const& that );

        template< typename tag_name >
         this_type & operator=( ::color::constant::base< tag_name > const& constant );

        template< typename other_category_name >
         this_type & operator=( ::color::model<other_category_name> const& that );

        component_return_const_type get( index_input_const_type index )const;

        template< index_type index >
         component_return_const_type get()const;

        set_return_type set( index_input_const_type index, component_input_const_type component );

        template< index_type index >
         set_return_type set( component_input_const_type component );

        component_return_const_type operator[]( index_input_const_type index )const;

        proxy_type                  operator[]( index_input_const_type index );

        container_return_const_type          container()const;

        container_return_original_type       container();

        void container( container_input_const_type container );

        static size_type       size();

        private:
          container_type m_container;
    };

Members

Typedefs

category_type
Description
Category of color. It's enclose model and format in one type.
Definition
typedef category_name category_type;
See also
Categories
Example
std::cout << ::color::trait::bound< ::rgb::< double >::category_type >::maximum<0>( );
component_type
Description
Type of component.
Definition
::color::trait::component< category_type >::instance_type
index_input_const_type
Description
Type of index but constant and it ais always used as function parameter
Definition
::color::trait::index< category_type >::model_type
index_type
Description
Unsigned like type used for iteratio/accesing color components.
Definition
::color::trait::index< category_type >::instance_type
component_input_const_type
Description
Type of component but constant and it ais always used as function parameter
Definition
::color::trait::component< category_type >::model_type
component_return_const_type
Description
This type is used when function return somponent
Definition
::color::trait::component< category_type >::return_const_type
container_return_const_type
Description
Original but unmodifiable version of container
Definition
::color::trait::container< category_type >::return_const_type
container_return_original_type
Description
Original container with unrestricted access.
Definition
::color::trait::container< category_type >::return_original_type
container_input_const_type
Description
Input constant parameter. Usually constant reference.
Definition
::color::trait::container< category_type >::model_type
index_return_image_type
Description
Type that will be returned
Definition
typedef ::color:trait::container< category_type>::return_image_type index_return_image_type;
container_type
Description
Type of container. It is instanceable and modifiable.
Definition
typedef ::color:trait::container< category_type>::instance_type container_type;
See also
::color::trait::container< category_type>
size_type
Description
Return type of size function.
Definition
typedef typename ::color:trait::size< category_type>::instance_type size_type;
Note
Usually same as std::size_t.
set_return_type
Description
Return type of set function.
Definition
typedef typename container_trait_type::set_return_type set_return_type;
Note
Usually void.
this_type
Description
Same type as original type;
Definition
typedef model< typename category_name > this_type;
Note
Not recommended to use. Might be removed ins some next iteration.

Constructors

model();
Description
Empty constructor. Nothing will be done. No action will be performed. Internal data will NOT be initialized.
Definition
model();
model( container )
Description
Initialize color with container. Only one assignment of container class will be performed.
Definition
explicit model( container_input_const_type container );
model( contant )
Description
Initialize intanc with contant
Definition
template< typename tag_name >
   explicit model( ::color::constant::base< tag_name > const& constant );
model( initializer_list )
Description
Initialize instance with list.
Definition
explicit model( std::initializer_list const& ilist );
model(model)
Description
Copy constructor
Definition
model( ::color::model<category_type> const& that );
model( other )
Description
Copy constructor from another model.
Definition
template< typename other_category_name >
    explicit model( ::color::model<other_category_name> const& that );

Operators

operator=( constant )
Description
Assign constant value to instance
Definition
template< typename tag_name > this_type & operator=( ::color::constant::base< tag_name > const& constant );
operator=( model )
Description
Assign other color model to instance
Definition
template< typename other_category_name > this_type & operator=( ::color::model<other_category_name> const& that );

Functions

get()const
Description
Get component for given index
Definition
component_return_const_type
  get( index_input_const_type index )const
Note
This is version of get is slower then template.
get<index>()const
Description
Get component for given index. Index will be get from template parameter.
Definition
template< index_type index >
 component_return_const_type  get()const;
set
Description
Set component.
Definition
set_return_type  set( index_input_const_type index, component_input_const_type component )
Note
This version of set is slow in compare to template version.
set<index>
Description
Set component value. Index come from template.
Definition
template< index_type index >
  set_return_type set( component_input_const_type component )
Note
This version of set is faster and it is optimized to get only component for given index .
operator[]const
Description
Return constant value of component.
Definition
component_return_const_type operator[]( index_input_const_type index )const
operator[];
Description
Non-const modifiable version of operator[]( index_input_const_type index ). Modification of return value has effect on instance as using set function.
Definition
proxy_type operator[]( index_input_const_type index );
container()const
Description
Return constant reference to container
Definition
container_return_const_type container()const
container
Description
Return reference to container
Definition
container_return_original_type container()
container
Description
Set content new content of container
Definition
void container( container_input_const_type container );
size
Description
Number of components
Definition
static size_type size()

Data

m_container
Description
Serve to purpose to hold all colors data by respecting format.
Note
The one and only data member.
type
container_type

Examples