Index: olena/ChangeLog from Giovanni Palma giovanni@lrde.epita.fr
* oln/makefile.src: Add morpho/abstract/attribute references. * oln/morpho/attributes.hh: Remove comments. * oln/morpho/abstract/attribute.hh: Real add the file. * oln/morpho/abstract/attribute.hxx: Likewise.
Index: olena/oln/morpho/attributes.hh --- olena/oln/morpho/attributes.hh Wed, 08 Sep 2004 10:15:22 +0200 palma_g (oln/j/45_attributes 1.13.1.6 600) +++ olena/oln/morpho/attributes.hh Thu, 09 Sep 2004 11:14:29 +0200 palma_g (oln/j/45_attributes 1.13.1.6 644) @@ -33,17 +33,6 @@ # include <oln/morpho/environments.hh> # include <oln/morpho/abstract/attribute.hh>
-// // attribute dedicated macros -// # define attr_lambda_type(T) typename oln::morpho::attr::attr_traits< T >::lambda_type -// # define attr_env_type(T) typename oln::morpho::attr::attr_traits< T >::env_type -// # define attr_value_type(T) typename oln::morpho::attr::attr_traits< T >::value_type - -// # define attr_lambda_type_(T) oln::morpho::attr::attr_traits< T >::lambda_type -// # define attr_env_type_(T) oln::morpho::attr::attr_traits< T >::env_type -// # define attr_value_type_(T) oln::morpho::attr::attr_traits< T >::value_type - - - namespace oln { namespace morpho { /*! \brief Implementation of attributes. @@ -64,15 +53,6 @@ } } // !tools
- -// // the traits fwd declaration -// /*! -// ** Traits for attributes information. -// ** \param T Exact type of the attribute. -// */ -// template <class T> -// struct attr_traits; - /*! ** \brief Change the exact type of an attribute. ** @@ -84,9 +64,6 @@ struct change_exact;
- // the attributes hierarchy - - /*-----------* | card | *-----------*/ Index: olena/oln/makefile.src --- olena/oln/makefile.src Tue, 13 Jul 2004 11:48:20 +0200 palma_g (oln/r/4_makefile.s 1.6 600) +++ olena/oln/makefile.src Thu, 09 Sep 2004 11:16:39 +0200 palma_g (oln/r/4_makefile.s 1.6 644) @@ -158,6 +158,8 @@ morpher/piece_morpher.hh \ morpher/slicing_morpher.hh \ morpher/subq_morpher.hh \ + morpho/abstract/attribute.hh \ + morpho/abstract/attribute.hxx \ morpho/attribute_closing_opening.hh \ morpho/attribute_closing_opening_map.hxx \ morpho/attribute_closing_opening_map.hh \ Index: olena/oln/morpho/abstract/attribute.hxx --- olena/oln/morpho/abstract/attribute.hxx Thu, 09 Sep 2004 11:23:50 +0200 palma_g () +++ olena/oln/morpho/abstract/attribute.hxx Thu, 09 Sep 2004 11:21:53 +0200 palma_g (oln/v/38_attribute. 644) @@ -0,0 +1,109 @@ +// Copyright (C) 2004 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, 59 Temple Place - Suite 330, 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_MORPHO_ABSTRACT_ATTRIBUTE_HXX +# define OLN_MORPHO_ABSTRACT_ATTRIBUTE_HXX + +namespace oln +{ + namespace morpho + { + namespace attr + { + namespace abstract + { + template <class Exact> + inline void + attribute<Exact>::operator+=(const exact_type &rhs) + { + mlc_dispatch(pe)(rhs); + } + + template <class Exact> + inline bool + attribute<Exact>::operator>=(const lambda_type &lambda) const + { + mlc_dispatch(ge)(lambda); + } + + template <class Exact> + inline + bool + attribute<Exact>::operator<(const lambda_type &lambda) const + { + mlc_dispatch(less)(lambda); + } + + template <class Exact> + inline + bool + attribute<Exact>::operator<(const exact_type &x) const + { + mlc_dispatch(less2)(x); + } + + template <class Exact> + inline + bool + attribute<Exact>::operator!=(const lambda_type &lambda) const + { + mlc_dispatch(ne)(lambda); + } + + template <class Exact> + inline const typename attribute<Exact>::lambda_type & + attribute<Exact>::toLambda() const + { + mlc_dispatch(toLambda)(); + } + + template <class Exact> + inline + bool + attribute<Exact>::ge_impl(const lambda_type &lambda) const + { + return !(*this < lambda); + } + + template <class Exact> + inline + bool + attribute<Exact>::less2_impl(const exact_type &x) const + { + return *this < x.toLambda(); + } + + template <class Exact> + inline + attribute<Exact>::attribute() + {} + } // !abstract + } // !attr + } // !morpho +} // !oln + +#endif // !OLN_MORPHO_ABSTRACT_ATTRIBUTE_HXX Index: olena/oln/morpho/abstract/attribute.hh --- olena/oln/morpho/abstract/attribute.hh Thu, 09 Sep 2004 11:23:50 +0200 palma_g () +++ olena/oln/morpho/abstract/attribute.hh Thu, 09 Sep 2004 11:21:23 +0200 palma_g (oln/v/40_attribute. 644) @@ -0,0 +1,155 @@ +// Copyright (C) 2004 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, 59 Temple Place - Suite 330, 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_MORPHO_ABSTRACT_ATTRIBUTE_HH +# define OLN_MORPHO_ABSTRACT_ATTRIBUTE_HH +# include <oln/morpho/environments.hh> + +// attribute dedicated macros +# define attr_lambda_type(T) typename oln::morpho::attr::attr_traits< T >::lambda_type +# define attr_env_type(T) typename oln::morpho::attr::attr_traits< T >::env_type +# define attr_value_type(T) typename oln::morpho::attr::attr_traits< T >::value_type + +# define attr_lambda_type_(T) oln::morpho::attr::attr_traits< T >::lambda_type +# define attr_env_type_(T) oln::morpho::attr::attr_traits< T >::env_type +# define attr_value_type_(T) oln::morpho::attr::attr_traits< T >::value_type + + +# define attr_type_decl(self_type) \ + typedef mlc_exact_vt_type(self_type, Exact) exact_type; \ + typedef attr_value_type(exact_type) value_type; \ + typedef attr_env_type(exact_type) env_type; \ + typedef attr_lambda_type(exact_type) lambda_type + +namespace oln +{ + namespace morpho + { + namespace attr + { + // the traits fwd declaration + /*! + ** Traits for attributes information. + ** \param T Exact type of the attribute. + */ + template <class T> + struct attr_traits; + // } + + namespace abstract + { + // namespace attr + // { + + /*! + ** \brief Attribute abstract class + ** + ** Top of the attribute hierarchy. + */ + template <class Exact> + class attribute: public mlc_hierarchy::any<Exact> + { + public: + typedef attribute<Exact> self_type; /*< Self type of the class.*/ + attr_type_decl(self_type); + + /*! + ** \brief += operator + ** + ** This is a static dispatcher for the += operator. + ** This method is abstract. + */ + void operator+=(const exact_type &rhs); + + /*! + ** \brief >= operator + ** + ** This is a static dispatcher for the >= operator. + */ + bool operator>=(const lambda_type &lambda) const; + + /*! + ** \brief "<" operator + ** + ** This is a static dispatcher for the "<" operator. + ** This method is abstract. + */ + bool operator<(const lambda_type &lambda) const; + + /*! + ** \brief "<" operator + ** + ** This is a static dispatcher for the "<" operator. + ** This method is abstract. + */ + bool operator<(const exact_type &x) const; + + /*! + ** \brief != operator + ** + ** This is a static dispatcher for the != operator. + ** This method is abstract. + */ + bool operator!=(const lambda_type &lambda) const; + + /*! + ** \brief conversion to lambda type. + ** + ** \warning Virtual method. + */ + const lambda_type &toLambda() const; + + /*! + ** \brief >= operator implementation. + ** + ** This is an implementation of the >= operator. Override this + ** method to provide a new implementation of this operator. + ** \warning This method SHOULDN'T be called. + */ + bool ge_impl(const lambda_type &lambda) const; + + /*! + ** \brief "<" operator implementation. + ** + ** This is an implementation of the < operator. Override this + ** method to provide a new implementation of this operator. + ** \warning This method SHOULDN'T be called. + */ + bool less2_impl(const exact_type &x) const; + + protected: + attribute(); + }; + } // !abstract + } // !attr + } // !morpho +} // !oln + +# include <oln/morpho/abstract/attribute.hxx> + +#endif // !OLN_MORPHO_ABSTRACT_ATTRIBUTE_HH