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_BASIC_CLASS_H 00026 #define _EYEDB_BASIC_CLASS_H 00027 00028 namespace eyedb { 00029 00035 // BasicClass 00039 class BasicClass : public Class { 00040 00041 // ----------------------------------------------------------------------- 00042 // BasicClass Interface 00043 // ----------------------------------------------------------------------- 00044 public: 00049 BasicClass(const char *s); 00050 00056 BasicClass(Database *db, const char *s); 00057 00062 BasicClass(const BasicClass &cl); 00063 00068 BasicClass& operator=(const BasicClass &cl); 00069 00075 Status setValue(Data); 00076 00082 Status getValue(Data*) const; 00083 00088 Status attrsComplete(); 00089 00094 int getCode() const; 00095 00101 const char *getCName(Bool useAsRef = False) const; 00102 00108 Status remove(const RecMode* recmode= RecMode::NoRecurs); 00109 00119 virtual Status traceData(FILE *fd, int indent, Data inidata, 00120 Data data, TypeModifier *tmod = NULL) const = 0; 00121 00129 Status trace(FILE* fd = stdout, unsigned int flags = 0, const RecMode * recmode= RecMode::FullRecurs) const; 00130 00135 virtual BasicClass *asBasicClass() {return this;} 00136 00141 virtual const BasicClass *asBasicClass() const {return this;} 00142 00148 virtual Status loadComplete(const Class *cl); 00149 00150 // ----------------------------------------------------------------------- 00151 // BasicClass Protected Part 00152 // ----------------------------------------------------------------------- 00153 protected: 00154 eyedblib::int16 code; 00155 Status create(); 00156 Status update(); 00157 char Cname[32]; 00158 00159 // ----------------------------------------------------------------------- 00160 // BasicClass Private Part 00161 // ----------------------------------------------------------------------- 00162 private: 00163 void copy_realize(const BasicClass &); 00164 }; 00165 00166 class BasicClassPtr : public ClassPtr { 00167 00168 public: 00169 BasicClassPtr(BasicClass *o = 0) : ClassPtr(o) { } 00170 00171 BasicClass *getBasicClass() {return dynamic_cast<BasicClass *>(o);} 00172 const BasicClass *getBasicClass() const {return dynamic_cast<BasicClass *>(o);} 00173 00174 BasicClass *operator->() {return dynamic_cast<BasicClass *>(o);} 00175 const BasicClass *operator->() const {return dynamic_cast<BasicClass *>(o);} 00176 }; 00177 00178 typedef std::vector<BasicClassPtr> BasicClassPtrVector; 00179 00184 } 00185 00186 #endif