attribute.hh

00001 // Copyright (C) 2004 EPITA Research and Development Laboratory
00002 //
00003 // This file is part of the Olena Library.  This library is free
00004 // software; you can redistribute it and/or modify it under the terms
00005 // of the GNU General Public License version 2 as published by the
00006 // Free Software Foundation.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this library; see the file COPYING.  If not, write to
00015 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016 // Boston, MA 02110-1301, USA.
00017 //
00018 // As a special exception, you may use this file as part of a free
00019 // software library without restriction.  Specifically, if other files
00020 // instantiate templates or use macros or inline functions from this
00021 // file, or you compile this file and link it with other files to
00022 // produce an executable, this file does not by itself cause the
00023 // resulting executable to be covered by the GNU General Public
00024 // License.  This exception does not however invalidate any other
00025 // reasons why the executable file might be covered by the GNU General
00026 // Public License.
00027 
00028 
00029 #ifndef OLN_MORPHO_ABSTRACT_ATTRIBUTE_HH
00030 # define OLN_MORPHO_ABSTRACT_ATTRIBUTE_HH
00031 # include <oln/morpho/environments.hh>
00032 
00033 // attribute dedicated macros
00034 # define attr_lambda_type(T)    typename oln::morpho::attr::attr_traits< T >::lambda_type
00035 # define attr_env_type(T)       typename oln::morpho::attr::attr_traits< T >::env_type
00036 # define attr_value_type(T)     typename oln::morpho::attr::attr_traits< T >::value_type
00037 
00038 # define attr_lambda_type_(T)    oln::morpho::attr::attr_traits< T >::lambda_type
00039 # define attr_env_type_(T)       oln::morpho::attr::attr_traits< T >::env_type
00040 # define attr_value_type_(T)     oln::morpho::attr::attr_traits< T >::value_type
00041 
00042 
00043 # define attr_type_decl(self_type) \
00044       typedef mlc_exact_vt_type(self_type, Exact)       exact_type; \
00045       typedef attr_value_type(exact_type)               value_type; \
00046       typedef attr_env_type(exact_type)                 env_type; \
00047       typedef attr_lambda_type(exact_type)              lambda_type
00048 
00049 namespace oln
00050 {
00051   namespace morpho
00052   {
00053     namespace attr
00054     {
00055       // the traits fwd declaration
00060       template <class T>
00061       struct attr_traits;
00062       //    }
00063 
00064       namespace abstract
00065       {
00066         //       namespace attr
00067         //       {
00068 
00074         template <class Exact>
00075         class attribute: public mlc_hierarchy::any<Exact>
00076         {
00077         public:
00078           typedef attribute<Exact>      self_type; /*< Self type of the class.*/
00079           attr_type_decl(self_type);
00080 
00087           void operator+=(const exact_type &rhs);
00088 
00094           bool operator>=(const lambda_type &lambda) const;
00095 
00102           bool operator<(const lambda_type &lambda) const;
00103 
00110           bool operator<(const exact_type &x) const;
00111 
00118           bool operator!=(const lambda_type &lambda) const;
00119 
00125           const lambda_type &toLambda() const;
00126 
00134           bool ge_impl(const lambda_type &lambda) const;
00135 
00143           bool less2_impl(const exact_type &x) const;
00144 
00145         protected:
00146           attribute();
00147         };
00148       } // !abstract
00149     } // !attr
00150   } // !morpho
00151 } // !oln
00152 
00153 # include <oln/morpho/abstract/attribute.hxx>
00154 
00155 #endif // !OLN_MORPHO_ABSTRACT_ATTRIBUTE_HH

Generated on Tue Feb 20 20:17:47 2007 for Olena by  doxygen 1.5.1