00001 /* 00002 EyeDB Object Database Management System 00003 Copyright (C) 1994-2008 SYSRA 00004 00005 EyeDB is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 EyeDB is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00018 */ 00019 00020 /* 00021 Author: Eric Viara <viara@sysra.com> 00022 */ 00023 00024 00025 #ifndef _EYEDB_STRUCT_H 00026 #define _EYEDB_STRUCT_H 00027 00028 namespace eyedb { 00029 00038 class Struct : public Agregat { 00039 00040 // ---------------------------------------------------------------------- 00041 // Struct Interface 00042 // ---------------------------------------------------------------------- 00043 public: 00049 Struct(Database *_db = 0, const Dataspace *_dataspace = 0) : 00050 Agregat(_db, _dataspace) {} 00051 00056 Struct(const Struct &o) : Agregat(o) {} 00057 00063 Struct(const Struct *o, Bool share = False) : 00064 Agregat(o, share) {} 00065 00070 virtual Object *clone() const {return new Struct(*this);} 00071 00072 00077 virtual Struct *asStruct() {return this;} 00078 00083 virtual const Struct *asStruct() const {return this;} 00084 00085 00086 // ---------------------------------------------------------------------- 00087 // Struct Protected Part 00088 // ---------------------------------------------------------------------- 00089 protected: 00090 void initialize(Database *_db) { 00091 Agregat::initialize(_db); 00092 } 00093 }; 00094 00095 class StructPtr : public AgregatPtr { 00096 00097 public: 00098 StructPtr(Struct *o = 0) : AgregatPtr(o) { } 00099 00100 Struct *getStruct() {return dynamic_cast<Struct *>(o);} 00101 const Struct *getStruct() const {return dynamic_cast<Struct *>(o);} 00102 00103 Struct *operator->() {return dynamic_cast<Struct *>(o);} 00104 const Struct *operator->() const {return dynamic_cast<Struct *>(o);} 00105 }; 00106 00107 typedef std::vector<StructPtr> StructPtrVector; 00108 00113 } 00114 00115 #endif