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_OIDP_H 00026 #define _EYEDB_OIDP_H 00027 00028 namespace eyedb { 00029 00038 class OidP : public Basic { 00039 00040 // ----------------------------------------------------------------------- 00041 // OidP Interface 00042 // ----------------------------------------------------------------------- 00043 public: 00048 OidP(const Oid *oid = NULL); 00049 00056 OidP(Database *db, const Oid *oid = 0, const Dataspace *dataspace = 0); 00057 00062 OidP(const OidP *o); 00063 00068 OidP(const OidP &o); 00069 00074 virtual Object *clone() const {return new OidP(*this);} 00075 00076 00082 OidP& operator=(const OidP &o); 00083 00091 Status trace(FILE *fd = stdout, unsigned int flags = 0, const RecMode *recmode = RecMode::FullRecurs) const; 00092 00098 Status setValue(Data data); 00099 00105 Status getValue(Data *data) const; 00106 00111 virtual OidP *asOidP() {return this;} 00112 00117 virtual const OidP *asOidP() const {return this;} 00118 00119 00120 // ----------------------------------------------------------------------- 00121 // OidP Private Part 00122 // ----------------------------------------------------------------------- 00123 private: 00124 Status trace_realize(FILE*, int, unsigned int, const RecMode *) const; 00125 Oid val; 00126 Status create(); 00127 Status update(); 00128 }; 00129 00130 class OidPPtr : public BasicPtr { 00131 00132 public: 00133 OidPPtr(OidP *o = 0) : BasicPtr(o) { } 00134 00135 OidP *getOidP() {return dynamic_cast<OidP *>(o);} 00136 const OidP *getOidP() const {return dynamic_cast<OidP *>(o);} 00137 00138 OidP *operator->() {return dynamic_cast<OidP *>(o);} 00139 const OidP *operator->() const {return dynamic_cast<OidP *>(o);} 00140 }; 00141 00142 typedef std::vector<OidPPtr> OidPPtrVector; 00143 00144 extern OidClass *OidP_Class; 00145 extern const char oid_class_name[]; 00146 00151 } 00152 00153 #endif 00154