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 ACEDIA_META_CLASS_H 00031 #define ACEDIA_META_CLASS_H 00032 00033 #include <boost/archive/text_iarchive.hpp> 00034 #include <boost/archive/text_oarchive.hpp> 00035 00036 namespace acedia { 00037 00038 // forward declaration 00039 class String; 00040 namespace details { struct AnyVal; } 00041 00050 struct MetaClass 00051 { 00055 virtual ~MetaClass(); 00056 00064 virtual unsigned int tupleLenght() const; 00065 00074 virtual bool isCaseTuple() const; 00075 00080 virtual const String &name() const = 0; 00081 00086 virtual details::AnyVal *deserialize(boost::archive::text_iarchive &ar) const = 0; 00087 }; 00088 00089 /* 00090 * @brief Register a meta class and associate it with its name. 00091 * @note usually you don't have to call this method on your own! 00092 * @return always 1 00093 */ 00094 int registerMetaClass(MetaClass *instance); 00095 00096 /* 00097 * @brief Get registered meta class with associated name. 00098 * 00099 * @note the name is plattform independent 00100 * and is <code>!= typeid().name()</code> 00101 * 00102 * @return the with @p name associated meta class or NULL 00103 */ 00104 MetaClass *getMetaClass(const String &name); 00105 00106 } // namespace acedia 00107 00108 #endif // METACLASS_H