• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

uminus.cc

00001 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 #include <mln/trait/op/uminus.hh>
00027 #include <mln/core/concept/object.hh>
00028 
00029 
00030 template <typename E> struct Top_Concept;
00031 template <typename E> struct Sub_Concept;
00032 
00033 
00034 // Top_Concept.
00035 
00036 template <> struct Top_Concept<void> { typedef mln::Object<void> super; };
00037 
00038 template <typename E>
00039 struct Top_Concept
00040 {
00041   typedef Top_Concept<void> category;
00042 protected:
00043   Top_Concept() {}
00044 };
00045 
00046 
00047 // Sub_Concept.
00048 
00049 template <> struct Sub_Concept<void> { typedef Top_Concept<void> super; };
00050 
00051 template <typename E>
00052 struct Sub_Concept
00053 {
00054   typedef Sub_Concept<void> category;
00055 protected:
00056   Sub_Concept() {}
00057 };
00058 
00059 
00060 // test.
00061 
00062 struct test : Sub_Concept< test >
00063 {
00064   void is_test() {}
00065 };
00066 
00067 
00068 namespace mln
00069 {
00070 
00071   namespace trait
00072   {
00073 
00074     // FIXME: Dead code?
00075 //     template <>
00076 //     struct p_setrecise_unary_< op::uminus, test >
00077 //     {
00078 //       typedef bool ret;
00079 //     };
00080 
00081 //     template <typename T>
00082 //     struct set_unary_< op::uminus, Sub_Concept, T >
00083 //     {
00084 //       typedef int ret;
00085 //     };
00086 
00087 //     template <typename T>
00088 //     struct set_unary_< op::uminus, Top_Concept, T >
00089 //     {
00090 //       typedef float ret;
00091 //     };
00092 
00093   } // mln::trait
00094 
00095 } // mln
00096 
00097 
00098 int main()
00099 {
00100   using namespace mln;
00101 
00102     // FIXME: Dead code?
00103 
00104 //   {
00105 //     mln_trait_op_uminus_(test) tmp; /* bool if precise */
00106 //     bool* b = &tmp;
00107 //     *b = true;
00108 //   }
00109 
00110 //   {
00111 //     mln_trait_op_uminus_(test) tmp; /* int if no precise def and both sub and top defs */
00112 //     void* v = tmp;
00113 //   }
00114 
00115 //   {
00116 //     mln_trait_op_uminus_(test) tmp; /* float if only top def */
00117 //     void* v = tmp;
00118 //   }
00119 
00120 //   {
00121 //     mln_trait_op_uminus_(test) tmp; // test if no def here (default is id, given for Object)
00122 //     tmp.is_test();
00123 //   }
00124 
00125 }

Generated on Tue Oct 4 2011 15:24:45 for Milena (Olena) by  doxygen 1.7.1