LRE
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
List overview
Download
Olena-patches
November 2006
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
olena-patches@lrde.epita.fr
4 participants
22 discussions
Start a n
N
ew thread
712: Rewrite stc/scoop.hh.
by Thierry GERAUD
2006-11-30 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr> * stc/scoop.hh (stc_scoop_equipment_for_namespace): Rewrite. Index: stc/scoop.hh =================================================================== --- stc/scoop.hh (revision 711) +++ stc/scoop.hh (working copy) @@ -1,325 +1,835 @@ -// Copyright (C) 2005, 2006 EPITA Research and Development Laboratory -// -// This file is part of the Olena Library. This library is free -// software; you can redistribute it and/or modify it under the terms -// of the GNU General Public License version 2 as published by the -// Free Software Foundation. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to -// the Free Software Foundation, 51 Franklin Street, Fifth Floor, -// Boston, MA 02111-1307, USA. -// -// As a special exception, you may use this file as part of a free -// software library without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to -// produce an executable, this file does not by itself cause the -// resulting executable to be covered by the GNU General Public -// License. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -/* \file stc/vtypes.hh - - \brief Equipment for SCOOP: notably, Virtual types (also known as - ``properties'') mechanism. - - Based on Theo's presentation from January 2006 (olena-06-jan.pdf). */ - -#ifndef STC_SCOOP_HH -# define STC_SCOOP_HH - -# include <mlc/flags.hh> -# include <mlc/typedef.hh> -# include <mlc/ret.hh> - -# include <mlc/assert.hh> -# include <mlc/abort.hh> - -# include <mlc/bool.hh> - -# include <mlc/cmp.hh> -# include <mlc/if.hh> -# include <mlc/is_a.hh> - - -namespace stc -{ - - /// Error messages raised by static assertions/abortions. - namespace ERROR - { - - /// Errors from check_type_of_ and check_exact_type_of_. - /// \{ - struct VIRTUAL_TYPE_NOT_FOUND; - /// \} - - } // end of namespace stc::ERROR - -} // end of namespace stc - - - -# define stc_internal_get_typedef(Type, TypedefName) \ - typename TypedefName::template from_< Type >::ret - - -# define stc_internal_get_super(Type) \ - typename typedef_::super_type::template from_< Type >::ret - - - - - - -# define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \ - \ -namespace SCOOPED_NAMESPACE \ -{ \ - \ - template <typename from_type> \ - struct set_super_type \ - { \ - typedef mlc::none ret; \ - }; \ - \ - template <typename type> \ - struct set_pseudosuper_type \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <typename from_type> \ - struct vtypes \ - { \ - }; \ - \ - template <typename from_type, typename type> \ - struct single_vtype \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - \ - namespace internal \ - { \ - \ - /* retrieve_from_single_vtype */ \ - \ - template <typename from_type, typename type> \ - struct retrieve_from_single_vtype; \ - \ - template <typename res, typename super, typename type> \ - struct helper_retrieve_from_single_vtype \ - { \ - typedef res ret; \ - }; \ - \ - template <typename super, typename type> \ - struct helper_retrieve_from_single_vtype < mlc::not_found, super, type > \ - { \ - typedef typename retrieve_from_single_vtype<super, type>::ret ret; \ - }; \ - \ - template <typename type> \ - struct helper_retrieve_from_single_vtype < mlc::not_found, mlc::none, type > \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <typename type> \ - struct helper_retrieve_from_single_vtype < mlc::not_found, mlc::not_found, type > \ - { \ - }; \ - \ - template <typename from_type, typename type> \ - struct retrieve_from_single_vtype \ - { \ - typedef SCOOPED_NAMESPACE::single_vtype<from_type, type> decl; \ - typedef typename decl::ret res; \ - typedef typename set_super_type<from_type>::ret super; \ - typedef typename helper_retrieve_from_single_vtype< res, super, type >::ret ret; \ - }; \ - \ - /* vtypes */ \ - \ - template <typename from_type, typename type> \ - struct retrieve_from_vtypes; \ - \ - template <typename res, typename super, typename type> \ - struct helper_retrieve_from_vtypes \ - { \ - typedef res ret; \ - }; \ - \ - template <typename super, typename type> \ - struct helper_retrieve_from_vtypes < mlc::not_found, super, type > \ - { \ - typedef typename retrieve_from_vtypes<super, type>::ret ret; \ - }; \ - \ - template <typename type> \ - struct helper_retrieve_from_vtypes < mlc::not_found, mlc::none, type > \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <typename type> \ - struct helper_retrieve_from_vtypes < mlc::not_found, mlc::not_found, type > \ - { \ - }; \ - \ - template <typename from_type, typename type> \ - struct retrieve_from_vtypes \ - { \ - typedef SCOOPED_NAMESPACE::vtypes<from_type> decl; \ - typedef stc_internal_get_typedef(decl, type) res; \ - typedef typename set_super_type<from_type>::ret super; \ - typedef typename helper_retrieve_from_vtypes< res, super, type >::ret ret; \ - }; \ - \ - /* pseudo super */ \ - \ - template <typename from_type> \ - struct retrieve_pseudosuper; \ - \ - template <typename res, typename super> \ - struct helper_retrieve_pseudosuper \ - { \ - typedef res ret; \ - }; \ - \ - template <typename super> \ - struct helper_retrieve_pseudosuper < mlc::not_found, super > \ - { \ - typedef typename retrieve_pseudosuper<super>::ret ret; \ - }; \ - \ - template <> \ - struct helper_retrieve_pseudosuper < mlc::not_found, mlc::none > \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <> \ - struct helper_retrieve_pseudosuper < mlc::not_found, mlc::not_found > \ - { \ - }; \ - \ - template <typename from_type> \ - struct retrieve_pseudosuper \ - { \ - typedef typename set_pseudosuper_type<from_type>::ret res; \ - typedef typename set_super_type<from_type>::ret super; \ - typedef typename helper_retrieve_pseudosuper< res, super >::ret ret; \ - }; \ - \ - /* scoop_vtype_of */ \ - \ - template <typename from_type, typename type> \ - struct step_from_vtypes; /* fwd decl of main entry */ \ - \ - /* step 3 <=> delegation */ \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_delegation \ - { \ - /* REC */ \ - typedef typename step_from_vtypes<from_type, type>::ret ret; \ - }; \ - \ - template <typename type> \ - struct helper_step_from_delegation < mlc::not_found, type > \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct step_from_delegation /* step 3 entry */ \ - { \ - typedef typename retrieve_pseudosuper<from_type>::ret pseudo_type; \ - typedef typename helper_step_from_delegation<pseudo_type, type>::ret ret; \ - }; \ - \ - /* step 2 <=> single_vtype */ \ - \ - template <typename res, typename from_type, typename type> \ - struct helper_step_from_single_vtype \ - { \ - typedef res ret; /* found! */ \ - }; \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_single_vtype <mlc::not_found, /* => step 3 */ \ - from_type, type> \ - { \ - typedef typename step_from_delegation<from_type, type>::ret ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_single_vtype <mlc::undefined, /* => step 3 */ \ - from_type, type> \ - { \ - typedef typename step_from_delegation<from_type, type>::ret ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct step_from_single_vtype /* step 2 entry */ \ - { \ - typedef typename retrieve_from_single_vtype<from_type, type>::ret res; \ - typedef typename helper_step_from_single_vtype< res, from_type, type>::ret ret; \ - }; \ - \ - /* step 1 <=> vtypes */ \ - \ - template <typename res, typename from_type, typename type> \ - struct helper_step_from_vtypes \ - { \ - typedef res ret; /* found! */ \ - }; \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_vtypes <mlc::not_found, /* => step 2 */ \ - from_type, type> \ - { \ - typedef typename step_from_single_vtype<from_type, type>::ret ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_vtypes <mlc::undefined, /* => step 2 */ \ - from_type, type> \ - { \ - typedef typename step_from_single_vtype<from_type, type>::ret ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct step_from_vtypes /* main entry (so step 1 entry) */ \ - { \ - typedef typename retrieve_from_vtypes<from_type, type>::ret res; \ - typedef typename helper_step_from_vtypes< res, from_type, type>::ret ret; \ - }; \ - \ - } /* end of namespace SCOOPED_NAMESPACE ::internal */ \ - \ - \ - template <typename from_type, typename type> \ - struct direct_type_of_ \ - { \ - typedef typename internal::step_from_vtypes<from_type, type>::ret ret; \ - }; \ - \ - \ -} /* end of namespace SCOOPED_NAMESPACE */ \ - \ -struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n - - - -#endif // ! STC_SCOOP_HH +// Copyright (C) 2005, 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/* \file stc/vtypes.hh + + \brief Equipment for SCOOP: notably, Virtual types (also known as + ``properties'') mechanism. + + Based on Theo's presentation from January 2006 (olena-06-jan.pdf). */ + +#ifndef STC_SCOOP_HH +# define STC_SCOOP_HH + +# include <mlc/flags.hh> +# include <mlc/typedef.hh> +# include <mlc/ret.hh> +# include <mlc/assert.hh> +# include <mlc/abort.hh> +# include <mlc/bool.hh> +# include <mlc/pair.hh> +# include <mlc/cmp.hh> +# include <mlc/if.hh> +# include <mlc/is_a.hh> + + +namespace stc +{ + + struct not_delegated; + + struct abstract; + + template <typename T> + struct final; + +} // end of namespace stc + + + +#define stc_super(T) typename set_super_type< T >::ret +#define stc_stm(From, Target) typename get_stm< From , Target >::ret + + +# define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \ + \ + \ +namespace SCOOPED_NAMESPACE \ +{ \ + \ + mlc_decl_typedef(delegatee_type); \ + \ + \ + template <typename from_type> \ + struct set_super_type \ + { \ + typedef mlc::none ret; \ + /* FIXME: nothing here! \ + * \ + * mlc::none is not a default value \ + * so that the client should define stoppers \ + */ \ + }; \ + \ + template <typename from_type> \ + struct vtypes \ + { \ + }; \ + \ + template <typename from_type, typename type> \ + struct single_vtype \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + \ + \ + namespace ERROR \ + { \ + \ + template < typename first_definition, \ + typename re_definition, \ + typename target > \ + struct final_vtype_redefined_; \ + \ + \ + template < typename first_definition, \ + typename declaration, \ + typename target > \ + struct vtype_declared_but_already_set_; \ + \ + \ + template < typename from, \ + typename target > \ + struct vtype_not_found; \ + \ + \ + template < typename curr, \ + typename target, \ + typename stm > \ + struct wrong_final_stm_; \ + \ + \ + template < typename target, \ + typename declaration, \ + typename from > \ + struct vtype_declared_but_not_defined; \ + \ + \ + template <typename T> \ + struct _declaration_is_in_; \ + \ + template <typename T> \ + struct _definition_is_looked_up_from_; \ + \ + \ + template <typename T> \ + struct _for_vtype_; \ + \ + \ + struct no_delegatee_declared_; \ + \ + \ + } /* end of namespace SCOOPED_NAMESPACE::ERROR */ \ + \ + \ + \ + namespace internal \ + { \ + \ + \ + /* \ + * Forward declarations. \ + */ \ + \ + \ + template <typename from, typename target> \ + struct get_stm; \ + \ + template <typename res1, typename res2> \ + struct helper_get_stm; \ + \ + template <typename from, typename target> \ + struct first_stm; \ + \ + template <typename curr, typename target, typename stm> \ + struct helper_first_stm; \ + \ + \ + template <typename from, typename target, typename curr = from> \ + struct superior_find; \ + \ + template <typename from, typename target, typename curr, typename stm> \ + struct helper_superior_find; \ + \ + template <typename from, typename target> \ + struct delegator_find; \ + \ + template <typename from, typename target, typename delegatee> \ + struct helper_delegator_find; \ + \ + template <typename from, typename target> \ + struct find; \ + \ + template <typename from, typename target, typename where, typename res> \ + struct helper_find; \ + \ + \ + \ + template <typename from, typename target> \ + struct check; \ + \ + template <typename curr, typename target, typename stm> \ + struct helper_check; \ + \ + \ + \ + /* get_stm(from, target) \ + * \ + * Returns the statement for class 'from' corresponding to 'target'. \ + * This statement is either defined in 'vtypes' or in 'single_vtype'. \ + * \ + * This routine is local; it does not recourse on superior classes. \ + * \ + */ \ + \ + template <typename res1> \ + struct helper_get_stm <res1, mlc::not_found> \ + { \ + typedef res1 ret; \ + }; \ + \ + template <typename res2> \ + struct helper_get_stm <mlc::not_found, res2> \ + { \ + typedef res2 ret; \ + }; \ + \ + template <> \ + struct helper_get_stm <mlc::not_found, mlc::not_found> \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename res1, typename res2> \ + struct helper_get_stm \ + { \ + /* error */ \ + }; \ + \ + template <typename from, typename target> \ + struct get_stm \ + { \ + typedef SCOOPED_NAMESPACE::vtypes<from> decl1; \ + typedef typename target::template from_<decl1>::ret res1; \ + \ + typedef SCOOPED_NAMESPACE::single_vtype<from, target> decl2; \ + typedef typename decl2::ret ret2; \ + \ + typedef typename helper_get_stm<res1, ret2>::ret ret; \ + }; \ + \ + \ + \ + \ + /* \ + * check_no_final_inherited \ + * \ + * FIXME: ... \ + */ \ + \ + template < typename orig, typename curr, typename target, \ + typename stm = typename get_stm<curr, target>::ret > \ + struct check_no_final_inherited \ + \ + : mlc::assert_< mlc_is_not_a(stm, stc::final), \ + ERROR::final_vtype_redefined_< orig, \ + mlc::pair_<curr, stm>, \ + target > \ + >, \ + /* rec */ check_no_final_inherited<orig, stc_super(curr), target> \ + { \ + }; \ + \ + template <typename orig, typename target, typename stm> \ + struct check_no_final_inherited <orig, /* if curr == */ mlc::none, target, stm> \ + { \ + }; \ + \ + \ + /* \ + * check_no_stm_inherited \ + * \ + * FIXME: ... \ + */ \ + \ + template < typename orig, typename curr, typename target, \ + typename stm = typename get_stm<curr, target>::ret > \ + struct check_no_stm_inherited \ + \ + : mlc::assert_< mlc::is_not_found_<stm>, \ + ERROR::vtype_declared_but_already_set_< orig, \ + mlc::pair_<curr, stm>, \ + target > \ + >, \ + /* rec */ check_no_stm_inherited<orig, stc_super(curr), target> \ + { \ + }; \ + \ + template <typename orig, typename target, typename stm> \ + struct check_no_stm_inherited <orig, /* if curr == */ mlc::none, target, stm> \ + { \ + }; \ + \ + \ + /* \ + * check_delegatee_inherited \ + */ \ + \ + template <typename curr, typename target> \ + struct check_delegatee_inherited \ + : mlc::assert_< mlc::is_found_< typename first_stm<curr, \ + typedef_::delegatee_type>::ret::second_elt >, \ + ERROR::no_delegatee_declared_ > \ + { \ + }; \ + \ + \ + /* \ + * check_final_stm \ + */ \ + \ + template <typename curr, typename target, typename stm> \ + struct check_final_stm \ + {}; \ + \ + template <typename curr, typename target> \ + struct check_final_stm < curr, target, stc::abstract > \ + : mlc::abort_< ERROR::wrong_final_stm_<curr, target, stc::final<stc::abstract> > > \ + {}; \ + \ + template <typename curr, typename target, typename T> \ + struct check_final_stm < curr, target, stc::final<T> > \ + : mlc::abort_< ERROR::wrong_final_stm_<curr, target, stc::final<stc::final<T> > > > \ + {}; \ + \ + template <typename curr, typename target> \ + struct check_final_stm < curr, target, stc::not_delegated > \ + : mlc::abort_< ERROR::wrong_final_stm_<curr, target, stc::final<stc::not_delegated> > > \ + {}; \ + \ + template <typename curr, typename target> \ + struct check_final_stm < curr, target, mlc::not_found > \ + : mlc::abort_< ERROR::wrong_final_stm_<curr, target, stc::final<mlc::not_found> > > \ + {}; \ + \ + \ + \ + \ + /* \ + * check(from, target) \ + * \ + * pseudo-code: \ + * \ + * check(from, target) \ + * { \ + * if (from == mlc::none) // stop because no more class \ + * return done; \ + * else \ + * return helper_check(from, target, get_stm(from, target)); \ + * } \ + */ \ + \ + struct dummy {}; \ + \ + template <typename target> \ + struct check < /* if from == */ mlc::none, target > \ + { \ + typedef dummy ret; \ + }; \ + \ + template <typename from, typename target> \ + struct check /* otherwise */ \ + { \ + typedef typename helper_check< from, target, \ + stc_stm(from, target) >::ret ret; \ + }; \ + \ + \ + \ + \ + /* \ + * pseudo-code: \ + * \ + * helper_check(curr, target, stm) \ + * { \ + * super = super(curr); \ + * \ + * if (stm == stc::abstract) { \ + * check_no_stm_inherited(curr, super, target); \ + * return check(super, target); \ + * } \ + * if (stm == stc::final<T>) { \ + * check_final_stm(T); \ + * check_no_final_inherited((curr, T), super, target); \ + * return check(super, target); \ + * } \ + * if (stm == stc::not_delegated) { \ + * check_delegatee_inherited(curr); \ + * check_no_final_inherited((curr, stc::not_delegated), super, target); \ + * return check(super, target); \ + * } \ + * if (stm == mlc::not_found) { \ + * return check(super, target); \ + * } \ + * // otherwise, non-final stm: \ + * if (stm == T) { \ + * check_no_final_inherited((curr, T), super, target); \ + * return check(super, target); \ + * } \ + * } \ + * \ + */ \ + \ + template <typename curr, typename target> \ + struct helper_check < curr, target, \ + /* if stm == */ stc::abstract > \ + : check_no_stm_inherited< mlc::pair_<curr, stc::abstract >, \ + stc_super(curr), \ + target > \ + { \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target, typename T> \ + struct helper_check < curr, target, \ + /* if stm == */ stc::final<T> > \ + : check_no_final_inherited< mlc::pair_<curr, stc::final<T> >, \ + stc_super(curr), \ + target > \ + { \ + /* FIXME: \ + check_final_stm(T); \ + */ \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target> \ + struct helper_check < curr, target, \ + /* if stm == */ stc::not_delegated > \ + : check_no_final_inherited< mlc::pair_<curr, stc::not_delegated>, \ + stc_super(curr), \ + target > \ + { \ + /* FIXME: \ + check_delegatee_inherited(curr); \ + */ \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target> \ + struct helper_check < curr, target, \ + /* if stm == */ mlc::not_found > \ + { \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target, typename stm> \ + struct helper_check /* otherwise, non-final stm */ \ + : check_no_final_inherited< mlc::pair_<curr, stm>, \ + stc_super(curr), \ + target > \ + { \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + \ + \ + \ + /* \ + * first_stm(from, target) \ + * \ + * returns a pair (Where, Value) with Value being: \ + * - stc::abstract \ + * - stc::not_delegated \ + * - mlc::not_found \ + * - a type T \ + * and Where being the class where the stm is found. \ + * \ + * \ + * helper_first_stm(curr, target, stm) \ + * { \ + * if (stm == mlc::not_found) \ + * return first_stm(super(curr), target); \ + * else if (stm == stc::final<T>) \ + * return pair(curr, T); \ + * else \ + * return pair(curr, stm); \ + * } \ + * \ + * first_stm(from, target) \ + * { \ + * if (from == mlc::none) \ + * return pair(mlc::none, mlc::not_found); \ + * else \ + * return helper_first_stm(from, target, \ + * get_stm(from, target)); \ + * } \ + * \ + */ \ + \ + template <typename curr, typename target> \ + struct helper_first_stm < curr, target, \ + /* if stm == */ mlc::not_found > \ + { \ + typedef typename first_stm<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target, typename T> \ + struct helper_first_stm < curr, target, \ + /* if stm == */ stc::final<T> > \ + { \ + typedef mlc::pair_<curr, T> ret; \ + }; \ + \ + template <typename curr, typename target, typename stm> \ + struct helper_first_stm /* otherwise */ \ + { \ + typedef mlc::pair_<curr, stm> ret; \ + }; \ + \ + template <typename target> \ + struct first_stm < /* if from == */ mlc::none, target > \ + { \ + typedef mlc::pair_<mlc::none, mlc::not_found> ret; \ + }; \ + \ + template <typename from, typename target> \ + struct first_stm /* otherwise */ \ + { \ + typedef typename helper_first_stm<from, target, \ + stc_stm(from, target)>::ret ret; \ + }; \ + \ + \ + \ + /* \ + * superior_find(from, target) \ + * \ + * returns: \ + * either mlc::not_found \ + * or a type T \ + * behavior: \ + * - the stm stc::not_delegated is ignored \ + * - error when stc::abstract is reached \ + * \ + * helper_superior_find(from, target, curr, stm) \ + * { \ + * if (stm == stc::abstract) \ + * error("<target> declared in <curr> but not defined at <from>"); \ + * else if (stm == mlc::not_found or \ + * stm == stc::not_delegated) \ + * return superior_find(from, target, super(curr)); \ + * else if (stm == stc::final<T>) \ + * return T; \ + * else \ + * return stm; \ + * } \ + * \ + * superior_find(from, target, curr = from) \ + * { \ + * if (curr == mlc::none) \ + * return mlc::not_found; \ + * else \ + * return helper_superior_find(from, target, curr, \ + * get_stm(curr, target)); \ + * } \ + */ \ + \ + template <typename from, typename target, typename curr> \ + struct helper_superior_find < from, target, curr, \ + /* if stm == */ stc::abstract > \ + { \ + /* FIXME: error("<target> declared in <curr> but not defined at <from>"); */ \ + }; \ + \ + template <typename from, typename target, typename curr> \ + struct helper_superior_find < from, target, curr, \ + /* if stm == */ mlc::not_found > \ + { \ + typedef typename superior_find< from, target, \ + stc_super(curr) >::ret ret; \ + }; \ + \ + template <typename from, typename target, typename curr> \ + struct helper_superior_find < from, target, curr, \ + /* if stm == */ stc::not_delegated > \ + { \ + typedef typename superior_find< from, target, \ + stc_super(curr) >::ret ret; \ + }; \ + \ + template <typename from, typename target, typename curr, typename T> \ + struct helper_superior_find < from, target, curr, \ + /* if stm == */ stc::final<T> > \ + { \ + typedef T ret; \ + }; \ + \ + template <typename from, typename target, typename curr, typename stm> \ + struct helper_superior_find /* otherwise */ \ + { \ + typedef stm ret; \ + }; \ + \ + template <typename from, typename target> \ + struct superior_find < from, target, /* if curr == */ mlc::none > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename from, typename target, typename curr> \ + struct superior_find /* otherwise */ \ + { \ + typedef typename helper_superior_find<from, target, curr, \ + stc_stm(curr, target)>::ret ret; \ + }; \ + \ + \ + \ + /* \ + * delegator_find(from, target) \ + * \ + * \ + * delegator_find(from, target) \ + * { \ + * precondition(target != delegatee_type); \ + * delegatee = superior_find(from, delegatee_type); \ + * if (delegatee == mlc::not_found) \ + * return mlc::not_found; \ + * else \ + * return find(delegatee, target); \ + * } \ + */ \ + \ + template <typename from, typename target> \ + struct helper_delegator_find < from, target, \ + /* if delegatee == */ mlc::not_found > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename from, typename target, typename delegatee> \ + struct helper_delegator_find /* otherwise */ \ + { \ + typedef typename find<delegatee, target>::ret ret; \ + }; \ + \ + template <typename from, typename target> \ + struct delegator_find \ + { \ + typedef typename superior_find<from, typedef_::delegatee_type>::ret delegatee; \ + typedef typename helper_delegator_find<from, target, delegatee>::ret ret; \ + }; \ + \ + \ + \ + /* \ + * helper_find(from, target, where, res) \ + * \ + * \ + * \ + */ \ + \ + template <typename from, typename target, typename where> \ + struct helper_find < from, target, where, \ + /* if res == */ mlc::not_found > \ + { \ + typedef typename delegator_find<from, target>::ret ret; \ + }; \ + \ + template <typename from, typename target, typename where> \ + struct helper_find < from, target, where, \ + /* if res == */ stc::abstract > \ + { \ + typedef typename delegator_find<from, target>::ret res_d; \ + struct check_ \ + : mlc::assert_< mlc::is_found_<res_d>, \ + ERROR::vtype_declared_but_not_defined \ + < ERROR::_for_vtype_<target>, \ + ERROR::_declaration_is_in_<where>, \ + ERROR::_definition_is_looked_up_from_<from> > > \ + /* FIXME: error("<target> declared in <where> but not defined at <from>"); */ \ + { \ + typedef res_d ret; \ + }; \ + typedef typename check_::ret ret; \ + }; \ + \ + template <typename from, typename target, typename where> \ + struct helper_find < from, target, where, \ + /* if res == */ stc::not_delegated > \ + { \ + typedef typename superior_find<from, target>::ret ret; \ + }; \ + \ + template <typename from, typename target, typename where, typename res> \ + struct helper_find /* otherwise */ \ + { \ + typedef res ret; \ + }; \ + \ + \ + \ + /* \ + * find(from, target) \ + * \ + * FIXME: ... \ + * \ + * find(from, target) \ + * { \ + * if (target == delegatee_type) \ + * return superior_find(from, delegatee_type); \ + * else \ + * return helper_find(from, target); \ + * } \ + */ \ + \ + template <typename from> \ + struct find <from, /* if target == */ typedef_::delegatee_type > \ + { \ + typedef typename superior_find<from, typedef_::delegatee_type>::ret ret; \ + }; \ + \ + template <typename from, typename target> \ + struct find /* otherwise */ \ + { \ + typedef typename first_stm<from, target>::ret stm; \ + typedef mlc_elt(stm, 1) where; \ + typedef mlc_elt(stm, 2) res; \ + typedef typename helper_find<from, target, \ + where, res>::ret ret; \ + }; \ + \ + \ + } /* end of SCOOPED_NAMESPACE::internal */ \ + \ + \ + /* \ + * find_vtype(from, target) \ + * \ + * FIXME:... \ + * \ + */ \ + \ + template <typename from, typename target> \ + struct deferred_vtype \ + { \ + typedef typename internal::find<from, target>::ret ret; \ + }; \ + \ + template <typename from, typename target> \ + struct find_vtype \ + { \ + typedef typename internal::find<from, target>::ret ret; \ + typedef typename internal::check<from, target>::ret chk; \ + }; \ + \ + template <typename from, typename target> \ + struct vtype \ + { \ + typedef typename find_vtype<from, target>::ret res; \ + struct check_ : mlc::assert_< mlc::is_found_<res> > \ + { \ + typedef res ret; \ + }; \ + typedef typename check_::ret ret; \ + }; \ + \ + \ +} /* end of SCOOPED_NAMESPACE */ \ + \ + \ +struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n; + + + +# define stc_find_vtype_(Namespace, From, Target) \ + Namespace::find_vtype<From, Namespace::typedef_::Target##_type>::ret + +# define stc_find_vtype(Namespace, From, Target) \ + typename stc_find_vtype_(Namespace, From, Target) + + + +# define stc_deferred_vtype(Namespace, From, Target) \ + typename Namespace::deferred_vtype<From, Namespace::typedef_::Target##_type>::ret + + + +# define stc_vtype_(Namespace, From, Target) \ + Namespace::vtype<From, Namespace::typedef_::Target##_type>::ret + +# define stc_vtype(Namespace, From, Target) \ + typename stc_vtype_(Namespace, From, Target) + + + +# define stc_find_deduce_vtype_(Namespace, From, Target1, Target2) \ + Namespace::find_vtype< Namespace::find_vtype<From, \ + Namespace::typedef_::Target1##_type>::ret, \ + Namespace::typedef_::Target2##_type>::ret + +# define stc_find_deduce_vtype(Namespace, From, Target) \ + typename \ + Namespace::find_vtype< typename \ + Namespace::find_vtype<From, \ + Namespace::typedef_::Target1##_type>::ret, \ + Namespace::typedef_::Target2##_type>::ret + + + +# define stc_deduce_deferred_vtype(Namespace, From, Target1, Target2) \ + typename \ + Namespace::deferred_vtype< typename \ + Namespace::deferred_vtype<From, \ + Namespace::typedef_::Target1##_type>::ret, \ + Namespace::typedef_::Target2##_type>::ret \ + + + +# define stc_deduce_vtype_(Namespace, From, Target1, Target2) \ + Namespace::vtype< Namespace::vtype<From, \ + Namespace::typedef_::Target1##_type>::ret, \ + Namespace::typedef_::Target2##_type>::ret + +# define stc_deduce_vtype(Namespace, From, Target1, Target2) \ + typename \ + Namespace::vtype< typename \ + Namespace::vtype<From, \ + Namespace::typedef_::Target1##_type>::ret, \ + Namespace::typedef_::Target2##_type>::ret + + + + + +// # define stc_vtype_is_found_(Namespace, From, Target) +// mlc::is_found_< Namespace::find_vtype<From, Namespace::typedef_::Target##_type>::ret > + + +#endif // ! STC_SCOOP_HH
18 years
1
0
0
0
711: Fix inheritance in mlc/uint.hh.
by Thierry GERAUD
2006-11-30 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr> * mlc/uint.hh: Fix inheritance. Index: mlc/uint.hh =================================================================== --- mlc/uint.hh (revision 710) +++ mlc/uint.hh (working copy) @@ -28,7 +28,7 @@ #ifndef MLC_UINT_HH # define MLC_UINT_HH -# include <mlc/bool.hh> +# include <mlc/bexpr.hh> namespace mlc @@ -37,27 +37,27 @@ // FIXME: doc and complete code... template <unsigned lvalue, unsigned rvalue> - struct uint_equal_ : public bool_<( lvalue == rvalue )> + struct uint_equal_ : public bexpr_<( lvalue == rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_not_equal_ : public bool_<( lvalue != rvalue )> + struct uint_not_equal_ : public bexpr_<( lvalue != rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_greater_ : public bool_<( lvalue > rvalue )> + struct uint_greater_ : public bexpr_<( lvalue > rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_greater_or_equal_ : public bool_<( lvalue >= rvalue )> + struct uint_greater_or_equal_ : public bexpr_<( lvalue >= rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_less_ : public bool_<( lvalue < rvalue )> + struct uint_less_ : public bexpr_<( lvalue < rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_less_or_equal_ : public bool_<( lvalue <= rvalue )> + struct uint_less_or_equal_ : public bexpr_<( lvalue <= rvalue )> {};
18 years
1
0
0
0
710: Catch up with the new SCOOP 2 implementation.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Catch up with the new SCOOP 2 implementation. * tests/super.cc, tests/vtypes.cc * tests/vtypes-and-exact.cc: Adjust tests to catch up with the new stc/scoop.hh. * stc/Makefile.am (EXTRA_DIST): Add was.scoop.hh. * tests/Makefile.am (check_PROGRAMS): Remove multiple-supers and vtypes-multiple-supers. (multiple_supers_SOURCES, vtypes_multiple_supers_SOURCES): Remove. (EXTRA_DIST): New. Add multiple-supers.cc and vtypes-multiple-supers.cc. stc/Makefile.am | 3 + tests/Makefile.am | 7 +-- tests/super.cc | 17 ++++++-- tests/vtypes-and-exact.cc | 89 +++++++++++++++++----------------------------- tests/vtypes.cc | 44 ++++++++++------------ 5 files changed, 71 insertions(+), 89 deletions(-) Index: tests/vtypes-and-exact.cc --- tests/vtypes-and-exact.cc (revision 709) +++ tests/vtypes-and-exact.cc (working copy) @@ -34,21 +34,16 @@ #include <mlc/int.hh> #include <stc/any.hh> +#include <stc/exact.hh> #include <stc/scoop.hh> // Helper macros. -#define my_type_of(FromType, Typedef) \ - typename my_type_of_(FromType, Typedef) +#define my_type_of_(FromType, Alias) \ + my::direct_type_of_<FromType, my::typedef_:: Alias##_type>::ret -#define my_type_of_(FromType, Typedef) \ - stc_type_of_(my, my::category::my_cat, FromType, Typedef) - -#define my_direct_type_of(FromExactType, Typedef) \ - typename my_direct_type_of_(FromExactType, Typedef) - -#define my_direct_type_of_(FromExactType, Typedef) \ - stc_direct_type_of_(my, my::category::my_cat, FromExactType, Typedef) +#define my_type_of(FromType, Alias) \ + typename my_type_of_(FromType, Alias) // Namespace equipment. @@ -69,17 +64,6 @@ mlc_decl_typedef(zorg_type); - /*-----------. - | Category. | - `-----------*/ - - // We only use one category here. - namespace category - { - struct my_cat; - } - - /*----------------------------------------. | A<Exact> --|> stc::any__simple<Exact>. | `----------------------------------------*/ @@ -90,7 +74,7 @@ /// Types associated to my::A. template <typename Exact> - struct vtypes_in_category< category::my_cat, A<Exact> > + struct vtypes< A<Exact> > { // A native type. typedef int foo_type; @@ -109,6 +93,8 @@ // Aliases. + // META-FIXME: Update comment (stc/scoop.hh as changed since). + /* FIXME: Work around a bug that affects both g++ 4.1 and gcc-snapshot (4.2) from Debian. The versions of the compiler used at the moment this text was written were: @@ -123,14 +109,9 @@ assertions ``Ensure stc::is_any_ works properly.'' below (in main). Using my_direct_type_of (on the exact type) solves this! */ -#if 0 - typedef my_type_of(self_t, foo) foo_t; - typedef my_type_of(self_t, bar) bar_t; - typedef my_type_of(self_t, baz) baz_t; -#endif - typedef my_direct_type_of(exact_t, foo) foo_t; - typedef my_direct_type_of(exact_t, bar) bar_t; - typedef my_direct_type_of(exact_t, baz) baz_t; + typedef my_type_of(exact_t, foo) foo_t; + typedef my_type_of(exact_t, bar) bar_t; + typedef my_type_of(exact_t, baz) baz_t; }; @@ -151,7 +132,7 @@ /// Types associated to my::B. template <typename Exact> - struct vtypes_in_category< category::my_cat, B<Exact> > + struct vtypes< B<Exact> > { // (foo is left untouched.) @@ -165,35 +146,30 @@ /// An extended type associated to my::B. template <typename Exact> - struct ext_vtype_in_category<category::my_cat, B<Exact>, typedef_::yin_type> + struct single_vtype< B<Exact>, typedef_::yin_type > { typedef unsigned long ret; }; template <typename Exact> - struct B : public stc_get_supers(B<Exact>) + struct B : public A<Exact> { typedef B<Exact> self_t; typedef Exact exact_t; // Aliases. + // META-FIXME: Update comment (stc/scoop.hh as changed since). + /* FIXME: Same as above; using my_type_of (i.e., using stc_to_exact) breaks the assertions ``Ensure stc::is_any_ works properly.'' below (in main). Using my_direct_type_of (on the exact type) solves this! */ -#if 0 - typedef my_type_of(self_t, foo) foo_t; - typedef my_type_of(self_t, bar) bar_t; - typedef my_type_of(self_t, baz) baz_t; - typedef my_type_of(self_t, quux) quux_t; - typedef my_type_of(self_t, yin) yin_t; -#endif - typedef my_direct_type_of(exact_t, foo) foo_t; - typedef my_direct_type_of(exact_t, bar) bar_t; - typedef my_direct_type_of(exact_t, baz) baz_t; - typedef my_direct_type_of(exact_t, quux) quux_t; - typedef my_direct_type_of(exact_t, yin) yin_t; + typedef my_type_of(exact_t, foo) foo_t; + typedef my_type_of(exact_t, bar) bar_t; + typedef my_type_of(exact_t, baz) baz_t; + typedef my_type_of(exact_t, quux) quux_t; + typedef my_type_of(exact_t, yin) yin_t; }; @@ -205,35 +181,36 @@ struct C; // Super type. - stc_set_super(C, B<C>); + template <> + struct set_super_type<C> + { + typedef B<C> ret; + }; /// Types associated to my::C. template <> - struct vtypes_in_category<category::my_cat, C> + struct vtypes<C> { // A type defined only here (and not in the super class). typedef double zorg_type; }; - struct C : public stc_get_supers(C) + struct C : public B<C> { typedef C self_t; typedef self_t exact_t; // Aliases. + // META-FIXME: Update comment (stc/scoop.hh as changed since). + /* FIXME: Same as above; using my_type_of_ (i.e., using stc_to_exact) breaks the assertions ``Ensure stc::is_any_ works properly.'' below (in main). Using my_direct_type_of_ (on the exact type) solves this! */ -#if 0 - typedef my_type_of_(self_t, foo) foo_t; - typedef my_type_of_(self_t, quux) quux_t; - typedef my_type_of_(self_t, zorg) zorg_t; -#endif - typedef my_direct_type_of_(exact_t, foo) foo_t; - typedef my_direct_type_of_(exact_t, quux) quux_t; - typedef my_direct_type_of_(exact_t, zorg) zorg_t; + typedef my_type_of_(exact_t, foo) foo_t; + typedef my_type_of_(exact_t, quux) quux_t; + typedef my_type_of_(exact_t, zorg) zorg_t; }; } // end of namespace my Index: tests/super.cc --- tests/super.cc (revision 709) +++ tests/super.cc (working copy) @@ -56,10 +56,14 @@ // Forward declaration. struct B; - // Warning, this sugar might be removed in the future. - stc_set_super(B, A); + // Set super type. + template<> + struct set_super_type<B> + { + typedef A ret; + }; - struct B : public stc_get_supers(B) + struct B : public A { }; @@ -76,9 +80,12 @@ simple test, but it doesn't matter: we are only checking the super relationship here. */ - // Warning, this sugar might be removed in the future. /// Link to B (``pseudo'' inheritance). - stc_set_pseudosuper(C, B); + template<> + struct set_pseudosuper_type<C> + { + typedef B ret; + }; struct C // no inheritance { Index: tests/Makefile.am --- tests/Makefile.am (revision 709) +++ tests/Makefile.am (working copy) @@ -17,11 +17,9 @@ entry \ exact \ find_exact \ - multiple-supers \ super \ vtypes \ vtypes-and-exact \ - vtypes-multiple-supers \ \ tour @@ -29,12 +27,13 @@ entry_SOURCES = entry.cc exact_SOURCES = exact.cc find_exact_SOURCES = find_exact.cc -multiple_supers_SOURCES = multiple-supers.cc super_SOURCES = super.cc vtypes_SOURCES = vtypes.cc vtypes_and_exact_SOURCES = vtypes-and-exact.cc -vtypes_multiple_supers_SOURCES = vtypes-multiple-supers.cc tour_SOURCES = tour.cc +# Old tests. +EXTRA_DIST = multiple-supers.cc vtypes-multiple-supers.cc + TESTS = $(check_PROGRAMS) Index: tests/vtypes.cc --- tests/vtypes.cc (revision 709) +++ tests/vtypes.cc (working copy) @@ -36,11 +36,11 @@ // Helper macros. -#define my_type_of(FromType, Typedef) \ - typename my_type_of_(FromType, Typedef) +#define my_type_of_(FromType, Alias) \ + my::direct_type_of_<FromType, my::typedef_:: Alias##_type>::ret -#define my_type_of_(FromType, Typedef) \ - stc_type_of_(my, my::category::my_cat, FromType, Typedef) +#define my_type_of(FromType, Alias) \ + typename my_type_of_(FromType, Alias) // Namespace equipment. @@ -61,17 +61,6 @@ mlc_decl_typedef(zorg_type); - /*-----------. - | Category. | - `-----------*/ - - // We only use one category here. - namespace category - { - struct my_cat; - } - - /*----. | A. | `----*/ @@ -81,7 +70,7 @@ /// Types associated to my::A. template <> - struct vtypes_in_category<category::my_cat, my::A> + struct vtypes<my::A> { // A native type. typedef int foo_type; @@ -109,12 +98,16 @@ // Forward declaration. struct B; - // Warning, this sugar might be removed in the future. - stc_set_super(B, A); + // Set super type. + template<> + struct set_super_type<B> + { + typedef A ret; + }; /// Types associated to my::B. template <> - struct vtypes_in_category<category::my_cat, B> + struct vtypes<B> { // (foo is left untouched.) @@ -128,12 +121,12 @@ /// An extended type associated to my::B. template <> - struct ext_vtype_in_category<category::my_cat, B, typedef_::yin_type> + struct single_vtype<B, typedef_::yin_type> { typedef unsigned long ret; }; - struct B : public stc_get_supers(B) + struct B : public A { // Aliases. typedef my_type_of_(B, foo) foo_type; @@ -155,13 +148,16 @@ // from B's vtypes (see the specialization // types<category::my_cat, Z>). - // Warning, this sugar might be removed in the future. /// Link to B (``pseudo'' inheritance). - stc_set_pseudosuper(Z, B); + template<> + struct set_super_type<Z> + { + typedef B ret; + }; /// Types associated to my::Z. template <> - struct vtypes_in_category<category::my_cat, Z> + struct vtypes<Z> { // A type defined only here (and not in the super class). typedef double zorg_type; Index: stc/Makefile.am --- stc/Makefile.am (revision 709) +++ stc/Makefile.am (working copy) @@ -10,3 +10,6 @@ valist_aggregator.hh \ \ internal/extract_vtype_from_list.hh + +# Old code. +EXTRA_DIST = was.scoop.hh
18 years, 1 month
1
0
0
0
709: Add a specialization of level::fill for value-wise random accessible images.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Add a specialization of level::fill for value-wise random-accessible images. * tests/morphers/with_lut.cc (main): More static checking of the interface of an image with LUT. Test oln::level::fill on an image with LUT. * oln/level/fill.hh (level::fill(abstract:: mutable_image_being_value_wise_random_accessible<I>&)) (level::impl:: fill(abstract::mutable_image_being_value_wise_random_accessible<I>&)): New. * oln/core/typedefs.hh (oln_fwd_viter, oln_fwd_viter_) (oln_bkd_viter, oln_bkd_viter_, oln_viter, oln_viter_): New macros. * oln/core/gen/bkd_viter_lut.hh (bkd_viter_lut::bkd_viter_lut(const morpher::with_lut<Image, Lut>&)) * oln/core/gen/fwd_viter_lut.hh (fwd_viter_lut::fwd_viter_lut(const morpher::with_lut<Image, Lut>&)) New ctors. oln/core/gen/bkd_viter_lut.hh | 19 ++++++++++++++++++- oln/core/gen/fwd_viter_lut.hh | 21 +++++++++++++++++++-- oln/core/typedefs.hh | 14 +++++++++++++- oln/level/fill.hh | 26 ++++++++++++++++++++++++++ tests/morphers/with_lut.cc | 24 +++++++++++++++++------- 5 files changed, 93 insertions(+), 11 deletions(-) Index: tests/morphers/with_lut.cc --- tests/morphers/with_lut.cc (revision 708) +++ tests/morphers/with_lut.cc (working copy) @@ -114,7 +114,16 @@ add(1, white). add(2, c); + // Type of our image with look-up table. typedef oln::morpher::with_lut<image_t, lut_t> image_with_lut_t; + // Interface check. + mlc::assert_< + mlc_is_not_a_(image_with_lut_t, oln::abstract::mutable_image) + >::check(); + mlc::assert_< + mlc_is_a_(image_with_lut_t, + oln::abstract::mutable_image_being_value_wise_random_accessible) + >::check(); // FIXME: ``ima + lut'' doesn't work. Maybe a `using' statement is // required. image_with_lut_t ima_with_lut(ima, lut); @@ -149,14 +158,14 @@ // Check fwd_viter_lut. - oln_type_of_(image_with_lut_t, fwd_viter) fv(ima_with_lut.lut()); + oln_fwd_viter_(image_with_lut_t) fv(ima_with_lut); std::list<rgb8> fwd_values; std::cout << "values of lut (fwd) =" << std::endl; // Push the values to the *back* of the list. for_all (fv) fwd_values.push_back(fv); // Check bkd_viter_lut. - oln_type_of_(image_with_lut_t, bkd_viter) bv(ima_with_lut.lut()); + oln_bkd_viter_(image_with_lut_t) bv(ima_with_lut); std::list<rgb8> bkd_values; std::cout << "values of lut (bkd) =" << std::endl; // Push the values to the *front* of the list (i.e., in reverse order). @@ -166,9 +175,10 @@ assert (fwd_values == bkd_values); - // FIXME: To be enabled later, when oln::level::fill is specialized - // for abstract::mutable_image_being_value_wise_random_accessible. -#if 0 - oln::level::apply(ima_with_lut, fun); // 3 ops only !!! -#endif + // Test level::fill. + oln::debug::print(ima_with_lut); + std::cout << std::endl << std::endl; + // Three ops only! + oln::level::fill(ima_with_lut, blue); + oln::debug::print(ima_with_lut); } Index: oln/level/fill.hh --- oln/level/fill.hh (revision 708) +++ oln/level/fill.hh (working copy) @@ -32,6 +32,7 @@ # include <iostream> # include <oln/core/abstract/image.hh> +# include <oln/core/abstract/image/value_wise_accessibility/hierarchy.hh> # include <oln/core/abstract/iterator.hh> # include <oln/core/abstract/functions.hh> @@ -73,6 +74,11 @@ template <typename I, typename F> void fill(abstract::mutable_image<I>& input, const abstract::fun_p2v<F>& fun); + /// Fwd decl. + template <typename I> + void fill(abstract::mutable_image_being_value_wise_random_accessible<I>& input, + const oln_value(I)& value); + # ifndef OLN_INCLUDE_ONLY @@ -117,6 +123,18 @@ input(p) = fun.exact()(p); } + /// Version specialized for mutable images being value-wise + /// random accessible. + template <typename I> + void fill(abstract::mutable_image_being_value_wise_random_accessible<I>& input, + const oln_value(I)& value) + { + // FIXME: We should not need to call exact() here. + oln_viter(I) v(input.exact()); + for_all(v) + input.value(v) = value; + } + } // end of namespace oln::level::impl @@ -148,6 +166,14 @@ return impl::fill(input.exact(), fun); } + /// Facade. + template <typename I> + void fill(abstract::mutable_image_being_value_wise_random_accessible<I>& input, + const oln_value(I)& value) + { + return impl::fill(input.exact(), value); + } + # endif } // end of namespace oln::level Index: oln/core/typedefs.hh --- oln/core/typedefs.hh (revision 708) +++ oln/core/typedefs.hh (working copy) @@ -167,8 +167,9 @@ +/// Shortcuts formed such as "oln_something(T) means +/// oln_type_of(T, something)". /// \{ -/// Shortcuts formed such as "oln_something(T) means oln_type_of(T, something)". # define oln_dim(T) oln_type_of(T, dim) # define oln_dim_(T) oln_type_of_(T, dim) @@ -227,6 +228,14 @@ # define oln_bkd_niter(T) oln_type_of(T, bkd_niter) # define oln_bkd_niter_(T) oln_type_of_(T, bkd_niter) +# define oln_fwd_viter(T) oln_type_of(T, fwd_viter) +# define oln_fwd_viter_(T) oln_type_of_(T, fwd_viter) + +# define oln_bkd_viter(T) oln_type_of(T, bkd_viter) +# define oln_bkd_viter_(T) oln_type_of_(T, bkd_viter) + +/// Even shorter shortcuts. +/// \{ # define oln_piter(T) oln_type_of(T, fwd_piter) # define oln_piter_(T) oln_type_of_(T, fwd_piter) @@ -236,8 +245,11 @@ # define oln_niter(T) oln_type_of(T, fwd_niter) # define oln_niter_(T) oln_type_of_(T, fwd_niter) +# define oln_viter(T) oln_type_of(T, fwd_viter) +# define oln_viter_(T) oln_type_of_(T, fwd_viter) /// \} +/// \} // Fwd decls. Index: oln/core/gen/bkd_viter_lut.hh --- oln/core/gen/bkd_viter_lut.hh (revision 708) +++ oln/core/gen/bkd_viter_lut.hh (working copy) @@ -36,6 +36,9 @@ // Forward declaration. template <typename Lut> class bkd_viter_lut; + namespace morpher { + template <typename Image, typename Lut> struct with_lut; + } // end of namespace oln::morpher /// Super type declaration. @@ -74,8 +77,11 @@ typedef oln_type_of(self_t, value) value_type; public: - // Construct an uninitialized value iterator. + /// Construct a backward value iterator from a look-up table (LUT). bkd_viter_lut(const Lut& lut); + /// Construct a backward value iterator from an image having a LUT. + template <typename Image> + bkd_viter_lut(const morpher::with_lut<Image, Lut>& ima); /// Iterator manipulators. /// \{ @@ -116,6 +122,17 @@ this->invalidate(); } + template <typename Lut> + template <typename Image> + bkd_viter_lut<Lut>::bkd_viter_lut(const morpher::with_lut<Image, Lut>& ima) : + super_t(), + lut_(ima.lut()), + i_() + { + // Initialize underlying iterator (i.e., \a i_.) + this->invalidate(); + } + template <typename Exact> void bkd_viter_lut<Exact>::impl_start() Index: oln/core/gen/fwd_viter_lut.hh --- oln/core/gen/fwd_viter_lut.hh (revision 708) +++ oln/core/gen/fwd_viter_lut.hh (working copy) @@ -34,8 +34,11 @@ namespace oln { - // Forward declaration. + // Forward declarations. template <typename Lut> class fwd_viter_lut; + namespace morpher { + template <typename Image, typename Lut> struct with_lut; + } // end of namespace oln::morpher /// Super type declaration. @@ -74,8 +77,11 @@ typedef oln_type_of(self_t, value) value_type; public: - // Construct an uninitialized value iterator. + /// Construct a forward value iterator from a look-up table (LUT). fwd_viter_lut(const Lut& lut); + /// Construct a forward value iterator from an image having a LUT. + template <typename Image> + fwd_viter_lut(const morpher::with_lut<Image, Lut>& ima); /// Iterator manipulators. /// \{ @@ -116,6 +122,17 @@ this->invalidate(); } + template <typename Lut> + template <typename Image> + fwd_viter_lut<Lut>::fwd_viter_lut(const morpher::with_lut<Image, Lut>& ima) : + super_t(), + lut_(ima.lut()), + i_() + { + // Initialize underlying iterator (i.e., \a i_.) + this->invalidate(); + } + template <typename Exact> void fwd_viter_lut<Exact>::impl_start()
18 years, 1 month
1
0
0
0
708: Fix virtual types of oln::internal::point_nd and oln::internal::dpoint_nd.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Fix virtual types of oln::internal::point_nd and oln::internal::dpoint_nd. * oln/core/internal/point_nd.hh (oln::vtypes< internal::point_nd<E> >::vec_t) (oln::vtypes< internal::point_nd<E> >::psite_type): Remove typedefs. (oln::vtypes< internal::point_nd<E> >::vec_type): Fix typedef. * oln/core/internal/point_nd.hh (oln::vtypes< internal::point_nd<E> >::vec_t): Remove typedef. (oln::vtypes< internal::point_nd<E> >::vec_type): Fix typedef. dpoint_nd.hh | 4 +--- point_nd.hh | 7 +------ 2 files changed, 2 insertions(+), 9 deletions(-) Index: oln/core/internal/point_nd.hh --- oln/core/internal/point_nd.hh (revision 707) +++ oln/core/internal/point_nd.hh (working copy) @@ -74,13 +74,8 @@ private: typedef oln_dim(E) dim_t; typedef oln_coord(E) coord_t; - typedef xtd::vec<mlc_value(dim_t), coord_t> vec_t; public: - - typedef double psite_type; - - typedef typename vec_t::self_type vec_type; - // typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; + typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; }; Index: oln/core/internal/dpoint_nd.hh --- oln/core/internal/dpoint_nd.hh (revision 707) +++ oln/core/internal/dpoint_nd.hh (working copy) @@ -57,10 +57,8 @@ private: typedef oln_dim(E) dim_t; typedef oln_coord(E) coord_t; - typedef xtd::vec<mlc_value(dim_t), coord_t> vec_t; public: - typedef typename vec_t::self_type vec_type; - // typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; + typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; };
18 years, 1 month
1
0
0
0
707: Suppress most single_vtype and update.
by Thierry GERAUD
2006-11-14 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr> Now call simplified scoop macros. * oln/core/macros.hh (oln_deduce_direct_type_of_, oln_deduce_direct_type_of): Remove. (oln_check_type_of, oln_check_type_of_): Remove. (oln_check_direct_type_of, oln_check_direct_type_of_): Remove. (oln_deduce): New; shortcut to oln_deduce_type_of. Add missing shortcuts. * oln/core/typedefs.hh (oln_dim, oln_dim_): New. (oln_vec, oln_vec_): New. (oln_bbox, oln_bbox_): New. (include): Fix and add fwd decls. Move single_vtype definitions into vtypes structures. * oln/core/point_set_entry.hh: Update. (single_vtype): Move into... (vtypes): ...this. * oln/core/neighborhood_entry.hh: Likewise. * oln/core/topology_entry.hh: Likewise. * oln/core/image_entry.hh: Likewise. * oln/core/abstract/iterator_on_points.hh: Likewise. * oln/core/abstract/point.hh: Likewise. * oln/core/gen/topo_add_nbh.hh: Likewise. * oln/core/internal/topology_morpher.hh: Likewise. * oln/morpher/value_cast.hh: Likewise. * oln/morpher/two_way.hh: Likewise. * oln/morpher/thru_fun.hh: Likewise. * oln/morpher/slice.hh: Likewise. * oln/morpher/with_lut.hh: Likewise. * oln/morpher/count_rw.hh: Likewise. * oln/morpher/two_way_rw.hh: Likewise. * oln/morpher/stack.hh: Likewise. * oln/morpher/thru_mfun.hh: Likewise. * oln/morpher/stack_rw.hh: Likewise. * oln/morpher/internal/image_value_morpher.hh: Likewise. Prevent problems due to mutual recursion (thru inheritance and dependent types). * oln/core/abstract/image.hh (decl): Disable static checks. * oln/core/abstract/image/bbox/hierarchy.hh: Update. (decl): Disable static check. * oln/core/abstract/point_set.hh (~point_set): Fix code. (decl): Disable static check. * oln/core/gen/fwd_piter_bbox.hh: Update. Disable static check. * oln/core/gen/bkd_piter_bbox.hh: Update. Disable static check. For safety purpose. * oln/basics2d.hh (include): Move iterator_vtypes up. Decouple some files from specific code. * oln/core/automatic/image/mutable_image1d.hh (include): Remove dependency to specific point header. (tmp): Update. * oln/core/automatic/image/mutable_image2d.hh: Likewise. * oln/core/automatic/image/mutable_image3d.hh: Likewise. * oln/core/automatic/image/image1d.hh: Likewise. * oln/core/automatic/image/image2d.hh: Likewise. * oln/core/automatic/image/image3d.hh: Likewise. * oln/core/1d/dpoint1d.hh: Add fwd decls and/or aliases. (include): Remove aliases header. * oln/core/2d/dpoint2d.hh: Likewise. * oln/core/3d/dpoint3d.hh: Likewise. * oln/core/1d/point1d.hh: Add fwd decls and/or aliases. (include): Remove aliases header. * oln/core/2d/point2d.hh: Likewise. * oln/core/3d/point3d.hh: Likewise. * oln/core/1d/neighb1d.hh: Add alias. * oln/core/2d/neighb2d.hh: Likewise. * oln/core/3d/neighb3d.hh: Likewise. * tests/core/point2d.cc (include): Solve FIXME. (main): Change test. * tests/core/dpoint2d.cc: Likewise. Update. * tests/morphers/with_lut.cc: Cosmetics. * tests/core/image_entry.cc: Update. * oln/io/pnm.hh: Use shortcuts. (include): Update. * oln/core/abstract/point_set/point_set_having_bbox.hh: Update. * oln/core/gen/bkd_qiter_win.hh: Update. * oln/core/gen/grid.hh: Update. * oln/core/gen/bkd_viter_lut.hh: Update. * oln/core/gen/bbox_fwd_piter.hh: Update. * oln/core/gen/fwd_niter_neighb.hh: Update. * oln/core/gen/fwd_qiter_win.hh: Update. * oln/core/gen/bbox_bkd_piter.hh: Update. * oln/core/gen/bkd_niter_neighb.hh: Update. * oln/core/gen/fwd_viter_lut.hh: Update. * oln/core/internal/point_nd.hh: Update. (vtypes): New. * oln/core/internal/dpoint_nd.hh: Update. (vtypes): New. * oln/morpher/add_isubset.hh: Update. Remove dead code. * oln/morpher/identity.hh: Update. * oln/morpher/add_neighborhood.hh: Update. Index: tests/morphers/with_lut.cc =================================================================== --- tests/morphers/with_lut.cc (revision 705) +++ tests/morphers/with_lut.cc (working copy) @@ -144,6 +144,7 @@ oln::point2d p(1, 2); assert(ima_with_lut(p) == red); + assert(ima_with_lut.at(1, 2) == red); Index: tests/core/point2d.cc =================================================================== --- tests/core/point2d.cc (revision 705) +++ tests/core/point2d.cc (working copy) @@ -26,18 +26,15 @@ // Public License. #include <mlc/assert.hh> -#include <mlc/cmp.hh> -// FIXME: Don't include oln/basics2d.hh, which is too big. -// (Fix.) -#include <oln/basics2d.hh> +#include <mlc/is_a.hh> +#include <oln/core/2d/point2d.hh> int main() { - typedef oln::point2d_<int> point2d; - typedef oln:: stc_get_supers(point2d) point2d_super_type; + typedef oln::point2d_<int> point_t; mlc::assert_< - mlc_eq( point2d_super_type, oln::internal::point_nd< point2d > ) + mlc_is_a_( point_t, oln::internal::point_nd ) >::check(); } Index: tests/core/image_entry.cc =================================================================== --- tests/core/image_entry.cc (revision 705) +++ tests/core/image_entry.cc (working copy) @@ -44,9 +44,14 @@ namespace oln { - // Warning, this sugar might be removed in the future. - stc_set_super(my::image, oln::image_entry<my::image>); + template <> + struct set_super_type < my::image > + { + typedef image_entry< my::image > ret; + }; + + /// Virtual types associated to my::image. /// \{ template<> @@ -88,13 +93,13 @@ namespace my { // A very simple 2D image. - class image : public oln::get_super_types<my::image>::ret + class image : public oln::image_entry< my::image > { public: - typedef image self_type; + typedef image self_t; // Internal vtypes. - typedef oln_type_of_(self_type, grid) grid_t; - typedef oln_type_of_(self_type, value) value_t; + typedef oln_grid_(self_t) grid_t; + typedef oln_value_(self_t) value_t; // FIXME: Add missing typedefs. }; } // end of namespace my Index: tests/core/dpoint2d.cc =================================================================== --- tests/core/dpoint2d.cc (revision 705) +++ tests/core/dpoint2d.cc (working copy) @@ -28,20 +28,15 @@ /// Test oln::image_entry. #include <mlc/assert.hh> -#include <mlc/cmp.hh> -// // FIXME: Fix oln/basics2d.hh! -// #include <oln/core/2d/point2d.hh> -// namespace oln { template class point2d_<int>; } -// #include <oln/core/2d/dpoint2d.hh> +#include <mlc/is_a.hh> #include <oln/basics2d.hh> int main() { - typedef oln::dpoint2d_<int> dpoint2d; - typedef oln:: stc_get_supers(dpoint2d) dpoint2d_super_type; + typedef oln::dpoint2d_<int> dpoint_t; mlc::assert_< - mlc_eq( dpoint2d_super_type, oln::internal::dpoint_nd< dpoint2d > ) + mlc_is_a_( dpoint_t, oln::internal::dpoint_nd ) >::check(); } Index: oln/io/pnm.hh =================================================================== --- oln/io/pnm.hh (revision 705) +++ oln/io/pnm.hh (working copy) @@ -33,13 +33,7 @@ # include <fstream> # include <string> -# include <oln/core/abstract/iterator.hh> -# include <oln/core/gen/fwd_piter_bbox.hh> -# include <oln/core/gen/bkd_piter_bbox.hh> -# include <oln/core/iterator_vtypes.hh> -# include <oln/core/2d/aliases.hh> -# include <oln/core/2d/dpoint2d.hh> -# include <oln/core/2d/image2d.hh> +# include <oln/basics2d.hh> namespace oln { @@ -120,10 +114,10 @@ template <typename I> void load_pbm_raw(std::ifstream& file, I& ima) { - oln_type_of(I, coord) cols = 0; + oln_coord(I) cols = 0; unsigned bits = 0; unsigned char c = 0; - oln_type_of(I, fwd_piter) p(ima.topo()); + oln_fwd_piter(I) p(ima.topo()); for_all(p) { if (bits == 0) @@ -142,7 +136,7 @@ template <typename I> void load_pbm_ascii(std::ifstream& file, I& ima) { - oln_type_of(I, fwd_piter) p(ima.topo()); + oln_fwd_piter(I) p(ima.topo()); for_all(p) ima(p) = (file.get() == '0'); } @@ -152,10 +146,10 @@ template <typename I> void load_pnm_ascii(std::ifstream& file, I& ima) { - oln_type_of(I, fwd_piter) p(ima.topo()); + oln_fwd_piter(I) p(ima.topo()); for_all(p) { - oln_type_of(I, value) value; + oln_value(I) value; file >> value; ima(p) = value; // FIXME: Test alt code below. @@ -172,7 +166,7 @@ size_t len = ima.bbox().ncols(); for (int row = ima.pmin().row(); row <= ima.pmax().row(); ++row) file.read((char*)(ima.adr_at(row, col)), - len * sizeof(oln_type_of(I, value))); + len * sizeof(oln_value(I))); } Index: oln/core/typedefs.hh =================================================================== --- oln/core/typedefs.hh (revision 705) +++ oln/core/typedefs.hh (working copy) @@ -170,6 +170,15 @@ /// \{ /// Shortcuts formed such as "oln_something(T) means oln_type_of(T, something)". +# define oln_dim(T) oln_type_of(T, dim) +# define oln_dim_(T) oln_type_of_(T, dim) + +# define oln_vec(T) oln_type_of(T, vec) +# define oln_vec_(T) oln_type_of_(T, vec) + +# define oln_bbox(T) oln_type_of(T, bbox) +# define oln_bbox_(T) oln_type_of_(T, bbox) + # define oln_coord(T) oln_type_of(T, coord) # define oln_coord_(T) oln_type_of_(T, coord) @@ -231,7 +240,13 @@ -# include <oln/core/type_fun/plain.hh> +// Fwd decls. +namespace oln { + namespace type_fun { + template <typename T> struct plain; + template <typename Image, typename Value> struct ch_value; + } +} /// \{ Index: oln/core/macros.hh =================================================================== --- oln/core/macros.hh (revision 705) +++ oln/core/macros.hh (working copy) @@ -28,119 +28,34 @@ #ifndef OLN_CORE_MACROS_HH # define OLN_CORE_MACROS_HH -// --------------------- // -// Virtual type access. // -// --------------------- // -/// \def oln_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from the exact type of -/// an oln type \a OlnType whose category is not specified (version to be -/// used inside a template). -# define oln_type_of(OlnType, Alias) \ - stc_direct_type_of(oln, void, OlnType, Alias) -// FIXME: Remove direct_ above. +# include <oln/core/typedefs.hh> -/// FIXME: Temporary macro to be able to perform "oln_type_of(oln_type_of(A, B), C)". -# define oln_deduce_type_of(OlnType, Alias1, Alias2) \ -typename oln::direct_type_of_<void, \ - typename oln::direct_type_of_<void, OlnType, oln::typedef_::Alias1##_type >::ret, \ - oln::typedef_::Alias2##_type >::ret -// FIXME: Remove direct_ *twice* above. +# define oln_type_of_(OlnType, Alias) \ + oln::direct_type_of_<OlnType, oln::typedef_:: Alias##_type>::ret -# define oln_deduce_direct_type_of(OlnType, Alias1, Alias2) \ -typename oln::direct_type_of_<void, \ - typename oln::direct_type_of_<void, OlnType, oln::typedef_::Alias1##_type >::ret, \ - oln::typedef_::Alias2##_type >::ret +# define oln_type_of(OlnType, Alias) \ + typename oln_type_of_(OlnType, Alias) -/// \def oln_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from the exact type of -/// an oln type \a OlnType whose category is not specified (version to be -/// used outside a template). -# define oln_type_of_(OlnType, Alias) \ - stc_direct_type_of_(oln, void, OlnType, Alias) -// FIXME: Remove direct_ above. +# define oln_deduce_type_of(OlnType, Alias1, Alias2) \ +typename oln::direct_type_of_<typename oln::direct_type_of_<OlnType, oln::typedef_::Alias1##_type >::ret, \ + oln::typedef_::Alias2##_type >::ret -/// \def oln_direct_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from an oln type \a -/// OlnType directly, and whose category is not specified (version to -/// be used inside a template). -# define oln_direct_type_of(OlnType, Alias) \ - stc_direct_type_of(oln, void, OlnType, Alias) +# define oln_deduce(OlnType, Alias1, Alias2) \ + oln_deduce_type_of(OlnType, Alias1, Alias2) -/// \def oln_direct_type_of_(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from an oln type \a -/// OlnType directly, and whose category is not specified (version to -/// be used inside a template). -# define oln_direct_type_of_(OlnType, Alias) \ - stc_direct_type_of_(oln, void, OlnType, Alias) -// ------------------------------- // -// Virtual type check and access. // -// ------------------------------- // +#define oln_virtual_typedef(Typedef) \ + typedef oln_type_of(E, Typedef) Typedef -/* These macros are the same as the previous ones, but they use - stc_check_type_of{_,} (resp. stc_check_direct_type_of{_,}) instead of - stc_type_of{_,} (resp. stc_direct_type_of{_,}). */ -/// \def oln_check_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from the exact type of -/// an oln type \a OlnType whose category is not specified (version to be -/// used inside a template). -/// -/// If the virtual type is not found, raise a static error. -# define oln_check_type_of(OlnType, Alias) \ - stc_check_direct_type_of(oln, void, OlnType, Alias) -// FIXME: Remove direct_ above. +// FIXME: Rec? The macro below is to ensure that static checks are removed during "Rec" tests. +// #define oln_virtual_typedef(Typedef) typedef void Typedef -/// \def oln_check_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from the exact type of -/// an oln type \a OlnType whose category is not specified (version to be -/// used outside a template). -/// -/// If the virtual type is not found, raise a static error. -# define oln_check_type_of_(OlnType, Alias) \ - stc_check_direct_type_of_(oln, void, OlnType, Alias) -// FIXME: Remove direct_ above. - -/// \def oln_check_direct_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from an oln type \a -/// OlnType directly, and whose category is not specified (version to -/// be used inside a template). -/// -/// If the virtual type is not found, raise a static error. -# define oln_check_direct_type_of(OlnType, Alias) \ - stc_check_direct_type_of(oln, void, OlnType, Alias) - -/// \def oln_check_direct_type_of_(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from an oln type \a -/// OlnType directly, and whose category is not specified (version to -/// be used inside a template). -/// -/// If the virtual type is not found, raise a static error. -# define oln_check_direct_type_of_(OlnType, Alias) \ - stc_check_direct_type_of_(oln, void, OlnType, Alias) - - - -/// Declare the vtype \a Typedef in an abstract class (see sample code -/// for details). Warning: this macro assumes that the exact type -/// parameter is named 'E'. -#define oln_virtual_typedef(Typedef) \ - typedef stc_check_direct_type_of(oln, void, E, Typedef) Typedef - - #endif // ! OLN_CORE_MACROS_HH Index: oln/core/point_set_entry.hh =================================================================== --- oln/core/point_set_entry.hh (revision 705) +++ oln/core/point_set_entry.hh (working copy) @@ -35,29 +35,12 @@ namespace oln { + /// Fwd decl. + template <typename E> struct point_set_entry; - /// Entry class for point sets: point_set_entry<E> is an alias for - /// entry< abstract::point_set, E>. - template <typename E> - struct point_set_entry : public entry< abstract::point_set, E> - { - protected: - point_set_entry(); - }; - -# ifndef OLN_INCLUDE_ONLY - - template <typename E> - point_set_entry<E>::point_set_entry() - { - } - -# endif - - /// Virtual types associated to point_set_entry<E>. template <typename E> @@ -65,7 +48,6 @@ { typedef mlc::undefined point_type; - typedef mlc::undefined piter_type; typedef mlc::undefined fwd_piter_type; typedef mlc::undefined bkd_piter_type; @@ -73,40 +55,38 @@ typedef mlc::undefined is_random_accessible_type; typedef mlc::undefined has_known_size_type; typedef mlc::undefined is_connected_type; + + // final. + typedef oln_deduce(E, point, coord) coord_type; + typedef oln_deduce(E, point, grid) grid_type; + typedef oln_deduce(E, point, dim) dim_type; + typedef oln_fwd_piter(E) piter_type; }; - template <typename E> - struct single_vtype< point_set_entry<E>, typedef_::coord_type > - { - typedef oln_type_of(E, point) P; - typedef oln_type_of(P, coord) ret; - }; + /// Entry class for point sets: point_set_entry<E> is an alias for + /// entry< abstract::point_set, E>. template <typename E> - struct single_vtype< point_set_entry<E>, typedef_::grid_type > + struct point_set_entry : public entry< abstract::point_set, E> { - typedef oln_type_of(E, point) P; - typedef oln_type_of(P, grid) ret; + protected: + point_set_entry(); }; - template <typename E> - struct single_vtype< point_set_entry<E>, typedef_::dim_type > - { - typedef oln_type_of(E, point) P; - typedef oln_type_of(P, dim) ret; - }; +# ifndef OLN_INCLUDE_ONLY template <typename E> - struct single_vtype< point_set_entry<E>, typedef_::piter_type > + point_set_entry<E>::point_set_entry() { - typedef oln_type_of(E, fwd_piter) ret; - }; + } +# endif + } // end of namespace oln Index: oln/core/neighborhood_entry.hh =================================================================== --- oln/core/neighborhood_entry.hh (revision 705) +++ oln/core/neighborhood_entry.hh (working copy) @@ -36,7 +36,18 @@ namespace oln { + /// Fwd decl. + template <typename E> struct neighborhood_entry; + + /// Virtual types associated to neighborhood_entry<E>. + template <typename E> + struct vtypes< neighborhood_entry<E> > + { + typedef mlc::undefined grid_type; + }; + + /// Entry class for point sets: neighborhood_entry<E> is an alias for /// entry< abstract::neighborhood, E>. @@ -58,15 +69,6 @@ # endif - /// Virtual types associated to neighborhood_entry<E>. - - template <typename E> - struct vtypes< neighborhood_entry<E> > - { - typedef mlc::undefined grid_type; - }; - - } // end of namespace oln Index: oln/core/automatic/image/mutable_image2d.hh =================================================================== --- oln/core/automatic/image/mutable_image2d.hh (revision 705) +++ oln/core/automatic/image/mutable_image2d.hh (working copy) @@ -30,7 +30,6 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/2d/point2d.hh> namespace oln @@ -69,7 +68,7 @@ set_impl<abstract::mutable_image2d, tag, E> ::impl_at(const oln_coord(E)& row, const oln_coord(E)& col) { - point2d tmp(row, col); + oln_point(E) tmp(row, col); return this->exact().operator()(tmp); } Index: oln/core/automatic/image/mutable_image3d.hh =================================================================== --- oln/core/automatic/image/mutable_image3d.hh (revision 705) +++ oln/core/automatic/image/mutable_image3d.hh (working copy) @@ -30,7 +30,6 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/3d/point3d.hh> namespace oln @@ -72,7 +71,7 @@ const oln_coord(E)& row, const oln_coord(E)& col) { - point3d tmp(slice, row, col); + oln_point(E) tmp(slice, row, col); return this->exact().operator()(tmp); } Index: oln/core/automatic/image/image1d.hh =================================================================== --- oln/core/automatic/image/image1d.hh (revision 705) +++ oln/core/automatic/image/image1d.hh (working copy) @@ -30,11 +30,11 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/1d/point1d.hh> namespace oln { + // Forward declaration. namespace abstract { @@ -73,7 +73,7 @@ set_impl<abstract::image1d, tag, E> ::impl_at(const oln_coord(E)& index) const { - point1d tmp(index); + oln_point(E) tmp(index); return this->exact().operator()(tmp); } @@ -82,7 +82,7 @@ set_impl<abstract::image1d, tag, E> ::impl_has_at(const oln_coord(E)& index) const { - point1d tmp(index); + oln_point(E) tmp(index); return this->exact().has(tmp); } Index: oln/core/automatic/image/image2d.hh =================================================================== --- oln/core/automatic/image/image2d.hh (revision 705) +++ oln/core/automatic/image/image2d.hh (working copy) @@ -30,11 +30,11 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/2d/point2d.hh> namespace oln { + // Forward declaration. namespace abstract { @@ -74,7 +74,7 @@ set_impl<abstract::image2d, tag, E> ::impl_at(const oln_coord(E)& row, const oln_coord(E)& col) const { - point2d tmp(row, col); + oln_point(E) tmp(row, col); return this->exact().operator()(tmp); } @@ -83,7 +83,7 @@ set_impl<abstract::image2d, tag, E> ::impl_has_at(const oln_coord(E)& row, const oln_coord(E)& col) const { - point2d tmp(row, col); + oln_point(E) tmp(row, col); return this->exact().has(tmp); } Index: oln/core/automatic/image/image3d.hh =================================================================== --- oln/core/automatic/image/image3d.hh (revision 705) +++ oln/core/automatic/image/image3d.hh (working copy) @@ -30,11 +30,11 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/3d/point3d.hh> namespace oln { + // Forward declaration. namespace abstract { @@ -80,7 +80,7 @@ const oln_coord(E)& row, const oln_coord(E)& col) const { - point3d tmp(slice, row, col); + oln_point(E) tmp(slice, row, col); return this->exact().operator()(tmp); } @@ -91,7 +91,7 @@ const oln_coord(E)& row, const oln_coord(E)& col) const { - point3d tmp(slice, row, col); + oln_point(E) tmp(slice, row, col); return this->exact().has(tmp); } Index: oln/core/automatic/image/mutable_image1d.hh =================================================================== --- oln/core/automatic/image/mutable_image1d.hh (revision 705) +++ oln/core/automatic/image/mutable_image1d.hh (working copy) @@ -30,7 +30,6 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/1d/point1d.hh> namespace oln @@ -69,7 +68,7 @@ set_impl<abstract::mutable_image1d, tag, E> ::impl_at(const oln_coord(E)& index) { - point1d tmp(index); + oln_point(E) tmp(index); return this->exact().operator()(tmp); } Index: oln/core/topology_entry.hh =================================================================== --- oln/core/topology_entry.hh (revision 705) +++ oln/core/topology_entry.hh (working copy) @@ -35,7 +35,26 @@ namespace oln { + /// Fwd decl. + template <typename E> struct topology_entry; + + /// Virtual types associated to topology_entry<E>. + + template <typename E> + struct vtypes< topology_entry<E> > + { + typedef mlc::undefined point_type; + typedef mlc::undefined bbox_type; + typedef mlc::none neighborhood_type; + typedef mlc::undefined is_random_accessible_type; + typedef mlc::none subset_type; + + typedef mlc::none morpher_type; + }; + + + /// Entry class for point sets: topology_entry<E> is an alias for /// entry< abstract::topology, E>. @@ -57,25 +76,6 @@ # endif - /// Virtual types associated to topology_entry<E>. - - template <typename E> - struct vtypes< topology_entry<E> > - { - typedef mlc::undefined point_type; - typedef mlc::undefined bbox_type; - typedef mlc::none neighborhood_type; - typedef mlc::undefined is_random_accessible_type; - typedef mlc::none subset_type; - }; - - template <typename E> - struct single_vtype< topology_entry<E>, typedef_::morpher_type > - { - typedef mlc::none ret; - }; - - } // end of namespace oln Index: oln/core/image_entry.hh =================================================================== --- oln/core/image_entry.hh (revision 705) +++ oln/core/image_entry.hh (working copy) @@ -38,29 +38,11 @@ namespace oln { + /// Fwd decl. + template <typename E> struct image_entry; - /// Entry class for point sets: image_entry<E> is an alias for - /// entry< abstract::image, E>. - template <typename E> - struct image_entry : public entry<abstract::image, E> - { - protected: - image_entry(); - }; - -# ifndef OLN_INCLUDE_ONLY - - template <typename E> - image_entry<E>::image_entry() - { - } - -# endif - - - /// Virtual types associated to image_entry<E>. template <typename E> @@ -68,24 +50,24 @@ { typedef mlc::undefined topo_type; typedef mlc::undefined grid_type; - - // coord_type: see below. - - // psite_type: see below. typedef mlc::undefined point_type; - typedef mlc::undefined is_computed_type; - typedef mlc::undefined value_type; - // rvalue_type: see below. - // piter_type: see below. - // fwd_piter_type: see below. - // bkd_piter_type: see below. + typedef mlc::undefined fwd_piter_type; + typedef mlc::undefined bkd_piter_type; - // fwd_qiter_type: see below. - // bkd_qiter_type: see below. + typedef mlc::undefined fwd_qiter_type; + typedef mlc::undefined bkd_qiter_type; + // final definitions: + typedef oln_deduce(E, point, coord) coord_type; + typedef oln_fwd_piter(E) piter_type; + + // default definitions: + typedef oln_point(E) psite_type; + typedef oln_value(E) rvalue_type; + /// \brief Morpher type. /// /// Optionally contains a tag indicating a kind of morpher. @@ -93,70 +75,30 @@ }; - // Coord. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::coord_type > - { - typedef oln_deduce_type_of(E, point, coord) ret; - }; + /// Entry class for point sets: image_entry<E> is an alias for + /// entry< abstract::image, E>. - // Psite. template <typename E> - struct single_vtype< image_entry<E>, typedef_::psite_type > + struct image_entry : public entry<abstract::image, E> { - typedef oln_type_of(E, point) ret; + protected: + image_entry(); }; - // Rvalue. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::rvalue_type > - { - typedef oln_type_of(E, value) ret; - }; +# ifndef OLN_INCLUDE_ONLY - - /* FIXME: Should we keep the `piter' vtype, knowing that the macro - `oln_piter' gives the `fwd_piter' vtype (and not the `piter' - vtype)? */ - // Piter. template <typename E> - struct single_vtype< image_entry<E>, typedef_::piter_type > + image_entry<E>::image_entry() { - typedef oln_type_of(E, fwd_piter) ret; - }; + } - // Fwd piter. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::fwd_piter_type > - { - typedef mlc::undefined ret; - }; +# endif - // Bkd piter. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::bkd_piter_type > - { - typedef mlc::undefined ret; - }; - // Fwd qiter. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::fwd_qiter_type > - { - typedef mlc::undefined ret; - }; - // Bkd qiter. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::bkd_qiter_type > - { - typedef mlc::undefined ret; - }; - - } // end of namespace oln Index: oln/core/abstract/iterator_on_points.hh =================================================================== --- oln/core/abstract/iterator_on_points.hh (revision 705) +++ oln/core/abstract/iterator_on_points.hh (working copy) @@ -54,16 +54,10 @@ struct vtypes< abstract::iterator_on_points<E> > { typedef mlc::undefined point_type; + typedef oln_deduce(E, point, coord) coord_type; }; - template <typename E> - struct single_vtype< abstract::iterator_on_points<E>, typedef_::coord_type > - { - typedef oln_type_of(E, point) point_t; - typedef oln_type_of(point_t, coord) ret; - }; - namespace abstract { @@ -71,7 +65,7 @@ template <typename E> class iterator_on_points : public abstract::iterator<E> { - typedef oln_type_of(E, point) point_t; + typedef oln_point(E) point_t; public: Index: oln/core/abstract/image.hh =================================================================== --- oln/core/abstract/image.hh (revision 705) +++ oln/core/abstract/image.hh (working copy) @@ -78,8 +78,9 @@ oln_virtual_typedef(psite); oln_virtual_typedef(point); - oln_virtual_typedef(fwd_piter); - oln_virtual_typedef(bkd_piter); + // FIXME: Rec? +// oln_virtual_typedef(fwd_piter); +// oln_virtual_typedef(bkd_piter); oln_virtual_typedef(is_computed); oln_virtual_typedef(value); @@ -142,13 +143,14 @@ template <typename E> image<E>::decl::decl() { - mlc::assert_< mlc_is_a(topo, abstract::topology) >::check(); - mlc::assert_< mlc_is_a(grid, abstract::grid) >::check(); - mlc::assert_< mlc_is_a(point, abstract::point) >::check(); - mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check(); - mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check(); + // FIXME: Rec? +// mlc::assert_< mlc_is_a(topo, abstract::topology) >::check(); +// mlc::assert_< mlc_is_a(grid, abstract::grid) >::check(); +// mlc::assert_< mlc_is_a(point, abstract::point) >::check(); +// mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check(); +// mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check(); - // FIXME: Rec. + // FIXME: Rec? // mlc::assert_< mlc_is_a(plain, abstract::image) >::check(); } Index: oln/core/abstract/image/bbox/hierarchy.hh =================================================================== --- oln/core/abstract/image/bbox/hierarchy.hh (revision 705) +++ oln/core/abstract/image/bbox/hierarchy.hh (working copy) @@ -87,7 +87,8 @@ template <typename E> image_having_bbox<E>::decl::decl() { - mlc::assert_< mlc_is_a(bbox, abstract::bbox) >::check(); + // FIXME: Rec? + // mlc::assert_< mlc_is_a(bbox, abstract::bbox) >::check(); } template <typename E> @@ -134,7 +135,7 @@ /// With bbox. template <typename E> struct case_< image_hierarchy_wrt_bbox, E, 1 > : - where_< mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found > > + where_< mlc::neq_< oln_deduce(E, topo, bbox), mlc::not_found > > { typedef abstract::image_having_bbox<E> ret; }; @@ -142,14 +143,10 @@ template <typename E> struct image_entry; - template <typename E> struct single_vtype< image_entry<E>, typedef_::bbox_type > { - private: - typedef oln_type_of(E, topo) topo_t; - public: - typedef oln_type_of(topo_t, bbox) ret; + typedef oln_deduce(E, topo, bbox) ret; }; } // end of namespace oln Index: oln/core/abstract/point.hh =================================================================== --- oln/core/abstract/point.hh (revision 705) +++ oln/core/abstract/point.hh (working copy) @@ -61,17 +61,11 @@ { typedef mlc::undefined grid_type; typedef mlc::undefined dpoint_type; - typedef mlc::undefined coord_type; + typedef oln_deduce(E, dpoint, coord) coord_type; typedef mlc::undefined dim_type; - typedef mlc::undefined vec_type; - }; - template <typename E> - struct single_vtype< abstract::point<E>, typedef_::vec_type > - { - typedef oln_type_of(E, coord) coord_t; - typedef oln_type_of(E, dim) dim_t; - typedef xtd::vec<mlc_value(dim_t), coord_t> ret; + typedef oln_dim(E) dim_t; + typedef xtd::vec<mlc_value(dim_t), coord_type> vec_type; }; @@ -83,8 +77,8 @@ class point : public stc::any__simple<E>, public oln::type { - typedef oln_type_of(E, dpoint) dpoint_t; - typedef oln_type_of(E, vec) vec_t; + typedef oln_dpoint(E) dpoint_t; + typedef oln_vec(E) vec_t; public: Index: oln/core/abstract/point_set.hh =================================================================== --- oln/core/abstract/point_set.hh (revision 705) +++ oln/core/abstract/point_set.hh (working copy) @@ -68,9 +68,7 @@ decl(); }; - ~point_set() - { - } + ~point_set(); protected: @@ -91,10 +89,9 @@ point_set<E>::decl::decl() { // coherence check: - mlc::assert_equal_< oln_type_of(fwd_piter, grid), - oln_type_of(point, grid) >::check(); - mlc::assert_equal_< oln_type_of(bkd_piter, grid), - oln_type_of(point, grid) >::check(); + // FIXME: Rec? +// mlc::assert_equal_< oln_grid(fwd_piter), oln_grid(point) >::check(); +// mlc::assert_equal_< oln_grid(bkd_piter), oln_grid(point) >::check(); } template <typename E> @@ -102,11 +99,11 @@ { } -// template <typename E> -// point_set<E>::~point_set() -// { -// decl(); -// } + template <typename E> + point_set<E>::~point_set() + { + decl(); + } # endif Index: oln/core/abstract/point_set/point_set_having_bbox.hh =================================================================== --- oln/core/abstract/point_set/point_set_having_bbox.hh (revision 705) +++ oln/core/abstract/point_set/point_set_having_bbox.hh (working copy) @@ -41,11 +41,11 @@ template <typename E> class point_set_having_bbox : public virtual point_set<E> { - typedef oln_check_type_of(E, point) point_t; - typedef oln_check_type_of(E, bbox) bbox_t; + typedef oln_point(E) point_t; + typedef oln_bbox(E) bbox_t; - typedef oln_check_type_of(point_t, coord) coord_t; - typedef oln_check_type_of(point_t, dim) dim_t; + typedef oln_coord(point_t) coord_t; + typedef oln_dim(point_t) dim_t; enum { n = mlc_value(dim_t) }; public: Index: oln/core/1d/neighb1d.hh =================================================================== --- oln/core/1d/neighb1d.hh (revision 705) +++ oln/core/1d/neighb1d.hh (working copy) @@ -36,6 +36,9 @@ namespace oln { + typedef neighb_<dpoint1d> neighb1d; + + namespace internal { Index: oln/core/1d/dpoint1d.hh =================================================================== --- oln/core/1d/dpoint1d.hh (revision 705) +++ oln/core/1d/dpoint1d.hh (working copy) @@ -32,14 +32,21 @@ # include <mlc/int.hh> # include <oln/core/1d/point1d.hh> # include <oln/core/internal/dpoint_nd.hh> -// For oln::dpoint1d and oln::dpoint1df. -# include <oln/core/1d/aliases.hh> namespace oln { + typedef dpoint1d_<int> dpoint1d; + + /// Fwd decls. + template <unsigned D> struct grid_; + typedef grid_<1> grid1d; + template <typename C> struct point1d_; + typedef point1d_<int> point1d; + + /// Super type. template<typename C> struct set_super_type< dpoint1d_<C> > @@ -64,10 +71,10 @@ /// General 1D dpoint class. template <typename C> class dpoint1d_ - : public stc_get_supers(dpoint1d_<C>) + : public internal::dpoint_nd< dpoint1d_<C> > { typedef dpoint1d_<C> self_t; - typedef stc_get_super(dpoint1d_<C>) super_t; + typedef internal::dpoint_nd<self_t> super_t; using super_t::v_; Index: oln/core/1d/point1d.hh =================================================================== --- oln/core/1d/point1d.hh (revision 705) +++ oln/core/1d/point1d.hh (working copy) @@ -31,13 +31,23 @@ # include <mlc/int.hh> # include <oln/core/internal/point_nd.hh> -// For oln::point1d and oln::point1df. -# include <oln/core/1d/aliases.hh> namespace oln { + /// Fwd decls. + template <unsigned D> struct grid_; + template <typename C> struct dpoint1d_; + template <typename C> struct point1d_; + + + typedef grid_<1> grid1d; + typedef dpoint1d_<int> dpoint1d; + typedef point1d_<int> point1d; + + + /* FIXME: Is this the right place for these functions (on types)? In particular, the function on dpoint1d should be near the definition of dpoint1d, not point1d's. */ @@ -49,6 +59,7 @@ /// \} + /// Super type. template<typename C> struct set_super_type< point1d_<C> > @@ -72,10 +83,10 @@ /// General 1D point class. template <typename C> - class point1d_ : public stc_get_supers(point1d_<C>) + class point1d_ : public internal::point_nd< point1d_<C> > { typedef point1d_<C> self_t; - typedef stc_get_super(point1d_<C>) super_t; + typedef internal::point_nd<self_t> super_t; using super_t::v_; Index: oln/core/2d/neighb2d.hh =================================================================== --- oln/core/2d/neighb2d.hh (revision 705) +++ oln/core/2d/neighb2d.hh (working copy) @@ -36,6 +36,8 @@ namespace oln { + typedef neighb_<dpoint2d> neighb2d; + namespace internal { Index: oln/core/2d/dpoint2d.hh =================================================================== --- oln/core/2d/dpoint2d.hh (revision 705) +++ oln/core/2d/dpoint2d.hh (working copy) @@ -32,14 +32,14 @@ # include <mlc/int.hh> # include <oln/core/2d/point2d.hh> # include <oln/core/internal/dpoint_nd.hh> -// For oln::dpoint2d and oln::dpoint2df. -# include <oln/core/2d/aliases.hh> namespace oln { + typedef dpoint2d_<int> dpoint2d; + /// Super type. template<typename C> struct set_super_type< dpoint2d_<C> > @@ -48,6 +48,13 @@ }; + /// Fwd decls. + template <unsigned D> struct grid_; + typedef grid_<2> grid2d; + template <typename C> struct point2d_; + typedef point2d_<int> point2d; + + /// Virtual types associated to oln::dpoint2d_<C>. template <typename C> struct vtypes< dpoint2d_<C> > @@ -65,10 +72,10 @@ /// General 2D dpoint class. template <typename C> class dpoint2d_ - : public stc_get_supers(dpoint2d_<C>) + : public internal::dpoint_nd< dpoint2d_<C> > { typedef dpoint2d_<C> self_t; - typedef stc_get_super(dpoint2d_<C>) super_t; + typedef internal::dpoint_nd<self_t> super_t; using super_t::v_; Index: oln/core/2d/point2d.hh =================================================================== --- oln/core/2d/point2d.hh (revision 705) +++ oln/core/2d/point2d.hh (working copy) @@ -31,13 +31,23 @@ # include <mlc/int.hh> # include <oln/core/internal/point_nd.hh> -// For oln::point2d and oln::point2df. -# include <oln/core/2d/aliases.hh> namespace oln { + + /// Fwd decls. + template <unsigned D> struct grid_; + template <typename C> struct dpoint2d_; + template <typename C> struct point2d_; + + + typedef grid_<2> grid2d; + typedef dpoint2d_<int> dpoint2d; + typedef point2d_<int> point2d; + + /* FIXME: Is this the right place for these functions (on types)? In particular, the function on dpoint2d should be near the definition of dpoint2d, not point2d's. */ @@ -49,6 +59,7 @@ /// \} + /// Super type. template<typename C> struct set_super_type< point2d_<C> > @@ -73,10 +84,10 @@ /// General 2D point class. template <typename C> - class point2d_ : public stc_get_supers(point2d_<C>) + class point2d_ : public internal::point_nd< point2d_<C> > { - typedef point2d_<C> self_t; - typedef stc_get_super(point2d_<C>) super_t; + typedef point2d_<C> self_t; + typedef internal::point_nd<self_t> super_t; using super_t::v_; Index: oln/core/3d/neighb3d.hh =================================================================== --- oln/core/3d/neighb3d.hh (revision 705) +++ oln/core/3d/neighb3d.hh (working copy) @@ -36,6 +36,9 @@ namespace oln { + typedef neighb_<dpoint3d> neighb3d; + + namespace internal { Index: oln/core/3d/dpoint3d.hh =================================================================== --- oln/core/3d/dpoint3d.hh (revision 705) +++ oln/core/3d/dpoint3d.hh (working copy) @@ -32,13 +32,13 @@ # include <mlc/int.hh> # include <oln/core/3d/point3d.hh> # include <oln/core/internal/dpoint_nd.hh> -// For oln::dpoint3d and oln::dpoint3df. -# include <oln/core/3d/aliases.hh> namespace oln { + typedef dpoint3d_<int> dpoint3d; + /// Super type. template<typename C> @@ -48,6 +48,13 @@ }; + /// Fwd decls. + template <unsigned D> struct grid_; + typedef grid_<3> grid3d; + template <typename C> struct point3d_; + typedef point3d_<int> point3d; + + /// Virtual types associated to oln::dpoint3d_<C>. template <typename C> struct vtypes< dpoint3d_<C> > @@ -66,10 +73,10 @@ /// General 3D dpoint class. template <typename C> class dpoint3d_ - : public stc_get_supers(dpoint3d_<C>) + : public internal::dpoint_nd< dpoint3d_<C> > { typedef dpoint3d_<C> self_t; - typedef stc_get_super(dpoint3d_<C>) super_t; + typedef internal::dpoint_nd<self_t> super_t; using super_t::v_; Index: oln/core/3d/point3d.hh =================================================================== --- oln/core/3d/point3d.hh (revision 705) +++ oln/core/3d/point3d.hh (working copy) @@ -31,13 +31,22 @@ # include <mlc/int.hh> # include <oln/core/internal/point_nd.hh> -// For oln::point3d and oln::point3df. -# include <oln/core/3d/aliases.hh> namespace oln { + /// Fwd decls. + template <unsigned D> struct grid_; + template <typename C> struct dpoint3d_; + template <typename C> struct point3d_; + + + typedef grid_<3> grid3d; + typedef dpoint3d_<int> dpoint3d; + typedef point3d_<int> point3d; + + /* FIXME: Is this the right place for these functions (on types)? In particular, the function on dpoint3d should be near the definition of dpoint3d, not point3d's. */ @@ -49,6 +58,7 @@ /// \} + /// Super type. template<typename C> struct set_super_type< point3d_<C> > @@ -74,10 +84,10 @@ /// General 3D point class. template <typename C> - class point3d_ : public stc_get_supers(point3d_<C>) + class point3d_ : public internal::point_nd< point3d_<C> > { - typedef point3d_<C> self_t; - typedef stc_get_super(point3d_<C>) super_t; + typedef point3d_<C> self_t; + typedef internal::point_nd<self_t> super_t; using super_t::v_; Index: oln/core/gen/bkd_qiter_win.hh =================================================================== --- oln/core/gen/bkd_qiter_win.hh (revision 705) +++ oln/core/gen/bkd_qiter_win.hh (working copy) @@ -55,7 +55,7 @@ struct vtypes< bkd_qiter_win_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; @@ -67,7 +67,7 @@ typedef bkd_qiter_win_<point_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(point_t, dpoint) dpoint_t; + typedef oln_dpoint(point_t) dpoint_t; public: Index: oln/core/gen/grid.hh =================================================================== --- oln/core/gen/grid.hh (revision 705) +++ oln/core/gen/grid.hh (working copy) @@ -56,7 +56,7 @@ /// A 1D grid. template <unsigned D> - struct grid_ : public stc_get_supers(grid_<D>) + struct grid_ : public abstract::grid< grid_<D> > { protected: grid_() {} Index: oln/core/gen/bkd_viter_lut.hh =================================================================== --- oln/core/gen/bkd_viter_lut.hh (revision 705) +++ oln/core/gen/bkd_viter_lut.hh (working copy) @@ -61,12 +61,12 @@ /// Backward value iterator on look-up table. template <typename Lut> class bkd_viter_lut : - public stc_get_supers(bkd_viter_lut<Lut>) + public abstract::iterator_on_values< bkd_viter_lut<Lut> > // Check that Lut is a look-up table. // FIXME: an abstract::lookup_table would be useful. { - typedef bkd_viter_lut<Lut> self_t; - typedef stc_get_super(self_t) super_t; + typedef bkd_viter_lut<Lut> self_t; + typedef abstract::iterator_on_values<self_t> super_t; typedef oln_type_of(self_t, lut_iter) lut_iter_t; public: Index: oln/core/gen/bbox_fwd_piter.hh =================================================================== --- oln/core/gen/bbox_fwd_piter.hh (revision 705) +++ oln/core/gen/bbox_fwd_piter.hh (working copy) @@ -54,7 +54,7 @@ struct vtypes< bbox_fwd_piter_<point> > { typedef point point_type; - typedef oln_type_of(point, grid) grid_type; + typedef oln_grid(point) grid_type; }; Index: oln/core/gen/fwd_piter_bbox.hh =================================================================== --- oln/core/gen/fwd_piter_bbox.hh (revision 705) +++ oln/core/gen/fwd_piter_bbox.hh (working copy) @@ -56,15 +56,16 @@ struct vtypes< fwd_piter_bbox_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; /// Abstract forward point iterator class. template <typename point_t> - class fwd_piter_bbox_ : public internal::bbox_fwd_piter< fwd_piter_bbox_<point_t> >, - private mlc::assert_< mlc_is_a(point_t, abstract::point) > + class fwd_piter_bbox_ : public internal::bbox_fwd_piter< fwd_piter_bbox_<point_t> > + // FIXME: Rec? +// , private mlc::assert_< mlc_is_a(point_t, abstract::point) > { typedef fwd_piter_bbox_<point_t> self_t; typedef internal::bbox_fwd_piter<self_t> super_t; Index: oln/core/gen/fwd_niter_neighb.hh =================================================================== --- oln/core/gen/fwd_niter_neighb.hh (revision 705) +++ oln/core/gen/fwd_niter_neighb.hh (working copy) @@ -55,7 +55,7 @@ struct vtypes< fwd_niter_neighb_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; @@ -67,7 +67,7 @@ typedef fwd_niter_neighb_<point_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(point_t, dpoint) dpoint_t; + typedef oln_dpoint(point_t) dpoint_t; public: Index: oln/core/gen/fwd_qiter_win.hh =================================================================== --- oln/core/gen/fwd_qiter_win.hh (revision 705) +++ oln/core/gen/fwd_qiter_win.hh (working copy) @@ -55,7 +55,7 @@ struct vtypes< fwd_qiter_win_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; @@ -67,7 +67,7 @@ typedef fwd_qiter_win_<point_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(point_t, dpoint) dpoint_t; + typedef oln_dpoint(point_t) dpoint_t; public: Index: oln/core/gen/bbox_bkd_piter.hh =================================================================== --- oln/core/gen/bbox_bkd_piter.hh (revision 705) +++ oln/core/gen/bbox_bkd_piter.hh (working copy) @@ -54,7 +54,7 @@ struct vtypes< bbox_bkd_piter_<point> > { typedef point point_type; - typedef oln_type_of(point, grid) grid_type; + typedef oln_grid(point) grid_type; }; Index: oln/core/gen/bkd_piter_bbox.hh =================================================================== --- oln/core/gen/bkd_piter_bbox.hh (revision 705) +++ oln/core/gen/bkd_piter_bbox.hh (working copy) @@ -56,15 +56,16 @@ struct vtypes< bkd_piter_bbox_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; /// Abstract forward point iterator class. template <typename point_t> - class bkd_piter_bbox_ : public internal::bbox_bkd_piter< bkd_piter_bbox_<point_t> >, - private mlc::assert_< mlc_is_a(point_t, abstract::point) > + class bkd_piter_bbox_ : public internal::bbox_bkd_piter< bkd_piter_bbox_<point_t> > + // FIXME: Rec? +// , private mlc::assert_< mlc_is_a(point_t, abstract::point) > { typedef bkd_piter_bbox_<point_t> self_t; typedef internal::bbox_bkd_piter<self_t> super_t; Index: oln/core/gen/bkd_niter_neighb.hh =================================================================== --- oln/core/gen/bkd_niter_neighb.hh (revision 705) +++ oln/core/gen/bkd_niter_neighb.hh (working copy) @@ -55,7 +55,7 @@ struct vtypes< bkd_niter_neighb_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; @@ -67,7 +67,7 @@ typedef bkd_niter_neighb_<point_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(point_t, dpoint) dpoint_t; + typedef oln_dpoint(point_t) dpoint_t; public: Index: oln/core/gen/fwd_viter_lut.hh =================================================================== --- oln/core/gen/fwd_viter_lut.hh (revision 705) +++ oln/core/gen/fwd_viter_lut.hh (working copy) @@ -61,12 +61,12 @@ /// Forward value iterator on look-up table. template <typename Lut> class fwd_viter_lut : - public stc_get_supers(fwd_viter_lut<Lut>) + public abstract::iterator_on_values< fwd_viter_lut<Lut> > // Check that Lut is a look-up table. // FIXME: an abstract::lookup_table would be useful. { - typedef fwd_viter_lut<Lut> self_t; - typedef stc_get_super(self_t) super_t; + typedef fwd_viter_lut<Lut> self_t; + typedef abstract::iterator_on_values<self_t> super_t; typedef oln_type_of(self_t, lut_iter) lut_iter_t; public: Index: oln/core/gen/topo_add_nbh.hh =================================================================== --- oln/core/gen/topo_add_nbh.hh (revision 705) +++ oln/core/gen/topo_add_nbh.hh (working copy) @@ -54,15 +54,10 @@ struct vtypes< topo_add_nbh<topo, nbh> > { typedef nbh neighborhood_type; + typedef topo delegated_type; }; - template <typename topo, typename nbh> - struct single_vtype< topo_add_nbh<topo, nbh>, typedef_::delegated_type > - { - typedef topo ret; - }; - /// Bounding box topology based on a point class. template <typename topo_t, typename nbh_t> class topo_add_nbh : public internal::topology_morpher<topo_t, topo_add_nbh<topo_t, nbh_t> > Index: oln/core/internal/topology_morpher.hh =================================================================== --- oln/core/internal/topology_morpher.hh (revision 705) +++ oln/core/internal/topology_morpher.hh (working copy) @@ -49,18 +49,13 @@ }; template <typename Topo, typename E> - struct single_vtype< internal::topology_morpher<Topo, E>, typedef_::morpher_type > + struct vtypes< internal::topology_morpher<Topo, E> > { - typedef morpher::tag::identity ret; + typedef morpher::tag::identity morpher_type; + typedef Topo delegated_type; }; - template <typename Topo, typename E> - struct single_vtype< internal::topology_morpher<Topo, E>, typedef_::delegated_type > - { - typedef Topo ret; - }; - namespace internal { Index: oln/core/internal/point_nd.hh =================================================================== --- oln/core/internal/point_nd.hh (revision 705) +++ oln/core/internal/point_nd.hh (working copy) @@ -68,6 +68,22 @@ }; + template <typename E> + struct vtypes< internal::point_nd<E> > + { + private: + typedef oln_dim(E) dim_t; + typedef oln_coord(E) coord_t; + typedef xtd::vec<mlc_value(dim_t), coord_t> vec_t; + public: + + typedef double psite_type; + + typedef typename vec_t::self_type vec_type; + // typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; + }; + + namespace internal { @@ -75,14 +91,14 @@ class point_nd : public abstract::point<E> { typedef point_nd<E> self_t; - typedef oln_type_of(E, dim) dim; - typedef oln_type_of(E, coord) coord_t; - typedef oln_type_of(E, dpoint) dpoint_t; - typedef oln_type_of(E, vec) vec_t; + typedef oln_dim(E) dim_t; + typedef oln_coord(E) coord_t; + typedef oln_dpoint(E) dpoint_t; + typedef xtd::vec< mlc_value(dim_t), coord_t> vec_t; public: - enum { n = mlc_value(dim) }; + enum { n = mlc_value(dim_t) }; coord_t operator[](unsigned i) const; coord_t& operator[](unsigned i); Index: oln/core/internal/dpoint_nd.hh =================================================================== --- oln/core/internal/dpoint_nd.hh (revision 705) +++ oln/core/internal/dpoint_nd.hh (working copy) @@ -51,6 +51,19 @@ }; + template <typename E> + struct vtypes< internal::dpoint_nd<E> > + { + private: + typedef oln_dim(E) dim_t; + typedef oln_coord(E) coord_t; + typedef xtd::vec<mlc_value(dim_t), coord_t> vec_t; + public: + typedef typename vec_t::self_type vec_type; + // typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; + }; + + namespace internal { @@ -59,13 +72,13 @@ { typedef E exact_t; typedef dpoint_nd<E> self_t; - typedef oln_type_of(E, dim) dim; - typedef oln_type_of(E, coord) coord_t; + typedef oln_dim(E) dim_t; + typedef oln_coord(E) coord_t; + typedef xtd::vec< mlc_value(dim_t), coord_t> vec_t; public: - enum { n = mlc_value(dim) }; - typedef xtd::vec<n,coord_t> vec_t; + enum { n = mlc_value(dim_t) }; bool impl_equal(const dpoint_nd<E>& rhs) const; Index: oln/basics2d.hh =================================================================== --- oln/basics2d.hh (revision 705) +++ oln/basics2d.hh (working copy) @@ -46,6 +46,8 @@ # include <oln/core/2d/topo2d.hh> +# include <oln/core/iterator_vtypes.hh> + # include <oln/core/gen/fwd_piter_bbox.hh> # include <oln/core/gen/bkd_piter_bbox.hh> @@ -58,8 +60,6 @@ # include <oln/core/2d/image2d.hh> -# include <oln/core/iterator_vtypes.hh> - # include <oln/core/spe/row.hh> # include <oln/core/spe/col.hh> Index: oln/morpher/add_isubset.hh =================================================================== --- oln/morpher/add_isubset.hh (revision 705) +++ oln/morpher/add_isubset.hh (working copy) @@ -61,37 +61,13 @@ struct vtypes< morpher::add_isubset<Image, Isubset> > { // Topology type. - typedef topo_add_isubset< oln_type_of(Image, topo), Isubset > topo_type; + typedef topo_add_isubset< oln_topo(Image), Isubset > topo_type; // Isubset type. typedef Isubset subset_type; }; -// template <typename Image, typename Isubset> -// struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::fwd_niter_type > -// { -// private: -// typedef oln_type_of(Image, fwd_niter) basic_fwd_niter_type; -// typedef topo_add_isubset< oln_type_of(Image, topo), Isubset > new_topo_type; -// typedef typename basic_fwd_niter_type::template change_topology_<new_topo_type>::ret intra_fwd_niter_type; -// public: -// typedef piter_isubset_<intra_fwd_niter_type, Isubset> ret; -// }; - - -// template <typename Image, typename Isubset> -// struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::bkd_niter_type > -// { -// private: -// typedef oln_type_of(Image, bkd_niter) basic_bkd_niter_type; -// typedef topo_add_isubset< oln_type_of(Image, topo), Isubset > new_topo_type; -// typedef typename basic_bkd_niter_type::template change_topology_<new_topo_type>::ret intra_bkd_niter_type; -// public: -// typedef piter_isubset_<intra_bkd_niter_type, Isubset> ret; -// }; - - namespace morpher { /// Isubset addition morpher. @@ -103,8 +79,8 @@ private: typedef add_isubset<Image, Isubset> self_t; - typedef stc_get_nth_super(self_t, 1) super_t; - typedef oln_direct_type_of(self_t, topo) topo_t; + typedef internal::image_extension<Image, self_t> super_t; + typedef oln_topo(self_t) topo_t; // FIXME: use of oln_direct_type_of here!!! otherwise we get some compilation trouble... public: Index: oln/morpher/value_cast.hh =================================================================== --- oln/morpher/value_cast.hh (revision 705) +++ oln/morpher/value_cast.hh (working copy) @@ -59,12 +59,8 @@ { typedef mlc::true_ is_computed_type; typedef Value value_type; - }; - template <typename Image, typename Value> - struct single_vtype< morpher::value_cast<Image, Value>, typedef_::rvalue_type > - { - typedef Value ret; + typedef Value rvalue_type; }; Index: oln/morpher/two_way.hh =================================================================== --- oln/morpher/two_way.hh (revision 705) +++ oln/morpher/two_way.hh (working copy) @@ -61,12 +61,8 @@ typedef typename Fun::result_type value_type; typedef value::two_way<Image, Fun> lvalue_type; - }; - template <typename Image, typename Fun> - struct single_vtype< morpher::two_way<Image, Fun>, typedef_::rvalue_type > - { - typedef typename Fun::result_type ret; + typedef typename Fun::result_type rvalue_type; }; Index: oln/morpher/identity.hh =================================================================== --- oln/morpher/identity.hh (revision 705) +++ oln/morpher/identity.hh (working copy) @@ -55,11 +55,11 @@ { /// Identity morpher. template <typename Image> - class identity : public stc_get_supers(identity<Image>) + class identity : public internal::image_extension<Image, identity<Image> > { private: typedef identity<Image> self_t; - typedef stc_get_nth_super(self_t, 1) super_t; + typedef internal::image_extension<Image, self_t> super_t; public: // FIXME: Handle the constness. Index: oln/morpher/thru_fun.hh =================================================================== --- oln/morpher/thru_fun.hh (revision 705) +++ oln/morpher/thru_fun.hh (working copy) @@ -60,19 +60,13 @@ { private: typedef oln_type_of(Image, rvalue) old_value_type; + typedef morpher::thru_fun<Image, Fun> self_t; public: typedef mlc::true_ is_computed_type; typedef xtd_res_1(Fun, old_value_type) value_type; - }; - - template <typename Image, typename Fun> - struct single_vtype< morpher::thru_fun<Image, Fun>, typedef_::rvalue_type > - { - typedef morpher::thru_fun<Image, Fun> self_t; - typedef oln_value(self_t) ret; + typedef oln_value(self_t) rvalue_type; }; - namespace morpher Index: oln/morpher/slice.hh =================================================================== --- oln/morpher/slice.hh (revision 705) +++ oln/morpher/slice.hh (working copy) @@ -67,9 +67,16 @@ struct vtypes< morpher::slice<Image> > { private: + typedef morpher::slice<Image> self_t; + typedef oln_deduce_type_of(Image, grid, dimvalue) orig_dimvalue_type; typedef mlc::uint_< mlc_value(orig_dimvalue_type) - 1 > dimvalue_type; + typedef oln_type_of(Image, fwd_piter) orig_fwd_piter; + typedef oln_type_of(Image, bkd_piter) orig_bkd_piter; + typedef oln_type_of(Image, fwd_qiter) orig_fwd_qiter; + typedef oln_type_of(Image, bkd_qiter) orig_bkd_qiter; + public: typedef typename type_fun::slice_topo< oln_type_of(Image, topo) >::ret topo_type; @@ -84,7 +91,7 @@ // piter_type: see below. - typedef oln_type_of(Image, value) value_type; + typedef oln_value(Image) value_type; // rvalue_type: see below. // lvalue_type: see below. @@ -96,106 +103,27 @@ typedef oln::morpher::tag::slice morpher_type; - }; + // Final. + typedef oln_deduce(Image, point, coord) coord_type; + typedef oln_point(self_t) psite_type; + typedef oln_fwd_piter(Image) piter_type; + typedef oln_rvalue(Image) rvalue_type; + typedef oln_lvalue(Image) lvalue_type; - // Coord. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::coord_type > - { - typedef oln_deduce_type_of(Image, point, coord) ret; + typedef typename type_fun::slice_iterator<orig_fwd_piter>::ret fwd_piter_type; + typedef typename type_fun::slice_iterator<orig_bkd_piter>::ret bkd_piter_type; + typedef typename type_fun::slice_iterator<orig_fwd_qiter>::ret fwd_qiter_type; + typedef typename type_fun::slice_iterator<orig_bkd_qiter>::ret bkd_qiter_type; + // FIXME: What about niters on morpher::slice? }; - // Psite. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::psite_type > - { - private: - typedef morpher::slice<Image> self_t; - public: - typedef oln_type_of(self_t, point) ret; - }; - /* FIXME: Should we keep the `piter' vtype, knowing that the macro - `oln_piter' gives the `fwd_piter' vtype (and not the `piter' - vtype)? */ - // Piter. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::piter_type > - { - typedef oln_type_of(Image, fwd_piter) ret; - }; - // Rvalue. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::rvalue_type > - { - typedef oln_type_of(Image, rvalue) ret; - }; - - // Lvalue. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::lvalue_type > - { - typedef oln_type_of(Image, lvalue) ret; - }; - /// \} - - - // piters. - - /// fwd_piter vtype of morpher::slice. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::fwd_piter_type > - { - private: - typedef oln_type_of(Image, fwd_piter) orig_fwd_piter; - public: - typedef typename type_fun::slice_iterator<orig_fwd_piter>::ret ret; - }; - - /// bkd_piter vtype of morpher::slice. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::bkd_piter_type > - { - private: - typedef oln_type_of(Image, bkd_piter) orig_bkd_piter; - public: - typedef typename type_fun::slice_iterator<orig_bkd_piter>::ret ret; - }; - - - // qiters. - - /// fwd_qiter vtype of morpher::slice. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::fwd_qiter_type > - { - private: - typedef oln_type_of(Image, fwd_qiter) orig_fwd_qiter; - public: - typedef typename type_fun::slice_iterator<orig_fwd_qiter>::ret ret; - }; - - /// bkd_qiter vtype of morpher::slice. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::bkd_qiter_type > - { - private: - typedef oln_type_of(Image, bkd_qiter) orig_bkd_qiter; - public: - typedef typename type_fun::slice_iterator<orig_bkd_qiter>::ret ret; - }; - - - // FIXME: What about niters on morpher::slice? - - - namespace morpher { template <typename Image> - class slice : public stc_get_supers(slice<Image>) + class slice : public image_entry< slice<Image> > { typedef slice<Image> self_t; Index: oln/morpher/with_lut.hh =================================================================== --- oln/morpher/with_lut.hh (revision 705) +++ oln/morpher/with_lut.hh (working copy) @@ -61,14 +61,18 @@ { private: typedef oln_type_of(Image, rvalue) orig_value_type; + typedef morpher::with_lut<Image, Lut> self_t; public: typedef mlc::true_ is_computed_type; + // Value type. - typedef typename Lut::new_value_type value_type; + typedef typename Lut::new_value_type value_type; + typedef value_type rvalue_type; + typedef mlc::not_ok lvalue_type; + // Look-up table type. typedef Lut lut_type; - // rvalue_type: see below. /* lvalue_type: undefined (see oln/morpher/internal/image_value_morpher.hh). */ @@ -80,52 +84,22 @@ a mutable value proxy. */ typedef value::mutable_lut_value_proxy<Lut> mutable_value_proxy_type; - // fwd_viter_type: see below. - // bkd_viter_type: see below. + typedef fwd_viter_lut<Lut> fwd_viter_type; + typedef bkd_viter_lut<Lut> bkd_viter_type; }; - // Rvalue. - template <typename Image, typename Lut> - struct single_vtype< morpher::with_lut<Image, Lut>, typedef_::rvalue_type > - { - private: - typedef morpher::with_lut<Image, Lut> self_t; - public: - typedef oln_value(self_t) ret; - }; - /// Forward value iterator virtual type for morpher::with_lut. - template <typename Image, typename Lut> - struct single_vtype< morpher::with_lut<Image, Lut>, - typedef_::fwd_viter_type > - { - typedef fwd_viter_lut<Lut> ret; - }; - /// Backward value iterator virtual type for morpher::with_lut. - template <typename Image, typename Lut> - struct single_vtype< morpher::with_lut<Image, Lut>, - typedef_::bkd_viter_type > - { - typedef bkd_viter_lut<Lut> ret; - }; - /// \} - - - // FIXME: What about bkd_viter_type on morpher::with_lut? - - - namespace morpher { /// Look-up table addition morpher. template <typename Image, typename Lut> - class with_lut : public stc_get_supers(mlc_comma_1(with_lut<Image, Lut>)) + class with_lut : public internal::image_value_morpher<Image, with_lut<Image, Lut> > // FIXME: Ensure oln_value(Image) == Lut::new_value_type? Or just let // the ctor check this property? { - typedef with_lut<Image, Lut> self_t; - typedef stc_get_super(self_t) super_t; + typedef with_lut<Image, Lut> self_t; + typedef internal::image_value_morpher<Image, self_t> super_t; public: typedef Lut lut_type; Index: oln/morpher/count_rw.hh =================================================================== --- oln/morpher/count_rw.hh (revision 705) +++ oln/morpher/count_rw.hh (working copy) @@ -61,12 +61,8 @@ typedef oln_value(Image) value_type; typedef value::rw_counter<Image> lvalue_type; - }; - template <typename Image> - struct single_vtype< morpher::count_rw_<Image>, typedef_::rvalue_type > - { - typedef value::ro_counter<Image> ret; + typedef value::ro_counter<Image> rvalue_type; }; Index: oln/morpher/two_way_rw.hh =================================================================== --- oln/morpher/two_way_rw.hh (revision 705) +++ oln/morpher/two_way_rw.hh (working copy) @@ -61,12 +61,8 @@ typedef typename Fun::result_type value_type; typedef value::two_way<Image, Fun> lvalue_type; - }; - template <typename Image, typename Fun> - struct single_vtype< morpher::two_way_rw<Image, Fun>, typedef_::rvalue_type > - { - typedef typename Fun::result_type ret; + typedef typename Fun::result_type rvalue_type; }; Index: oln/morpher/stack.hh =================================================================== --- oln/morpher/stack.hh (revision 705) +++ oln/morpher/stack.hh (working copy) @@ -57,12 +57,8 @@ { typedef mlc::true_ is_computed_type; typedef xtd::vec<n, oln_value(I)> value_type; - }; - template <unsigned n, typename I> - struct single_vtype< morpher::stack<n, I>, typedef_::rvalue_type > - { - typedef xtd::vec<n, oln_value(I)> ret; + typedef xtd::vec<n, oln_value(I)> rvalue_type; }; Index: oln/morpher/thru_mfun.hh =================================================================== --- oln/morpher/thru_mfun.hh (revision 705) +++ oln/morpher/thru_mfun.hh (working copy) @@ -60,19 +60,14 @@ { private: typedef oln_type_of(Image, rvalue) old_value_type; + typedef morpher::thru_mfun<Image, Fun> self_t; public: typedef mlc::false_ is_computed_type; typedef typename xtd::res_<Fun, old_value_type>::ret value_type; typedef value_type& lvalue_type; - }; - template <typename Image, typename Fun> - struct single_vtype< morpher::thru_mfun<Image, Fun>, typedef_::rvalue_type > - { - typedef morpher::thru_mfun<Image, Fun> self_t; - typedef oln_value(self_t) ret; + typedef oln_value(self_t) rvalue_type; }; - namespace morpher Index: oln/morpher/stack_rw.hh =================================================================== --- oln/morpher/stack_rw.hh (revision 705) +++ oln/morpher/stack_rw.hh (working copy) @@ -81,24 +81,12 @@ public: typedef mlc::true_ is_computed_type; typedef xtd::vec<n, oln_value(I)> value_type; + + typedef value::two_way<self_t, fun_t> lvalue_type; + typedef xtd::vec<n, oln_value(I)> rvalue_type; }; - template <unsigned n, typename I> - struct single_vtype< morpher::stack_rw<n, I>, typedef_::lvalue_type > - { - typedef morpher::stack_rw<n, I> self_t; - typedef rwvec<n, oln_value(I)> fun_t; - typedef value::two_way<self_t, fun_t> ret; - }; - template <unsigned n, typename I> - struct single_vtype< morpher::stack_rw<n, I>, typedef_::rvalue_type > - { - typedef xtd::vec<n, oln_value(I)> ret; - }; - - - namespace morpher { Index: oln/morpher/internal/image_value_morpher.hh =================================================================== --- oln/morpher/internal/image_value_morpher.hh (revision 705) +++ oln/morpher/internal/image_value_morpher.hh (working copy) @@ -65,19 +65,13 @@ // Morpher type. typedef oln::morpher::tag::identity morpher_type; // FIXME: Wrong! - typedef mlc::undefined is_computed_type; - typedef mlc::undefined lvalue_type; - typedef mlc::undefined value_type; + typedef mlc::not_found is_computed_type; + typedef mlc::not_found value_type; + typedef mlc::not_found lvalue_type; + typedef mlc::not_found rvalue_type; }; - template <typename Image, typename Exact> - struct single_vtype< morpher::internal::image_value_morpher<Image, Exact>, - typedef_::rvalue_type > - { - typedef mlc::undefined ret; - }; - namespace morpher { namespace internal Index: oln/morpher/add_neighborhood.hh =================================================================== --- oln/morpher/add_neighborhood.hh (revision 705) +++ oln/morpher/add_neighborhood.hh (working copy) @@ -70,13 +70,13 @@ /// Neighborhood addition morpher. template <typename Image, typename Neighb> class add_neighborhood : - public stc_get_supers(mlc_comma_1(add_neighborhood<Image, Neighb>)) + public internal::image_extension<Image, add_neighborhood<Image, Neighb> > { private: typedef add_neighborhood<Image, Neighb> self_t; - typedef stc_get_super(self_t) super_t; - typedef oln_type_of(self_t, topo) topo_t; + typedef internal::image_extension<Image, self_t> super_t; + typedef oln_topo(self_t) topo_t; public:
18 years, 1 month
1
0
0
0
706: Simplify scoop facilities.
by Thierry GERAUD
2006-11-14 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr> Simplify scoop facilities. * stc/scoop.hh: Rename as... * stc/was.scoop.hh: ...this new file. * stc/scoop.hh: New version. Index: stc/scoop.hh =================================================================== --- stc/scoop.hh (revision 705) +++ stc/scoop.hh (working copy) @@ -43,51 +43,19 @@ # include <mlc/abort.hh> # include <mlc/bool.hh> -# include <mlc/int.hh> # include <mlc/cmp.hh> # include <mlc/if.hh> # include <mlc/is_a.hh> -# include <mlc/comma.hh> -# include <mlc/valist.hh> -# include <stc/valist_aggregator.hh> -# include <stc/exact.hh> -# include <stc/internal/extract_vtype_from_list.hh> - - -/*-----------------. -| Error messages. | -`-----------------*/ - namespace stc { + /// Error messages raised by static assertions/abortions. namespace ERROR { - /// Errors from internal::get_super_types_helper. - /// \{ - struct PARAMETER_OF_get_super_types_helper_IS_NOT_A_VALID_VALIST; - /// \} - - /// Errors from internal rec_get_vtype. - /// \{ - struct FIRST_PARAMETER_OF_rec_get_vtype_IS_NOT_A_TAG; - - struct FIRST_PARAMETER_OF_rec_get_vtype_from_list_IS_NOT_A_TAG; - struct THIRD_PARAMETER_OF_rec_get_vtype_from_list_IS_NOT_A_LIST; - /// \} - - /// Errors from internal::select_typedef. - /// \{ - struct VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_SINGLE; - struct VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_EXTERNAL; - struct VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_SINGLE_AND_EXTERNAL; - struct VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_SINGLE_AND_EXTERNAL; - /// \} - /// Errors from check_type_of_ and check_exact_type_of_. /// \{ struct VIRTUAL_TYPE_NOT_FOUND; @@ -99,933 +67,259 @@ -/*------------. -| Equipment. | -`------------*/ - -/// Internal macros, not to be used by the client. -/// \{ - -// Note: TypedefName *must* be of the form `typedef_::foo'. # define stc_internal_get_typedef(Type, TypedefName) \ typename TypedefName::template from_< Type >::ret -# define stc_internal_maybe_get_nth_super_type(Type, Nth) \ - typename internal::maybe_get_super_type< Type, Nth >::ret -# define stc_internal_rec_get_vtype(Type) \ - typename rec_get_vtype< method, category, Type, typedef_type >::ret +# define stc_internal_get_super(Type) \ + typename typedef_::super_type::template from_< Type >::ret -/// \} -// FIXME: Complete support for hierarchies with several super classes. -// FIXME: Could we extract some classes from this gigantic macro? -# define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \ - \ -namespace SCOOPED_NAMESPACE \ -{ \ - \ - /* ----------------------- */ \ - /* Typedefs declarations. */ \ - /* ----------------------- */ \ - \ - /* Declare the ``uplink'' typedef (access to a pseudosuper class). */ \ - mlc_decl_typedef(pseudosuper_type); \ - \ - \ - /* ------------- */ \ - /* Inheritance. */ \ - /* ------------- */ \ - \ - /* Set super classes. */ \ - \ - template<typename type, unsigned N = 1> \ - struct set_super_type : public mlc::undefined \ - { \ - typedef mlc::none ret; \ - }; \ - \ - \ - /* Get supers list. */ \ - \ - namespace internal \ - { \ - template <typename type, unsigned N> \ - struct maybe_get_super_type \ - { \ - typedef typename \ - mlc::if_< mlc_is_a( mlc_comma_1( set_super_type<type, N> ), \ - mlc::undefined ), \ - mlc::internal::valist_none, \ - mlc_ret(mlc_comma_1(set_super_type< type, N >)) >::ret \ - ret; \ - }; \ - } /* end of namespace SCOOPED_NAMESPACE ::internal */ \ - \ - template <typename type> \ - struct get_supers_list \ - { \ - /* FIXME: Factor with a loop macro? */ \ - typedef stc_internal_maybe_get_nth_super_type(type, 1) s1; \ - typedef stc_internal_maybe_get_nth_super_type(type, 2) s2; \ - typedef stc_internal_maybe_get_nth_super_type(type, 3) s3; \ - typedef stc_internal_maybe_get_nth_super_type(type, 4) s4; \ - typedef stc_internal_maybe_get_nth_super_type(type, 5) s5; \ - typedef stc_internal_maybe_get_nth_super_type(type, 6) s6; \ - typedef stc_internal_maybe_get_nth_super_type(type, 7) s7; \ - typedef stc_internal_maybe_get_nth_super_type(type, 8) s8; \ - typedef stc_internal_maybe_get_nth_super_type(type, 9) s9; \ - \ - typedef mlc::valist_<s1, s2, s3, s4, s5, s6, s7, s8, s9> ret; \ - }; \ - \ - \ - /* Get super classes. */ \ - \ - namespace internal \ - { \ - \ - /** Accessor helper. */ \ - template<typename type> \ - struct get_super_types_helper; \ - \ - /** Accessor helper: specialization for the case of a single */ \ - /** super class. */ \ - template<typename super> \ - struct get_super_types_helper< mlc::valist_ <super> > \ - { \ - /** Return the super class directly. */ \ - typedef super ret; \ - }; \ - \ - /** Accessor helper: specializations for the case of two super */ \ - /** classes or more. */ \ - /* FIXME: Currently works only for 2 and 3 super types. */ \ - template <typename super1, typename super2, typename super3> \ - struct get_super_types_helper< mlc::valist_ <super1, super2, super3> > \ - { \ - /** Return an aggregate of the super classes. */ \ - typedef stc::valist_aggregator< mlc::valist_ <super1, super2, super3> > \ - ret; \ - }; \ - \ - /** Accessor helper: default case (abort). */ \ - template<typename type> \ - struct get_super_types_helper : \ - public mlc::abort_< \ - type, \ - stc::ERROR::PARAMETER_OF_get_super_types_helper_IS_NOT_A_VALID_VALIST \ - > \ - { \ - }; \ - \ - } /* end of namespace SCOOPED_NAMESPACE ::internal */ \ - \ - \ - template<typename type> \ - struct get_super_types \ - { \ - typedef typename get_supers_list<type>::ret supers_list; \ - typedef typename internal::get_super_types_helper<supers_list>::ret ret; \ - }; \ - \ - \ - /* ------------------------ */ \ - /* ``Pseudo'' inheritance. */ \ - /* ------------------------ */ \ - \ - template <typename type> \ - struct set_pseudosuper_type \ - { \ - typedef mlc::none ret; \ - }; \ - \ - \ - /* --------------- */ \ - /* Virtual types. */ \ - /* --------------- */ \ - \ - /** \brief Definition of virtual types. */ \ - /** */ \ - /** There a three kinds of structures for virtual types: */ \ - /** - internal vtypes (\a vtypes); */ \ - /** - single vtypes (\a single_vtype); */ \ - /** - extended vtypes (\a ext_vtype); */ \ - /** */ \ - /** A \a vtype structure can store one or several internal vtypes, */ \ - /** whereas a \a single_vtype or an \a ext_vtype structure can hold */ \ - /** one and only one vtype. */ \ - /** */ \ - /** See tests/tour.cc and tests/vtypes.cc for examples of use. */ \ - /** */ \ - /** A virtual type definition within a \a vtype structure cannot use */ \ - /** the form `stc_type_of(Exact, ...)', which would cause endless */ \ - /** recursions in the class hierarchy. Instead, such definitions */ \ - /** should be placed in \a single_vtype or \a ext_vtype structure. */ \ - /** */ \ - /** Definitions of single vtypes can be ``announced'' in the */ \ - /** corresponding internal vtypes structure, using the \a */ \ - /** mlc::undefined tag (i.e., a vtype defined as \a mlc::undefined in */ \ - /** \a vtypes can be re-defined in a \a single_vtype). */ \ - /** */ \ - /** Apart from this exception, a vtype shall be defined at most by */ \ - /** one of the three structures explained above. */ \ - /** */ \ - /** To put in a nushell, internal vtypes are the default way to define */ \ - /** the vtypes of a class (except those of the form */ \ - /** `stc_type_of(Exact, ...)'); single vtypes are used to transcend */ \ - /** this limitation; and extended vtypes are used to add new vtypes to */ \ - /** a class besides its initial vtypes. */ \ - \ - \ - /* Internal vtypes. */ \ - /* \{ */ \ - \ - /** \brief Internal virtual types associated to \a from_type. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename category, typename from_type> \ - struct vtypes_in_category \ - { \ - }; \ - \ - /** \brief Internal virtual types associated to \a from_type */ \ - /** having no category. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename from_type> \ - struct vtypes \ - { \ - }; \ - \ - /** Specialization of vtypes for types without category. */ \ - template <typename from_type> \ - struct vtypes_in_category<void, from_type> : public vtypes<from_type> \ - { \ - }; \ - \ - /** End of the recursive construction of any vtypes hierarchy. */ \ - template <typename category> \ - struct vtypes_in_category<category, mlc::none> \ - { \ - }; \ - \ - /* \} */ \ - \ - \ - /* Single vtype. */ \ - /* \{ */ \ - \ - /** \brief A single virtual type associated to \a from_type. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct single_vtype_in_category \ - { \ - }; \ - \ - /** \brief A single virtual type associated to \a from_type. */ \ - /** Version for types without category. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename from_type, typename typedef_type> \ - struct single_vtype \ - { \ - }; \ - \ - /** Specialization of single_vtype for types without category. */ \ - template <typename from_type, typename typedef_type> \ - struct single_vtype_in_category<void, from_type, typedef_type> \ - : public single_vtype<from_type, typedef_type> \ - { \ - }; \ - \ - /** End of the recursive construction of any single_vtype<> */ \ - /** hierarchy. */ \ - template <typename category, typename typedef_type> \ - struct single_vtype_in_category<category, mlc::none, typedef_type> \ - { \ - }; \ - \ - /* \} */ \ - \ - \ - /* Extended vtype. */ \ - /* \{ */ \ - \ - /** \brief An extended virtual type associated to \a from_type. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct ext_vtype_in_category \ - { \ - }; \ - \ - /** \brief An extended virtual type associated to \a from_type. */ \ - /** Version for types without category. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename from_type, typename typedef_type> \ - struct ext_vtype \ - { \ - }; \ - \ - /** Specialization of ext_vtype for types without category. */ \ - template <typename from_type, typename typedef_type> \ - struct ext_vtype_in_category<void, from_type, typedef_type> \ - : public ext_vtype<from_type, typedef_type> \ - { \ - }; \ - \ - /** End of the recursive construction of any ext_vtype<> */ \ - /** hierarchy. */ \ - template <typename category, typename typedef_type> \ - struct ext_vtype_in_category<category, mlc::none, typedef_type> \ - { \ - }; \ - \ - /* \} */ \ - \ - \ - /* -------------------- */ \ - /* Internal machinery. */ \ - /* -------------------- */ \ - \ - /** The classes enclosed in this namespace must not be specialized */ \ - /** by the user (they are part of the automatic associated types */ \ - /** retrieval mechanism). */ \ - namespace internal \ - { \ - /* ------------------------------------------ */ \ - /* Recursive retrieval of an internal vtype. */ \ - /* ------------------------------------------ */ \ - \ - /** Tags for retrieval methods. */ \ - namespace tag \ - { \ - \ - /** Abstraction for method tags. */ \ - struct method {}; \ - \ - /** Tag for retrieval within internal vtypes. */ \ - struct internal : public method {}; \ - /** Tag for retrieval within single vtypes. */ \ - struct single : public method {}; \ - /** Tag for retrieval within extended vtypes. */ \ - struct extended : public method {}; \ - \ - } /* end of namespace SCOOPED_NAMESPACE ::internal::tag */ \ - \ - /** Try to get \a typedef_type from \a from_type. In case this */ \ - /** typedef is mlc::not_found, don't perform a recursive */ \ - /** retrieval, simply return mlc::not_found. */ \ - template <typename method, typename category, \ - typename from_type, typename typedef_type> \ - struct get_vtype_helper \ - { \ - /* Nothing (no method selected). */ \ - }; \ - \ - /** Specialization of get_vtypes for retrievals within */ \ - /** internal vtypes. */ \ - template <typename category, \ - typename from_type, typename typedef_type> \ - struct get_vtype_helper<tag::internal, category, \ - from_type, typedef_type> \ - { \ - /** Set of vtypes associated with FROM_TYPE. */ \ - typedef vtypes_in_category<category, from_type> types; \ - /** Typedef in the current vtypes (may be mlc::not_found). */ \ - typedef stc_internal_get_typedef(types, typedef_type) ret; \ - }; \ - \ - /** Specialization of get_vtypes for retrievals within */ \ - /** single vtypes. */ \ - template <typename category, \ - typename from_type, typename typedef_type> \ - struct get_vtype_helper<tag::single, category, \ - from_type, typedef_type> \ - { \ - /** Set of vtypes associated with FROM_TYPE. */ \ - typedef single_vtype_in_category<category, from_type, typedef_type> \ - single_type; \ - /** Typedef in the current single_vtype (may be mlc::not_found). */ \ - typedef mlc_ret(single_type) ret; \ - }; \ - \ - /** Specialization of get_vtypes for retrievals within */ \ - /** extended vtypes. */ \ - template <typename category, \ - typename from_type, typename typedef_type> \ - struct get_vtype_helper<tag::extended, category, \ - from_type, typedef_type> \ - { \ - /** Set of vtypes associated with FROM_TYPE. */ \ - typedef ext_vtype_in_category<category, from_type, typedef_type> \ - ext_type; \ - /** Typedef in the current ext_vtype (may be mlc::not_found). */ \ - typedef mlc_ret(ext_type) ret; \ - }; \ - \ - \ - /* FIXME: Do a basic scheme of the algorithm in pseudo-code. */ \ - \ - /* Forward declaration. */ \ - template <typename method, typename category, \ - typename from_list, typename typedef_type> \ - struct rec_get_vtype_from_list; \ - \ - /** Recursive retrieval of the virtual type \a typedef_type inside */ \ - /** the class \a from_type. */ \ - template <typename method, typename category, \ - typename from_type, typename typedef_type> \ - struct rec_get_vtype : \ - private mlc::assert_< mlc_is_a(method, tag::method), \ - stc::ERROR::FIRST_PARAMETER_OF_rec_get_vtype_IS_NOT_A_TAG > \ - { \ - /** Get potential vtype \a typedef_type from the current class */ \ - /** (\a from_type). */ \ - typedef typename \ - get_vtype_helper< method, category, from_type, typedef_type>::ret \ - type; \ - \ - /** Implicit parents (i.e. supers), if any. */ \ - typedef typename get_supers_list<from_type>::ret supers_list; \ - /** Vtype deduced from the vtypes of the base class(es) of */ \ - /** \a from_type, if any. */ \ - typedef typename \ - rec_get_vtype_from_list< method, category, \ - supers_list, typedef_type >::ret \ - vtype_from_supers; \ - \ - /** Pseudosuper class, if any. */ \ - typedef stc_get_pseudosuper(from_type) pseudosuper; \ - /** Vtype deduced from the vtype of the pseudo super class of */ \ - /** \a from_type, if any. */ \ - typedef typename \ - rec_get_vtype< method, category, pseudosuper, typedef_type >::ret \ - vtype_from_pseudo_super; \ - \ - /* Core of the search algorithm. */ \ - typedef typename \ - mlc::if_< \ - mlc::neq_< type, mlc::not_found >, \ - /* then */ \ - /* return it */ \ - /* (the typedef has been found in the vtypes */ \ - /* associated to FROM_TYPE) */ \ - type, \ - /* else */ \ - /* check if the vtypes of the `supers' of FROM_TYPE */ \ - /* has the typedef */ \ - typename \ - mlc::if_< mlc::neq_< vtype_from_supers, mlc::not_found >, \ - /* then */ \ - /* return it */ \ - vtype_from_supers, \ - /* else */ \ - /* check if the FROM_TYPE has a pseudo super */ \ - /* and try to retrieve the typedef from it. */ \ - vtype_from_pseudo_super >::ret >::ret \ - ret; \ - }; \ - \ - /** Ends of the recursive retrieval (mlc::none is at the end of the */ \ - /** transitive closure of every `super' relation). */ \ - /** \{ */ \ - /** Case where \a from_type = mlc::none (end of a recursive */ \ - /** retrieval following `super' types). */ \ - template <typename method, typename category, typename typedef_type> \ - struct rec_get_vtype<method, category, mlc::none, typedef_type> : \ - private mlc::assert_< mlc_is_a(method, tag::method), \ - stc::ERROR::FIRST_PARAMETER_OF_rec_get_vtype_IS_NOT_A_TAG > \ - { \ - typedef mlc::not_found ret; \ - }; \ - /** Case where \a from_type = mlc::not_found (end of a recursive */ \ - /** retrieval following `super' types). */ \ - template <typename method, typename category, typename typedef_type> \ - struct rec_get_vtype<method, category, mlc::not_found, typedef_type> : \ - private mlc::assert_< mlc_is_a(method, tag::method), \ - stc::ERROR::FIRST_PARAMETER_OF_rec_get_vtype_IS_NOT_A_TAG > \ - { \ - typedef mlc::not_found ret; \ - }; \ - /** \} */ \ - \ - \ - /** Recursive retrieval of vtype \a typedef_type inside */ \ - /** \a from_list. */ \ - /** \{ */ \ - \ - /* Default case: \a from_type is not a mlc::valist_, abort. */ \ - template <typename method, typename category, \ - typename from_list, typename typedef_type> \ - struct rec_get_vtype_from_list : \ - private mlc::abort_< from_list, \ - stc::ERROR::THIRD_PARAMETER_OF_rec_get_vtype_from_list_IS_NOT_A_LIST > \ - { \ - }; \ - \ - /** Case where the list is empty. Suprisingly, the general */ \ - /** specialization for mlc::valist<e1, ..., e9> is not enough: */ \ - /** this specialization is needed too. */ \ - template <typename method, typename category, typename typedef_type> \ - struct rec_get_vtype_from_list< \ - method, category, mlc::valist_<>, typedef_type> \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - /* Case where \a from_list is a genuine list. */ \ - template <typename method, typename category, \ - typename e1, typename e2, typename e3, \ - typename e4, typename e5, typename e6, \ - typename e7, typename e8, typename e9, \ - typename typedef_type> \ - struct rec_get_vtype_from_list< \ - method, category, \ - mlc::valist_<e1, e2, e3, e4, e5, e6, e7, e8, e9>, typedef_type \ - > : \ - private mlc::assert_< mlc_is_a(method, tag::method), \ - stc::ERROR::FIRST_PARAMETER_OF_rec_get_vtype_from_list_IS_NOT_A_TAG > \ - { \ - /* For each item of the list \a from_list, perform a */ \ - /* rec_get_vtype search. */ \ - /* FIXME: Factor with a loop macro? */ \ - typedef stc_internal_rec_get_vtype(e1) res1; \ - typedef stc_internal_rec_get_vtype(e2) res2; \ - typedef stc_internal_rec_get_vtype(e3) res3; \ - typedef stc_internal_rec_get_vtype(e4) res4; \ - typedef stc_internal_rec_get_vtype(e5) res5; \ - typedef stc_internal_rec_get_vtype(e6) res6; \ - typedef stc_internal_rec_get_vtype(e7) res7; \ - typedef stc_internal_rec_get_vtype(e8) res8; \ - typedef stc_internal_rec_get_vtype(e9) res9; \ - \ - /* Then, create a list from the results. */ \ - typedef \ - mlc::valist_<res1, res2, res3, res4, res5, res6, res7, res8, res9> \ - res_list; \ - \ - /* Finally, match this list against a set of valid patterns. */ \ - /* If the match fails, return mlc::not_found. */ \ - typedef typename \ - stc::internal::extract_vtype_from_list<res_list>::ret ret; \ - }; \ - \ - \ - /* -------------------------------------------- */ \ - /* Internal/single/extended typedef selection. */ \ - /* -------------------------------------------- */ \ - \ - /** \brief Typedef selector. */ \ - /** */ \ - /** A virtual type is considered valid if and only if it has been */ \ - /** found as an internal vtype or (exclusive) as an extended vtype. */ \ - /** Other cases (no definition or a double definition) are invalid. */ \ - /** */ \ - /** \{ */ \ - /** Fwd decl. */ \ - template \ - < typename internal_vtype_candidate, bool found_as_internal_vtype, \ - typename single_vtype_candidate, bool found_as_single_vtype, \ - typename extended_vtype_candidate, bool found_as_extended_vtype > \ - struct select_typedef; \ - \ - /** The typedef is defined as an internal vtype only: good. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, true, \ - single_vtype_candidate, false, \ - extended_vtype_candidate, false> \ - { \ - typedef internal_vtype_candidate ret; \ - }; \ - \ - /** The typedef is defined as a single vtype only: good. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, false, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, false> \ - { \ - typedef single_vtype_candidate ret; \ - }; \ - \ - /** The typedef is defined as an extended vtype only: good. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, false, \ - single_vtype_candidate, false, \ - extended_vtype_candidate, true> \ - { \ - typedef extended_vtype_candidate ret; \ - }; \ - \ - /** Special case: The typedef is <b>declared</b> as mlc::undefined */ \ - /** in internal vtypes, and <b>defined</b> as a single vtype: good. */ \ - template <typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<mlc::undefined, true, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, false> \ - { \ - typedef single_vtype_candidate ret; \ - }; \ - \ - \ - /* Erroneous cases. */ \ - /* ---------------- */ \ - \ - /* In the following cases, mlc::abort_ ``statements'' take a dummy */ \ - /* typedef as first parameter, to prevent an immediate evaluation. */ \ - /* of mlc_abort_<>. */ \ - /* The choice was made to choose the first unbound parameter, but it */ \ - /* <i>it has no meaning in itself!</i>. This is just a part of the */ \ - /* static abortion mechanism. */ \ - \ - /** The typedef is <b>defined</b> both as internal and single (and */ \ - /** the internal flavour is <b>not</b> mlc::undefined): bad. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, true, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, false> : \ - mlc::abort_ < \ - internal_vtype_candidate /* dummy */ , \ - stc::ERROR::VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_SINGLE \ - > \ - { \ - /* Error, no valid typedef found. */ \ - typedef mlc::not_found ret; \ - }; \ - \ - /** The typedef is <b>defined</b> both as internal and external: bad. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, true, \ - single_vtype_candidate, false, \ - extended_vtype_candidate, true> : \ - mlc::abort_ < \ - internal_vtype_candidate /* dummy */ , \ - stc::ERROR::VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_EXTERNAL \ - > \ - { \ - /* Error, no valid typedef found. */ \ - typedef mlc::not_found ret; \ - }; \ - \ - /** The typedef is <b>defined</b> both as single and external: bad. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, false, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, true> : \ - mlc::abort_ < \ - internal_vtype_candidate /* dummy */ , \ - stc::ERROR::VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_SINGLE_AND_EXTERNAL \ - > \ - { \ - /* Error, no valid typedef found. */ \ - typedef mlc::not_found ret; \ - }; \ - \ - /** The typedef is <b>defined</b> as internal, single, and */ \ - /** external: bad. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, true, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, true> : \ - mlc::abort_ < \ - internal_vtype_candidate /* dummy */ , \ - stc::ERROR:: \ - VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_SINGLE_AND_EXTERNAL \ - > \ - { \ - /* Error, no valid typedef found. */ \ - typedef mlc::not_found ret; \ - }; \ - \ - /** All other cases: \a mlc::not_found is returned, but no static. */ \ - /** error is raised. */ \ - template \ - < typename internal_vtype_candidate, bool found_as_internal_vtype, \ - typename single_vtype_candidate, bool found_as_single_vtype, \ - typename extended_vtype_candidate, bool found_as_extended_vtype > \ - struct select_typedef \ - { \ - typedef mlc::not_found ret; \ - }; \ - /** \} */ \ - \ - } /* End of namespace SCOOPED_NAMESPACE ::internal */ \ - \ - \ - /* Entry points. */ \ - /* ------------- */ \ - \ - /** Entry point of the vtype retrieval algorithm. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct direct_type_of_ \ - { \ - /* Look for the typedef in internal vtypes. */ \ - typedef typename \ - internal::rec_get_vtype<internal::tag::internal, category, \ - from_type, typedef_type>::ret \ - internal_vtype_candidate; \ - /* Look for the typedef as a single vtype definition. */ \ - typedef typename \ - internal::rec_get_vtype<internal::tag::single, category, \ - from_type, typedef_type>::ret \ - single_vtype_candidate; \ - /* Look for the typedef as an extended vtype. */ \ - typedef typename \ - internal::rec_get_vtype<internal::tag::extended, category, \ - from_type, typedef_type>::ret \ - extended_vtype_candidate; \ - \ - /* Did we found the virtual type in any of the vtypes structures? */ \ - static const bool found_as_internal_vtype = \ - mlc_bool(mlc::is_found_<internal_vtype_candidate>); \ - static const bool found_as_single_vtype = \ - mlc_bool(mlc::is_found_<single_vtype_candidate>); \ - static const bool found_as_extended_vtype = \ - mlc_bool(mlc::is_found_<extended_vtype_candidate>); \ - \ - /* Find an eligible typedef. */ \ - typedef typename \ - internal::select_typedef< \ - internal_vtype_candidate, found_as_internal_vtype, \ - single_vtype_candidate, found_as_single_vtype, \ - extended_vtype_candidate, found_as_extended_vtype \ - >::ret ret; \ - }; \ - \ - /** Entry point of the vtype retrieval algorithm (working on the */ \ - /** exact version of \a from_type). */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct type_of_ \ - { \ - /* Get the exact type of \a from_type. */ \ - typedef stc_to_exact(from_type) from_exact_type; \ - /* ``Run'' type_of_. */ \ - typedef typename \ - direct_type_of_<category, from_exact_type, typedef_type>::ret ret; \ - }; \ - \ - \ - /** Like direct_type_of_, but ensure that the result is different */ \ - /** from mlc::not_found. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct check_direct_type_of_ \ - { \ - /* Candidate type. */ \ - typedef typename \ - direct_type_of_<category, from_type, typedef_type>::ret candidate; \ - /* Check that CANDIDATE is found. */ \ - typedef typename \ - mlc::assert_and_return_< \ - mlc_neq(candidate, mlc::not_found), \ - candidate, \ - stc::ERROR::VIRTUAL_TYPE_NOT_FOUND \ - >::ret ret; \ - }; \ - \ - /** Like type_of_, but ensure that the result is different from */ \ - /** mlc::not_found. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct check_type_of_ \ - { \ - /* Candidate type. */ \ - typedef typename \ - type_of_<category, from_type, typedef_type>::ret candidate; \ - /* Check that CANDIDATE is found. */ \ - typedef typename \ - mlc::assert_and_return_< \ - mlc_neq(candidate, mlc::not_found), \ - candidate, \ - stc::ERROR::VIRTUAL_TYPE_NOT_FOUND \ - >::ret ret; \ - }; \ - \ -} /* end of namespace SCOOPED_NAMESPACE */ \ - \ + +# define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \ + \ +namespace SCOOPED_NAMESPACE \ +{ \ + \ + template <typename from_type> \ + struct set_super_type \ + { \ + typedef mlc::none ret; \ + }; \ + \ + template <typename type> \ + struct set_pseudosuper_type \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename from_type> \ + struct vtypes \ + { \ + }; \ + \ + template <typename from_type, typename type> \ + struct single_vtype \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + \ + namespace internal \ + { \ + \ + /* retrieve_from_single_vtype */ \ + \ + template <typename from_type, typename type> \ + struct retrieve_from_single_vtype; \ + \ + template <typename res, typename super, typename type> \ + struct helper_retrieve_from_single_vtype \ + { \ + typedef res ret; \ + }; \ + \ + template <typename super, typename type> \ + struct helper_retrieve_from_single_vtype < mlc::not_found, super, type > \ + { \ + typedef typename retrieve_from_single_vtype<super, type>::ret ret; \ + }; \ + \ + template <typename type> \ + struct helper_retrieve_from_single_vtype < mlc::not_found, mlc::none, type > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename type> \ + struct helper_retrieve_from_single_vtype < mlc::not_found, mlc::not_found, type > \ + { \ + }; \ + \ + template <typename from_type, typename type> \ + struct retrieve_from_single_vtype \ + { \ + typedef SCOOPED_NAMESPACE::single_vtype<from_type, type> decl; \ + typedef typename decl::ret res; \ + typedef typename set_super_type<from_type>::ret super; \ + typedef typename helper_retrieve_from_single_vtype< res, super, type >::ret ret; \ + }; \ + \ + /* vtypes */ \ + \ + template <typename from_type, typename type> \ + struct retrieve_from_vtypes; \ + \ + template <typename res, typename super, typename type> \ + struct helper_retrieve_from_vtypes \ + { \ + typedef res ret; \ + }; \ + \ + template <typename super, typename type> \ + struct helper_retrieve_from_vtypes < mlc::not_found, super, type > \ + { \ + typedef typename retrieve_from_vtypes<super, type>::ret ret; \ + }; \ + \ + template <typename type> \ + struct helper_retrieve_from_vtypes < mlc::not_found, mlc::none, type > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename type> \ + struct helper_retrieve_from_vtypes < mlc::not_found, mlc::not_found, type > \ + { \ + }; \ + \ + template <typename from_type, typename type> \ + struct retrieve_from_vtypes \ + { \ + typedef SCOOPED_NAMESPACE::vtypes<from_type> decl; \ + typedef stc_internal_get_typedef(decl, type) res; \ + typedef typename set_super_type<from_type>::ret super; \ + typedef typename helper_retrieve_from_vtypes< res, super, type >::ret ret; \ + }; \ + \ + /* pseudo super */ \ + \ + template <typename from_type> \ + struct retrieve_pseudosuper; \ + \ + template <typename res, typename super> \ + struct helper_retrieve_pseudosuper \ + { \ + typedef res ret; \ + }; \ + \ + template <typename super> \ + struct helper_retrieve_pseudosuper < mlc::not_found, super > \ + { \ + typedef typename retrieve_pseudosuper<super>::ret ret; \ + }; \ + \ + template <> \ + struct helper_retrieve_pseudosuper < mlc::not_found, mlc::none > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <> \ + struct helper_retrieve_pseudosuper < mlc::not_found, mlc::not_found > \ + { \ + }; \ + \ + template <typename from_type> \ + struct retrieve_pseudosuper \ + { \ + typedef typename set_pseudosuper_type<from_type>::ret res; \ + typedef typename set_super_type<from_type>::ret super; \ + typedef typename helper_retrieve_pseudosuper< res, super >::ret ret; \ + }; \ + \ + /* scoop_vtype_of */ \ + \ + template <typename from_type, typename type> \ + struct step_from_vtypes; /* fwd decl of main entry */ \ + \ + /* step 3 <=> delegation */ \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_delegation \ + { \ + /* REC */ \ + typedef typename step_from_vtypes<from_type, type>::ret ret; \ + }; \ + \ + template <typename type> \ + struct helper_step_from_delegation < mlc::not_found, type > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct step_from_delegation /* step 3 entry */ \ + { \ + typedef typename retrieve_pseudosuper<from_type>::ret pseudo_type; \ + typedef typename helper_step_from_delegation<pseudo_type, type>::ret ret; \ + }; \ + \ + /* step 2 <=> single_vtype */ \ + \ + template <typename res, typename from_type, typename type> \ + struct helper_step_from_single_vtype \ + { \ + typedef res ret; /* found! */ \ + }; \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_single_vtype <mlc::not_found, /* => step 3 */ \ + from_type, type> \ + { \ + typedef typename step_from_delegation<from_type, type>::ret ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_single_vtype <mlc::undefined, /* => step 3 */ \ + from_type, type> \ + { \ + typedef typename step_from_delegation<from_type, type>::ret ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct step_from_single_vtype /* step 2 entry */ \ + { \ + typedef typename retrieve_from_single_vtype<from_type, type>::ret res; \ + typedef typename helper_step_from_single_vtype< res, from_type, type>::ret ret; \ + }; \ + \ + /* step 1 <=> vtypes */ \ + \ + template <typename res, typename from_type, typename type> \ + struct helper_step_from_vtypes \ + { \ + typedef res ret; /* found! */ \ + }; \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_vtypes <mlc::not_found, /* => step 2 */ \ + from_type, type> \ + { \ + typedef typename step_from_single_vtype<from_type, type>::ret ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_vtypes <mlc::undefined, /* => step 2 */ \ + from_type, type> \ + { \ + typedef typename step_from_single_vtype<from_type, type>::ret ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct step_from_vtypes /* main entry (so step 1 entry) */ \ + { \ + typedef typename retrieve_from_vtypes<from_type, type>::ret res; \ + typedef typename helper_step_from_vtypes< res, from_type, type>::ret ret; \ + }; \ + \ + } /* end of namespace SCOOPED_NAMESPACE ::internal */ \ + \ + \ + template <typename from_type, typename type> \ + struct direct_type_of_ \ + { \ + typedef typename internal::step_from_vtypes<from_type, type>::ret ret; \ + }; \ + \ + \ +} /* end of namespace SCOOPED_NAMESPACE */ \ + \ struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n -/*---------. -| Macros. | -`---------*/ - -// ------------- // -// Inheritance. // -// ------------- // - -// Set. - -/* FIXME: I don't know whether these macros will be really usable; what - if Type is a template class? We would have to provide additional - versions of these macros, with support for one parameter, two - parameters, etc. */ -/// \def Declare the immediate base class \a Super of \a Type. -#define stc_set_nth_super(Type, N, Super) \ - template<> \ - struct set_super_type< Type, N > \ - { \ - typedef Super ret; \ - }; \ - \ - struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n - -// Shortcut. -#define stc_set_super(Type, Super) \ - stc_set_nth_super(Type, 1, Super) - - -// Get. - -// FIXME: The error message given by the compiler is not explicit -// when trying to use stc_get_supers on a class which has no -// (declared) super class. Improve this. - -/** \a stc_get_supers(Type) returns a class which inerits from all the - classes declared as super types of \a Type. - - However, there is an exception when Type as single super: - stc_get_supers returns this super class directly, not a class - ineriting from it, to avoid a useless indirection. */ -#define stc_get_supers(Type) \ - get_super_types< Type >::ret - -/// \def Get the Nth immediate base class(es) of Type (version to be -/// used inside a template). -# define stc_get_nth_super(Type, Nth) \ - typename stc_get_nth_super_(Type, Nth) - -/// \def Get the Nth immediate base class(es) of Type (version to be -/// used outside a template). -# define stc_get_nth_super_(Type, Nth) \ - set_super_type< Type, Nth >::ret - -/// \def Get the fisrt immediate base class of Type (version to be -/// used inside a template). -# define stc_get_super(Type) \ - typename stc_get_super_(Type) - -/// \def Get the first immediate base class of Type (version to be -/// used outside a template). -# define stc_get_super_(Type) \ - stc_get_nth_super_(Type, 1) - - -// -------------------- // -// Pseudo inheritance. // -// -------------------- // - -/* FIXME: I don't know whether this macro will be really usable; what - if Type is a template class? We would have to provide additional - versions of this macro, with support for one parameter, two - parameters, etc. */ -/// \def Declare the pseudosuper class \a PseudoSuper of \a Type. -# define stc_set_pseudosuper(Type, PseudoSuper) \ - template<> \ - struct set_pseudosuper_type<Type> \ - { \ - typedef PseudoSuper ret; \ - }; \ - \ - struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n - - -/// \def Get the pseudosuper class of Type (version to be used inside a -/// template). -# define stc_get_pseudosuper(Type) \ - typename stc_get_pseudosuper_(Type) - -/// \def Get the pseudosuper class of Type (version to be used outside a -/// template). -# define stc_get_pseudosuper_(Type) \ - set_pseudosuper_type< Type >::ret - - -// --------------------- // -// Virtual type access. // -// --------------------- // - -/// Get the vtype \a Typedef, declared in \a Namespace, from the -/// exact type of \a FromType (version to be used inside a template). -#define stc_type_of(Namespace, Category, FromType, Typedef) \ - typename stc_type_of_(Namespace, Category, FromType, Typedef) - -/// Get the vtype \a Typedef, declared in \a Namespace, from the -/// exact type of \a FromType (version to be used outside a template). -#define stc_type_of_(Namespace, Category, FromType, Typedef) \ - Namespace::type_of_< Category, FromType, \ - Namespace::typedef_:: Typedef##_type >::ret - - -/// Get the vtype \a Typedef, declared in \a Namespace, from \a -/// FromType directly. (version to be used inside a template). -#define stc_direct_type_of(Namespace, Category, FromType, Typedef) \ - typename stc_direct_type_of_(Namespace, Category, FromType, Typedef) - -/// Get the vtype \a Typedef, declared in \a Namespace, from \a -/// FromType directly (version to be used outside a template). -#define stc_direct_type_of_(Namespace, Category, FromType, Typedef) \ - Namespace::direct_type_of_< Category, FromType, \ - Namespace::typedef_:: Typedef##_type >::ret - - -// ------------------------------- // -// Virtual type check and access. // -// ------------------------------- // - -/* These macros are the same as the previous ones, but they use - check_type_of_ (resp. check_direct_type_of_) instead of type_of_ - (resp. direct_type_of_). */ - -/// Get the vtype \a Typedef, declared in \a Namespace, from the -/// exact type of \a FromType (version to be used inside a template). -/// If the virtual type is not found, raise a static error. -#define stc_check_type_of(Namespace, Category, FromType, Typedef) \ - typename stc_check_type_of_(Namespace, Category, FromType, Typedef) - -/// Get the vtype \a Typedef, declared in \a Namespace, from the -/// exact type of \a FromType (version to be used outside a template). -/// If the virtual type is not found, raise a static error. -#define stc_check_type_of_(Namespace, Category, FromType, Typedef) \ - Namespace::check_type_of_< Category, FromType, \ - Namespace::typedef_:: Typedef##_type >::ret - - -/// Get the vtype \a Typedef, declared in \a Namespace, from \a -/// FromType directly. (version to be used inside a template). -/// If the virtual type is not found, raise a static error. -#define stc_check_direct_type_of(Namespace, Category, FromType, Typedef) \ - typename stc_check_direct_type_of_(Namespace, Category, FromType, Typedef) - -/// Get the vtype \a Typedef, declared in \a Namespace, from \a -/// FromType directly (version to be used outside a template). -/// If the virtual type is not found, raise a static error. -#define stc_check_direct_type_of_(Namespace, Category, FromType, Typedef) \ - Namespace::check_direct_type_of_< \ - Category, \ - FromType, \ - Namespace::typedef_:: Typedef##_type \ - >::ret - - #endif // ! STC_SCOOP_HH
18 years, 1 month
1
0
0
0
705: Add backward value iterators on look-up tables.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Add backward value iterators on look-up tables. * oln/core/lookup_table.hh (oln::lookup_table::reverse_iterator) (oln::lookup_table::const_reverse_iterator): New typedefs. (oln::lookup_table::rbegin, oln::lookup_table::rend): New methods. * oln/core/typedefs.hh (bkd_viter_type): New virtual type declaration. * oln/core/gen/bkd_viter_lut.hh: New. * oln/core/gen/fwd_viter_lut.hh: Typos. * oln/morpher/with_lut.hh (single_vtype<morpher::with_lut<Image,Lut>, typedef_::bkd_viter_type>): New. * tests/morphers/with_lut.cc (main): Test backward value iterator on look-up table. * oln/Makefile.am (nobase_oln_HEADERS): Add core/gen/bkd_viter_lut.hh. oln/Makefile.am | 1 oln/core/gen/bkd_viter_lut.hh | 182 ++++++++++++++++++++++++++++++++++++++++++ oln/core/gen/fwd_viter_lut.hh | 4 oln/core/lookup_table.hh | 53 +++++++++++- oln/core/typedefs.hh | 2 oln/morpher/with_lut.hh | 13 ++- tests/morphers/with_lut.cc | 29 ++---- 7 files changed, 257 insertions(+), 27 deletions(-) Index: tests/morphers/with_lut.cc --- tests/morphers/with_lut.cc (revision 704) +++ tests/morphers/with_lut.cc (working copy) @@ -151,27 +151,18 @@ oln_type_of_(image_with_lut_t, fwd_viter) fv(ima_with_lut.lut()); std::list<rgb8> fwd_values; std::cout << "values of lut (fwd) =" << std::endl; - for_all (fv) - { // Push the values to the *back* of the list. + for_all (fv) fwd_values.push_back(fv); - std::cout << " " << fv << std::endl; - } - -// FIXME: To be enabled later. - -// // Check bkd_viter_lut. -// oln_type_of_(image_with_lut_t, bkd_viter) bv(ima_with_lut.lut()); -// std::list<rgb8> bkd_values; -// std::cout << "values of lut (bkd) =" << std::endl; -// for_all (bv) -// { -// // Push the values to the *front* of the list. -// bkd_values.push_front(bv); -// std::cout << " " << bv << std::endl; -// } -// // Compare the two lists. -// assert (fwd_values == bkd_values); + // Check bkd_viter_lut. + oln_type_of_(image_with_lut_t, bkd_viter) bv(ima_with_lut.lut()); + std::list<rgb8> bkd_values; + std::cout << "values of lut (bkd) =" << std::endl; + // Push the values to the *front* of the list (i.e., in reverse order). + for_all (bv) + bkd_values.push_front(bv); + // Compare the two lists. + assert (fwd_values == bkd_values); // FIXME: To be enabled later, when oln::level::fill is specialized Index: oln/core/typedefs.hh --- oln/core/typedefs.hh (revision 704) +++ oln/core/typedefs.hh (working copy) @@ -97,7 +97,7 @@ mlc_decl_typedef(bkd_niter_type); mlc_decl_typedef(fwd_viter_type); - // FIXME: bkd_viter_type. + mlc_decl_typedef(bkd_viter_type); /*------------. Index: oln/core/gen/bkd_viter_lut.hh --- oln/core/gen/bkd_viter_lut.hh (revision 0) +++ oln/core/gen/bkd_viter_lut.hh (revision 0) @@ -0,0 +1,182 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_GEN_BKD_VITER_LUT_HH +# define OLN_CORE_GEN_BKD_VITER_LUT_HH + +# include <oln/core/abstract/iterator_on_values.hh> +# include <oln/core/lookup_table.hh> + +namespace oln +{ + + // Forward declaration. + template <typename Lut> class bkd_viter_lut; + + + /// Super type declaration. + template <typename Lut> + struct set_super_type< bkd_viter_lut<Lut> > + { + typedef bkd_viter_lut<Lut> self_t; + typedef abstract::iterator_on_values<self_t> ret; + }; + + + /// Virtual types associated to oln::bkd_viter_lut<Lut>. + template <typename Lut> + struct vtypes< bkd_viter_lut<Lut> > + { + // The look-up table is immutable. + typedef const Lut lut_type; + typedef typename Lut::const_reverse_iterator lut_iter_type; + typedef typename Lut::new_value_type value_type; + }; + + + /// Backward value iterator on look-up table. + template <typename Lut> + class bkd_viter_lut : + public stc_get_supers(bkd_viter_lut<Lut>) + // Check that Lut is a look-up table. + // FIXME: an abstract::lookup_table would be useful. + { + typedef bkd_viter_lut<Lut> self_t; + typedef stc_get_super(self_t) super_t; + typedef oln_type_of(self_t, lut_iter) lut_iter_t; + + public: + typedef oln_type_of(self_t, lut) lut_type; + typedef oln_type_of(self_t, value) value_type; + + public: + // Construct an uninitialized value iterator. + bkd_viter_lut(const Lut& lut); + + /// Iterator manipulators. + /// \{ + void impl_start(); + void impl_next(); + void impl_invalidate(); + bool impl_is_valid() const; + /// \} + + // Get the value pointed by this iterator (const version). + value_type impl_to_value() const; + + void print(std::ostream& ostr) const; + + protected: + /// Look-up table. + lut_type& lut_; + /// Iterator on \a lut_. + lut_iter_t i_; + }; + + + template <typename Lut> + std::ostream& operator<<(std::ostream& ostr, + const bkd_viter_lut<Lut>& t); + + + +# ifndef OLN_INCLUDE_ONLY + + template <typename Lut> + bkd_viter_lut<Lut>::bkd_viter_lut(const Lut& lut) : + super_t(), + lut_(lut), + i_() + { + // Initialize underlying iterator (i.e., \a i_.) + this->invalidate(); + } + + template <typename Exact> + void + bkd_viter_lut<Exact>::impl_start() + { + i_ = lut_.rbegin(); + } + + template <typename Exact> + void + bkd_viter_lut<Exact>::impl_next() + { + /* Iterate until a different key is reached. In fact, + std::multimap might not be the best choice to implement + new_to_orig_map_. Maybe a std::map binding orig_val to a + std::set of new_val's would is better?. */ + value_type val = i_->first; + do + ++i_; + while (i_ != lut_.rend() and i_->first == val); + } + + template <typename Exact> + void + bkd_viter_lut<Exact>::impl_invalidate() + { + i_ = lut_.rend(); + } + + template <typename Exact> + bool + bkd_viter_lut<Exact>::impl_is_valid() const + { + return (i_ != lut_.rend()); + } + + template <typename Lut> + typename bkd_viter_lut<Lut>::value_type + bkd_viter_lut<Lut>::impl_to_value() const + { + precondition(this->is_valid()); + return this->i_->first; + } + + template <typename Lut> + void bkd_viter_lut<Lut>::print(std::ostream& ostr) const + { + precondition(this->is_valid()); + ostr << "{ value = " << this->i_->first << " }"; + } + + + template <typename Lut> + std::ostream& operator<<(std::ostream& ostr, const bkd_viter_lut<Lut>& t) + { + t.print(ostr); + return ostr; + } + +# endif + +} // end of namespace oln + + +#endif // ! OLN_CORE_GEN_BKD_VITER_LUT_HH Index: oln/core/gen/fwd_viter_lut.hh --- oln/core/gen/fwd_viter_lut.hh (revision 704) +++ oln/core/gen/fwd_viter_lut.hh (working copy) @@ -34,8 +34,6 @@ namespace oln { - // FIXME: Merge this file with oln/core/internal/fwd_viter_lut.hh? - // Forward declaration. template <typename Lut> class fwd_viter_lut; @@ -60,7 +58,7 @@ }; - /// Const forward value iterator on look-up table. + /// Forward value iterator on look-up table. template <typename Lut> class fwd_viter_lut : public stc_get_supers(fwd_viter_lut<Lut>) Index: oln/core/lookup_table.hh --- oln/core/lookup_table.hh (revision 704) +++ oln/core/lookup_table.hh (working copy) @@ -52,6 +52,9 @@ typedef typename new_to_orig_map_type::const_iterator const_iterator; typedef typename new_to_orig_map_type::iterator iterator; + typedef typename new_to_orig_map_type::const_reverse_iterator const_reverse_iterator; + typedef typename new_to_orig_map_type::reverse_iterator reverse_iterator; + public: lookup_table(); @@ -59,13 +62,17 @@ const new_value_type operator() (const orig_value_type& orig_value) const; - /// (Internal) iterators. + /// (Internal) iterators bounds. /// \{ const_iterator begin() const; iterator begin(); - const_iterator end() const; iterator end(); + + const_reverse_iterator rbegin() const; + reverse_iterator rbegin(); + const_reverse_iterator rend() const; + reverse_iterator rend(); /// \} const_iterator find(const new_value_type& val) const; @@ -120,6 +127,10 @@ } + /*--------------------------. + | Direct iterators bounds. | + `--------------------------*/ + template <typename Orig_Value, typename New_Value, typename Orig_Value_Compare, typename New_Value_Compare> typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_iterator @@ -153,6 +164,44 @@ } + /*---------------------------. + | Reverse iterators bounds. | + `---------------------------*/ + + template <typename Orig_Value, typename New_Value, + typename Orig_Value_Compare, typename New_Value_Compare> + typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_reverse_iterator + lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::rbegin() const + { + return new_to_orig_map_.rbegin(); + } + + template <typename Orig_Value, typename New_Value, + typename Orig_Value_Compare, typename New_Value_Compare> + typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::reverse_iterator + lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::rbegin() + { + return new_to_orig_map_.rbegin(); + } + + template <typename Orig_Value, typename New_Value, + typename Orig_Value_Compare, typename New_Value_Compare> + typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_reverse_iterator + lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::rend() const + { + return new_to_orig_map_.rend(); + } + + template <typename Orig_Value, typename New_Value, + typename Orig_Value_Compare, typename New_Value_Compare> + typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::reverse_iterator + lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::rend() + { + return new_to_orig_map_.rend(); + } + + + template <typename Orig_Value, typename New_Value, typename Orig_Value_Compare, typename New_Value_Compare> typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_iterator Index: oln/Makefile.am --- oln/Makefile.am (revision 704) +++ oln/Makefile.am (working copy) @@ -123,6 +123,7 @@ core/gen/bkd_niter_neighb.hh \ core/gen/bkd_piter_bbox.hh \ core/gen/bkd_qiter_win.hh \ + core/gen/bkd_viter_lut.hh \ core/gen/fwd_decls.hh \ core/gen/fwd_niter_neighb.hh \ core/gen/fwd_piter_bbox.hh \ Index: oln/morpher/with_lut.hh --- oln/morpher/with_lut.hh (revision 704) +++ oln/morpher/with_lut.hh (working copy) @@ -32,6 +32,7 @@ # include <oln/core/lookup_table.hh> # include <oln/value/lut_value_proxy.hh> # include <oln/core/gen/fwd_viter_lut.hh> +# include <oln/core/gen/bkd_viter_lut.hh> namespace oln @@ -80,7 +81,7 @@ typedef value::mutable_lut_value_proxy<Lut> mutable_value_proxy_type; // fwd_viter_type: see below. - // FIXME: implement bkd_viter_type! + // bkd_viter_type: see below. }; // Rvalue. @@ -93,13 +94,21 @@ typedef oln_value(self_t) ret; }; - /// Const forward viter vtype of morpher::with_lut. + /// Forward value iterator virtual type for morpher::with_lut. template <typename Image, typename Lut> struct single_vtype< morpher::with_lut<Image, Lut>, typedef_::fwd_viter_type > { typedef fwd_viter_lut<Lut> ret; }; + + /// Backward value iterator virtual type for morpher::with_lut. + template <typename Image, typename Lut> + struct single_vtype< morpher::with_lut<Image, Lut>, + typedef_::bkd_viter_type > + { + typedef bkd_viter_lut<Lut> ret; + }; /// \}
18 years, 1 month
1
0
0
0
704: Merge oln::internal::fwd_viter_lut and oln::fwd_viter_lut.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Merge oln::internal::fwd_viter_lut and oln::fwd_viter_lut. * oln/core/internal/fwd_viter_lut.hh: Remove this file, and merge... (oln::internal::fwd_viter_lut): ...this class with... * oln/core/gen/fwd_viter_lut.hh (oln::fwd_viter_lut): ...this one. * oln/Makefile.am (nobase_oln_HEADERS): Remove core/internal/fwd_viter_lut.hh. Makefile.am | 1 core/gen/fwd_viter_lut.hh | 65 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 58 insertions(+), 8 deletions(-) Index: oln/core/gen/fwd_viter_lut.hh --- oln/core/gen/fwd_viter_lut.hh (revision 703) +++ oln/core/gen/fwd_viter_lut.hh (working copy) @@ -28,7 +28,7 @@ #ifndef OLN_CORE_GEN_FWD_VITER_LUT_HH # define OLN_CORE_GEN_FWD_VITER_LUT_HH -# include <oln/core/internal/fwd_viter_lut.hh> +# include <oln/core/abstract/iterator_on_values.hh> # include <oln/core/lookup_table.hh> namespace oln @@ -45,7 +45,7 @@ struct set_super_type< fwd_viter_lut<Lut> > { typedef fwd_viter_lut<Lut> self_t; - typedef internal::fwd_viter_lut<self_t> ret; + typedef abstract::iterator_on_values<self_t> ret; }; @@ -69,19 +69,34 @@ { typedef fwd_viter_lut<Lut> self_t; typedef stc_get_super(self_t) super_t; + typedef oln_type_of(self_t, lut_iter) lut_iter_t; public: - typedef oln_type_of(self_t, lut) lut_t; + typedef oln_type_of(self_t, lut) lut_type; typedef oln_type_of(self_t, value) value_type; public: // Construct an uninitialized value iterator. fwd_viter_lut(const Lut& lut); + /// Iterator manipulators. + /// \{ + void impl_start(); + void impl_next(); + void impl_invalidate(); + bool impl_is_valid() const; + /// \} + // Get the value pointed by this iterator (const version). value_type impl_to_value() const; void print(std::ostream& ostr) const; + + protected: + /// Look-up table. + lut_type& lut_; + /// Iterator on \a lut_. + lut_iter_t i_; }; @@ -94,13 +109,50 @@ # ifndef OLN_INCLUDE_ONLY template <typename Lut> - fwd_viter_lut<Lut>::fwd_viter_lut(const Lut& lut) - : super_t(lut) + fwd_viter_lut<Lut>::fwd_viter_lut(const Lut& lut) : + super_t(), + lut_(lut), + i_() { // Initialize underlying iterator (i.e., \a i_.) this->invalidate(); } + template <typename Exact> + void + fwd_viter_lut<Exact>::impl_start() + { + i_ = lut_.begin(); + } + + template <typename Exact> + void + fwd_viter_lut<Exact>::impl_next() + { + /* Iterate until a different key is reached. In fact, + std::multimap might not be the best choice to implement + new_to_orig_map_. Maybe a std::map binding orig_val to a + std::set of new_val's would is better?. */ + value_type val = i_->first; + do + ++i_; + while (i_ != lut_.end() and i_->first == val); + } + + template <typename Exact> + void + fwd_viter_lut<Exact>::impl_invalidate() + { + i_ = lut_.end(); + } + + template <typename Exact> + bool + fwd_viter_lut<Exact>::impl_is_valid() const + { + return (i_ != lut_.end()); + } + template <typename Lut> typename fwd_viter_lut<Lut>::value_type fwd_viter_lut<Lut>::impl_to_value() const @@ -118,8 +170,7 @@ template <typename Lut> - std::ostream& operator<<(std::ostream& ostr, - const fwd_viter_lut<Lut>& t) + std::ostream& operator<<(std::ostream& ostr, const fwd_viter_lut<Lut>& t) { t.print(ostr); return ostr; Index: oln/Makefile.am --- oln/Makefile.am (revision 703) +++ oln/Makefile.am (working copy) @@ -155,7 +155,6 @@ core/internal/bbox_bkd_piter.hh \ core/internal/bbox_fwd_piter.hh \ core/internal/dpoint_nd.hh \ - core/internal/fwd_viter_lut.hh \ core/internal/point_nd.hh \ core/internal/topology_morpher.hh \ core/internal/tracked_ptr.hh \
18 years, 1 month
1
0
0
0
703: Fix ChangeLogs
by Roland Levillain
Having several ChangeLogs is really error-prone... Index: ChangeLog =================================================================== --- ChangeLog (révision 702) +++ ChangeLog (révision 703) @@ -1,17 +1,3 @@ -2006-11-13 Roland Levillain <roland(a)lrde.epita.fr> - - Remove virtual type `is_value_wise_mutable'. - - * oln/core/typedefs.hh (is_value_wise_mutable): Remove virtual - type declaration. - * oln/core/abstract/image/value_wise_accessibility/hierarchy.hh: - (case_<image_hierarchy_wrt_value_wise_accessibility, E, 1>): No - longer use the virtual type `is_value_wise_mutable' in the - static switch condition; query `mutable_value_proxy' instead. - * olena/oln/morpher/with_lut.hh - (vtypes< morpher::with_lut<Image, Lut> >::is_value_wise_mutable_type): - Remove typedef. - 2006-10-31 Roland Levillain <roland(a)lrde.epita.fr> Fix CXXFLAGS usage. Index: olena/ChangeLog =================================================================== --- olena/ChangeLog (révision 702) +++ olena/ChangeLog (révision 703) @@ -1,3 +1,17 @@ +2006-11-13 Roland Levillain <roland(a)lrde.epita.fr> + + Remove virtual type `is_value_wise_mutable'. + + * oln/core/typedefs.hh (is_value_wise_mutable): Remove virtual + type declaration. + * oln/core/abstract/image/value_wise_accessibility/hierarchy.hh: + (case_<image_hierarchy_wrt_value_wise_accessibility, E, 1>): No + longer use the virtual type `is_value_wise_mutable' in the + static switch condition; query `mutable_value_proxy' instead. + * oln/morpher/with_lut.hh + (vtypes< morpher::with_lut<Image, Lut> >::is_value_wise_mutable_type): + Remove typedef. + 2006-11-10 Roland Levillain <roland(a)lrde.epita.fr> Introduce oln::value::lut_value_proxy.
18 years, 1 month
1
0
0
0
← Newer
1
2
3
Older →
Jump to page:
1
2
3
Results per page:
10
25
50
100
200