00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002,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 _OSGNODEPTRDEPIMPL_INL_ 00040 #define _OSGNODEPTRDEPIMPL_INL_ 00041 00042 #ifdef OSG_DOC_FILES_IN_MODULE 00043 00046 #endif 00047 00048 OSG_BEGIN_NAMESPACE 00049 00050 /*-------------------------------------------------------------------------*/ 00051 /* Constructors */ 00052 00053 inline 00054 NodePtr::NodePtr(const CNodePtr &source) : 00055 Inherited(source) 00056 { 00057 } 00058 00059 inline 00060 NodePtr::NodePtr(const Node *source) : 00061 Inherited(source) 00062 { 00063 } 00064 00065 inline 00066 NodePtr::NodePtr(const Node *source, 00067 const UInt16 uiSize, 00068 const UInt16 uiParentPos) : 00069 00070 Inherited(source, uiSize, uiParentPos) 00071 { 00072 } 00073 00074 template <class InTypeT> inline 00075 NodePtr NodePtr::dcast(const InTypeT oIn) 00076 { 00077 return NodePtr( 00078 (dynamic_cast<const Node *>(oIn.getCPtr())), 00079 oIn.getContainerSize(), 00080 oIn.getParentFieldPos()); 00081 } 00082 00083 inline 00084 void NodePtr::operator = (const CNodePtr &source) 00085 { 00086 // copy parts inherited from parent 00087 *(static_cast<Inherited *>(this)) = source; 00088 } 00089 00090 /*-------------------------------------------------------------------------*/ 00091 /* Pointer */ 00092 00093 inline 00094 NodePtr::NodePtr(const Node &source) : 00095 Inherited(source) 00096 { 00097 } 00098 00099 inline 00100 NodePtr Node::getPtr(void) const 00101 { 00102 return NodePtr(*this); 00103 } 00104 00105 inline 00106 NodeCorePtr Node::getCore(void) 00107 { 00108 return _sfCore.getValue(); 00109 } 00110 00111 inline 00112 NodeCorePtr Node::getCore(void) const 00113 { 00114 return _sfCore.getValue(); 00115 } 00116 00117 /*-------------------------------------------------------------------------*/ 00118 /* Core */ 00119 00120 inline 00121 NodeCore *NodePtr::getCore(void) 00122 { 00123 return ((Node *) getElemP(Thread::getAspect()))->getCore().getCPtr(); 00124 } 00125 00126 inline 00127 NodeCore *NodePtr::getCore(void) const 00128 { 00129 return ((Node *) getElemP(Thread::getAspect()))->getCore().getCPtr(); 00130 } 00131 00132 inline 00133 void Node::onCreate(const Node *source) 00134 { 00135 if(source == NULL) 00136 return; 00137 00138 setCore(source->getCore()); 00139 00140 AttachmentMap::const_iterator fcI = 00141 source->_attachmentMap.getValue().begin(); 00142 AttachmentMap::const_iterator fcEnd = 00143 source->_attachmentMap.getValue().end(); 00144 00145 while(fcI != fcEnd) 00146 { 00147 addAttachment((*fcI).second); 00148 00149 ++fcI; 00150 } 00151 } 00152 00153 OSG_FIELD_CONTAINER_INL_DEF(Node, NodePtr) 00154 00155 inline 00156 NodePtr Node::clone(void) 00157 { 00158 return cloneTree(getPtr()); 00159 } 00160 00161 OSG_END_NAMESPACE 00162 00163 #define OSGNODEPTRDEP_INLINE_CVSID "@(#)$Id: $" 00164 00165 #endif /* _OSGNODEPTRIMPL_INL_ */
1.4.3