1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2008 by the OpenSG Forum *
9 * contact: dirk@opensg.org, vossg@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
41 template<class ContainerT> inline
42 VRMLNodeHelper *VRMLGenericHelper<ContainerT>::create(void)
44 return new VRMLGenericHelper<ContainerT>();
48 template<class ContainerT> inline
49 VRMLGenericHelper<ContainerT>::~VRMLGenericHelper(void)
53 template<class ContainerT> inline
54 void VRMLGenericHelper<ContainerT>::init(const Char8 *szName)
56 Inherited::init(szName);
59 indentLog(getIndent(), PINFO);
60 PINFO << "GenericHelper::init : " << szName << std::endl;
63 _pNodeProto = Node ::create();
64 _pNodeCoreProto = ContainerT::create();
66 _pGenAttProto = VRMLGenericAtt::createLocal(FCLocal::Cluster);
67 _pGenAttProto->setInternal(true);
70 template<class ContainerT> inline
71 void VRMLGenericHelper<ContainerT>::mapFieldname(
72 const std::string &szVRMLNodeName,
73 std::string &szFieldName )
75 if(_mFieldNameMap.empty() == false)
77 FieldNameMapConstIt nIt = _mFieldNameMap.find(szFieldName);
79 if(nIt != _mFieldNameMap.end())
81 szFieldName = nIt->second;
86 template<class ContainerT> inline
87 bool VRMLGenericHelper<ContainerT>::prototypeAddField(
88 const Char8 *szFieldType,
89 const UInt32 uiFieldTypeId,
90 const Char8 *szFieldName)
92 if(szFieldName == NULL)
95 std::string szDummyVRMLNodeName;
96 std::string szTmpFieldName(szFieldName);
98 this->mapFieldname(szDummyVRMLNodeName, szTmpFieldName);
100 return Inherited::prototypeAddField(szFieldType,
102 szTmpFieldName.c_str());
105 template<class ContainerT> inline
106 void VRMLGenericHelper<ContainerT>::getFieldAndDesc (
107 FieldContainer * pFC,
108 const Char8 * szFieldname,
109 FieldContainer *&pFieldFC,
110 EditFieldHandlePtr &pField,
111 const FieldDescriptionBase *&pDesc)
113 if(szFieldname == NULL)
116 std::string szDummyVRMLNodeName;
117 std::string szTmpFieldName(szFieldname);
119 this->mapFieldname(szDummyVRMLNodeName, szTmpFieldName);
121 Inherited::getFieldAndDesc(pFC,
122 szTmpFieldName.c_str(),
129 template<class ContainerT> inline
130 void VRMLGenericHelper<ContainerT>::dump(const Char8 *szNodeName)
134 template<class ContainerT> inline
135 VRMLGenericHelper<ContainerT>::VRMLGenericHelper(void) :