UnionClass.cc

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 #include "eyedb_p.h"
00026 #include <iostream>
00027 
00028 namespace eyedb {
00029 
00030 UnionClass::UnionClass(const char *s, Class *p) :
00031 AgregatClass(s, p)
00032 {
00033   parent = (p ? p : Union_Class);
00034   setClass(UnionClass_Class);
00035   type = _UnionClass_Type;
00036 }
00037 
00038 UnionClass::UnionClass(const char *s, const Oid *poid) :
00039 AgregatClass(s, poid)
00040 {
00041   parent = 0;
00042   setClass(UnionClass_Class);
00043   type = _UnionClass_Type;
00044 }
00045 
00046 UnionClass::UnionClass(Database *_db, const char *s,
00047                              Class *p) : AgregatClass(_db, s, p)
00048 {
00049   parent = (p ? p : Union_Class);
00050   setClass(UnionClass_Class);
00051   type = _UnionClass_Type;
00052 }
00053 
00054 UnionClass::UnionClass(Database *_db, const char *s,
00055                              const Oid *poid) : AgregatClass(_db, s, poid)
00056 {
00057   parent = 0;
00058   setClass(UnionClass_Class);
00059   type = _UnionClass_Type;
00060 }
00061 
00062 Status
00063 UnionClass::loadComplete(const Class *cl)
00064 {
00065   assert(cl->asUnionClass());
00066   Status s = Class::loadComplete(cl);
00067   if (s) return s;
00068   return Success;
00069 }
00070 
00071 Object *UnionClass::newObj(Database *_db) const
00072 {
00073   if (!idr_objsz)
00074     return 0;
00075 
00076   Union *t = new Union(_db);
00077 
00078   ObjectPeer::make(t, this, 0, _Union_Type, idr_objsz,
00079                       idr_psize, idr_vsize);
00080   newObjRealize(t);
00081   return t;
00082 }
00083 
00084 Object *UnionClass::newObj(Data data, Bool _copy) const
00085 {
00086   if (!idr_objsz)
00087     return 0;
00088 
00089   Union *t = new Union();
00090 
00091   ObjectPeer::make(t, this, data, _Union_Type, idr_objsz,
00092                       idr_psize, idr_vsize, _copy);
00093   newObjRealize(t);
00094   return t;
00095 }
00096 
00097 }

Generated on Mon Dec 22 18:16:11 2008 for eyedb by  doxygen 1.5.3