Instance.h

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_INSTANCE_H
00026 #define _EYEDB_INSTANCE_H
00027 
00028 namespace eyedb {
00029 
00038   class Instance : public Object {
00039 
00040     // ----------------------------------------------------------------------
00041     // Instance Interface
00042     // ----------------------------------------------------------------------
00043   public:
00049     Instance(Database *db = 0, const Dataspace *dataspace = 0);
00050 
00055     Instance(const Instance &o) : Object(o) {}
00056 
00062     Instance(const Instance *o, Bool share = False) :
00063       Object(o, share) {}
00064 
00069     Instance *asInstance() {return this;}
00070 
00075     const Instance *asInstance() const {return this;}
00076 
00081     virtual void garbage();
00082 
00083     virtual ~Instance();
00084 
00085     // ----------------------------------------------------------------------
00086     // Instance Protected Part
00087     // ----------------------------------------------------------------------
00088   protected:
00089     void initialize(Database *);
00090   };
00091 
00092   class InstancePtr : public ObjectPtr {
00093 
00094   public:
00095     InstancePtr(Instance *o = 0) : ObjectPtr(o) { }
00096 
00097     Instance *getInstance() {return dynamic_cast<Instance *>(o);}
00098     const Instance *getInstance() const {return dynamic_cast<Instance *>(o);}
00099 
00100     Instance *operator->() {return dynamic_cast<Instance *>(o);}
00101     const Instance *operator->() const {return dynamic_cast<Instance *>(o);}
00102   };
00103 
00104   typedef std::vector<InstancePtr> InstancePtrVector;
00105 
00110 }
00111 
00112 #endif

Generated on Mon Dec 22 18:15:56 2008 for eyedb by  doxygen 1.5.3