00001 /*************************************************************************** 00002 * Copyright (c) Riegel <juergen.riegel@web.de> * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #include "PreCompiled.h" 00025 00026 #ifndef _PreComp_ 00027 # include <assert.h> 00028 #endif 00029 00031 #include "BaseClass.h" 00032 #include "PyObjectBase.h" 00033 00034 using namespace Base; 00035 00036 Type BaseClass::classTypeId = Base::Type::badType(); 00037 00038 00039 //************************************************************************** 00040 // Construction/Destruction 00041 00046 BaseClass::BaseClass() 00047 { 00048 00049 } 00050 00055 BaseClass::~BaseClass() 00056 { 00057 } 00058 00059 00060 //************************************************************************** 00061 // separator for other implemetation aspects 00062 00063 void BaseClass::init(void) 00064 { 00065 assert(BaseClass::classTypeId == Type::badType() && "don't init() twice!"); 00066 /* Make sure superclass gets initialized before subclass. */ 00067 /*assert(strcmp(#_parentclass_), "inherited"));*/ 00068 /*Type parentType(Type::fromName(#_parentclass_));*/ 00069 /*assert(parentType != Type::badType() && "you forgot init() on parentclass!");*/ 00070 00071 /* Set up entry in the type system. */ 00072 BaseClass::classTypeId = 00073 Type::createType(Type::badType(), 00074 "Base::BaseClass", 00075 BaseClass::create); 00076 } 00077 00078 Type BaseClass::getClassTypeId(void) 00079 { 00080 return BaseClass::classTypeId; 00081 } 00082 00083 Type BaseClass::getTypeId(void) const 00084 { 00085 return BaseClass::classTypeId; 00086 } 00087 00088 00089 void BaseClass::initSubclass(Base::Type &toInit,const char* ClassName, const char *ParentName, 00090 Type::instantiationMethod method) 00091 { 00092 // dont't init twice! 00093 assert(toInit == Base::Type::badType()); 00094 // get the parent class 00095 Base::Type parentType(Base::Type::fromName(ParentName)); 00096 // forgot init parent! 00097 assert(parentType != Base::Type::badType() ); 00098 00099 // create the new type 00100 toInit = Base::Type::createType(parentType, ClassName, method); 00101 } 00102 00113 PyObject *BaseClass::getPyObject(void) 00114 { 00115 assert(0); 00116 Py_Return; 00117 } 00118 00119 void BaseClass::setPyObject(PyObject *) 00120 { 00121 assert(0); 00122 }