00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 00040 /***************************************************************************\ 00041 * Includes * 00042 \***************************************************************************/ 00043 00044 #include <OSGGraphOpFactory.h> 00045 00046 #include <OSGGeoTypeGraphOp.h> 00047 #include <OSGMakeTransparentGraphOp.h> 00048 #include <OSGMaterialMergeGraphOp.h> 00049 #include <OSGMergeGraphOp.h> 00050 #include <OSGPruneGraphOp.h> 00051 #include <OSGSharePtrGraphOp.h> 00052 #include <OSGSplitGraphOp.h> 00053 #include <OSGStripeGraphOp.h> 00054 #include <OSGVerifyGeoGraphOp.h> 00055 #include <OSGVerifyGraphOp.h> 00056 00057 OSG_USING_NAMESPACE 00058 00059 GraphOpFactory *GraphOpFactory::_the=NULL; 00060 00061 /***************************************************************************\ 00062 * Description * 00063 \***************************************************************************/ 00064 00072 /***************************************************************************\ 00073 * Instance methods * 00074 \***************************************************************************/ 00075 00076 /*-------------------------------------------------------------------------*\ 00077 - public - 00078 \*-------------------------------------------------------------------------*/ 00079 00080 00081 void GraphOpFactory::registerOp(GraphOp* prototype) 00082 { 00083 _typeMap[prototype->getName()]=prototype; 00084 } 00085 00086 void GraphOpFactory::unRegisterOp(GraphOp* prototype) 00087 { 00088 unRegisterOp(prototype->getName().c_str()); 00089 } 00090 00091 void GraphOpFactory::unRegisterOp(const char* name) 00092 { 00093 _typeMap.erase(name); 00094 } 00095 00096 GraphOp *GraphOpFactory::create(const char* name) 00097 { 00098 GraphOp *proto = _typeMap[name]; 00099 if (proto != NULL) 00100 return proto->create(); 00101 else 00102 return NULL; 00103 } 00104 00105 GraphOpFactory& GraphOpFactory::the() 00106 { 00107 if(_the == NULL) 00108 _the=new GraphOpFactory(); 00109 return *_the; 00110 } 00111 00112 GraphOpFactory::iterator GraphOpFactory::begin() 00113 { 00114 return _typeMap.begin();; 00115 } 00116 00117 GraphOpFactory::iterator GraphOpFactory::end() 00118 { 00119 return _typeMap.end();; 00120 } 00121 00122 /*-------------------------------------------------------------------------*\ 00123 - private - 00124 \*-------------------------------------------------------------------------*/ 00125 00126 GraphOpFactory::GraphOpFactory() 00127 { 00128 registerOp(new GeoTypeGraphOp); 00129 registerOp(new MakeTransparentGraphOp); 00130 registerOp(new MaterialMergeGraphOp); 00131 registerOp(new MergeGraphOp); 00132 registerOp(new PruneGraphOp); 00133 registerOp(new SharePtrGraphOp); 00134 registerOp(new SplitGraphOp); 00135 registerOp(new StripeGraphOp); 00136 registerOp(new VerifyGeoGraphOp); 00137 registerOp(new VerifyGraphOp); 00138 }
1.4.3