00001 /* Glass - a distributed computing library 00002 Copyright (C) 2003-2009 Bruno Barberi Gnecco 00003 Copyright (C) 2009-2010 Corollarium Technologies 00004 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 #ifndef _GLASS_SERIAL_HH_ 00022 #define _GLASS_SERIAL_HH_ 00023 00024 #include "types.h" 00025 #include "chain.h" 00026 #include "exception.h" 00027 00028 namespace libglass { 00029 00085 class SerializableObject { 00086 public: 00087 SerializableObject() { } 00088 00092 virtual ~SerializableObject() { } 00093 00099 virtual const string * name(void) const = 0; 00100 00106 virtual SerializableObject *create() const throw(Exception) = 0; 00107 00112 virtual SerializableObject *create(const chain &s) const 00113 throw(Exception) = 0; 00114 00120 virtual bool pack(chain &c) = 0; 00121 00129 virtual bool unpack(const chain &c) = 0; 00130 }; 00131 00145 class RegisterObject { 00146 public: 00147 RegisterObject(SerializableObject *o); 00148 }; 00149 00150 00151 } 00152 00153 #endif // _GLASS_SERIAL_HH_