Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGScanParseFieldTypeMapper.inl

Go to the documentation of this file.
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 #include <stdlib.h>
00040 #include <stdio.h>
00041 
00042 #include "OSGConfig.h"
00043 
00044 #include <iostream>
00045 
00046 OSG_BEGIN_NAMESPACE
00047 
00048 /*-------------------------------------------------------------------------*/
00049 /*                            Constructors                                 */
00050 
00051 template <class BaseT> inline
00052 ScanParseFieldTypeMapper<BaseT>::ScanParseFieldTypeMapper(void) :
00053     Inherited(),
00054     _mIntExt (),
00055     _mExtInt ()
00056 
00057 {
00058     Inherited::setMapTypeIds(true);
00059 }
00060 
00061 /*-------------------------------------------------------------------------*/
00062 /*                             Destructor                                  */
00063 
00064 template <class BaseT> inline
00065 ScanParseFieldTypeMapper<BaseT>::~ScanParseFieldTypeMapper(void)
00066 {
00067 }
00068 
00069 /*-------------------------------------------------------------------------*/
00070 /*                                Set                                      */
00071 
00072 template <class BaseT> inline
00073 void ScanParseFieldTypeMapper<BaseT>::setIntExtMapping(
00074     UInt32            uiMappedType,
00075     BuildInFieldTypes eBuildInType)
00076 {
00077     _mExtInt[uiMappedType] = eBuildInType;
00078 }
00079 
00080 template <class BaseT> inline
00081 void ScanParseFieldTypeMapper<BaseT>::setExtIntMapping(
00082     BuildInFieldTypes eBuildInType,
00083     UInt32            uiMappedType)
00084 {
00085     _mIntExt[eBuildInType] = uiMappedType;
00086 }
00087 
00088 /*-------------------------------------------------------------------------*/
00089 /*                                Map                                      */
00090 
00091 template <class BaseT> inline
00092 Int32 ScanParseFieldTypeMapper<BaseT>::mapExtIntFieldType(
00093     const Char8 *,
00094     const Int32  iFieldTypeId)
00095 {
00096     typename ExtIntMap::iterator gMIt = _mExtInt.find(iFieldTypeId);
00097 
00098     if(gMIt != _mExtInt.end())
00099     {
00100         return gMIt->second;
00101     }
00102     else
00103     {
00104         return -iFieldTypeId;
00105     }
00106 }
00107 
00108 template <class BaseT> inline
00109 Int32 ScanParseFieldTypeMapper<BaseT>::mapIntExtFieldType(
00110     const Char8 *,
00111     const Int32  iFieldTypeId)
00112 {
00113     typename IntExtMap::iterator gMIt = _mIntExt.find(
00114         (BuildInFieldTypes) iFieldTypeId);
00115 
00116     if(gMIt != _mIntExt.end())
00117     {
00118         return gMIt->second;
00119     }
00120     else
00121     {
00122         return -iFieldTypeId;
00123     }
00124 }
00125 
00126 OSG_END_NAMESPACE
00127 
00128 #define OSGSCANPARSEFIELDTYPEMAPPER_INLINE_CVSID "@(#)$Id: $"
00129 
00130 

Generated on Thu Aug 25 04:09:07 2005 for OpenSG by  doxygen 1.4.3