00001 /* *\ 00002 ** Copyright (C) 2009-2010 ** 00003 ** Dominik Charousset < Dominik.Charousset (at) haw-hamburg.de > ** 00004 ** ** 00005 ** MMM MMMMMM MMMMMMMMM MMMMMMM MMM MMM ** 00006 ** MMMMM MMMMMMMM MMMMMMMMM MMMMMMMM MMM MMMMM ** 00007 ** MMM MMM MMM MMMM MMM MMM MMM MMM MMM ** 00008 ** MMM MMM MMM MMMMMMMMM MMM MMM MMM MMM MMM ** 00009 ** MMMMMMMMMMM MMMM MMM MMMM MMM MMM MMM MMMMMMMMMMM ** 00010 ** MMM MMM MMMMMMMM MMMMMMMMM MMMMMMMM MMM MMM MMM ** 00011 ** MMM MMM MMMMMM MMMMMMMMM MMMMMMM MMM MMM MMM ** 00012 ** ** 00013 ** ** 00014 ** This file is part of the acedia library. ** 00015 ** ** 00016 ** This library is free software: you can redistribute it and/or modify ** 00017 ** it under the terms of the GNU Lesser General Public License as published ** 00018 ** by the Free Software Foundation, either version 3 of the License, or ** 00019 ** (at your option) any later version. ** 00020 ** ** 00021 ** This library is distributed in the hope that it will be useful, ** 00022 ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** 00023 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 00024 ** GNU Lesser General Public License for more details. ** 00025 ** ** 00026 ** You should have received a copy of the GNU Lesser General Public License ** 00027 ** along with acedia. If not, see <http://www.gnu.org/licenses/>. ** 00028 \* */ 00029 00030 #ifndef METACLASSIMPL_H 00031 #define METACLASSIMPL_H 00032 00033 #include <boost/cstdint.hpp> 00034 #include "metaclass.hpp" 00035 #include "anyval.hpp" 00036 #include "acedia_string.hpp" 00037 #include "unit.hpp" 00038 00039 namespace acedia 00040 { 00041 namespace details 00042 { 00043 // Template implementation of MetaClass 00044 template<class T> 00045 class MetaClassImpl : public MetaClass 00046 { 00047 MetaClassImpl() { } 00048 00049 public: 00050 00051 const String &name() const 00052 { 00053 // provoke compile time error 00054 static String n = T::this_class_is_not_announced; 00055 return n; 00056 } 00057 AnyVal *deserialize(boost::archive::text_iarchive &ar) const 00058 { 00059 // provoke compile time error 00060 return T::this_class_is_not_announced; 00061 } 00062 static MetaClass *instance() 00063 { 00064 static MetaClassImpl *lw = new MetaClassImpl(); 00065 return lw; 00066 } 00067 virtual bool isCaseTuple() const 00068 { 00069 return T::this_class_is_not_announced; 00070 } 00071 }; 00072 00073 } // namespace details 00074 00075 } // namespace acedia 00076 00077 #endif // METACLASSIMPL_H