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 #ifndef _OSGSHAREPTRGRAPHOP_H_ 00040 #define _OSGSHAREPTRGRAPHOP_H_ 00041 00042 #ifdef __sgi 00043 # pragma once 00044 #endif 00045 00046 #include <map> 00047 #include <set> 00048 #include <vector> 00049 00050 #include <OSGConfig.h> 00051 #include <OSGSystemDef.h> 00052 00053 #include <OSGGraphOp.h> 00054 00055 OSG_BEGIN_NAMESPACE 00056 00059 00060 class OSG_SYSTEMLIB_DLLMAPPING SharePtrGraphOp : public GraphOp 00061 { 00062 /*========================== PUBLIC =================================*/ 00063 public: 00064 00065 /*---------------------------------------------------------------------*/ 00069 static const char *getClassname(void) { return "SharePtrGraphOp"; }; 00070 00072 /*---------------------------------------------------------------------*/ 00076 SharePtrGraphOp(const char* name = "SharePtr"); 00077 00078 GraphOp *create(); 00079 00081 /*---------------------------------------------------------------------*/ 00085 virtual ~SharePtrGraphOp(void); 00086 00088 /*---------------------------------------------------------------------*/ 00092 bool traverse(NodePtr& root); 00093 00095 /*---------------------------------------------------------------------*/ 00099 void setParams(const std::string params); 00100 00101 void setIncludes(const std::string &includes); 00102 void setExcludes(const std::string &excludes); 00103 00104 std::string usage(void); 00105 00108 /*========================= PROTECTED ===============================*/ 00109 protected: 00110 00111 /*========================== PRIVATE ================================*/ 00112 private: 00113 00114 Action::ResultE traverseEnter(NodePtr& node); 00115 Action::ResultE traverseLeave(NodePtr& node, Action::ResultE res); 00116 00117 bool isInList(const std::vector<std::string> &tlist, 00118 const FieldContainerPtr &fc); 00119 FieldContainerPtr compareFCs(const FieldContainerPtr &fc); 00120 static bool isEqual(const osg::FieldContainerPtr &a, 00121 const osg::FieldContainerPtr &b); 00122 00123 static Action::ResultE clearAttachmentParent(NodePtr &node); 00124 static Action::ResultE addAttachmentParent(NodePtr &node); 00125 static void fillAttachmentParents(const NodePtr &node); 00126 00127 typedef std::set<FieldContainerPtr> fcsSet; 00128 typedef std::map<std::string, fcsSet> fcsMap; 00129 fcsMap _fctypes; 00130 00131 std::vector<std::string> _includes; 00132 std::vector<std::string> _excludes; 00133 UInt32 _share_counter; 00134 00135 static std::set<FieldContainerPtr> _added_cores; 00136 }; 00137 00138 OSG_END_NAMESPACE 00139 00140 #endif /* _OSGSHAREPTRGRAPHOP_H_ */
1.4.3