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

OSGFieldContainerFieldDataType.h

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 #ifndef _OSG_FIELDCONTAINERFIELDDATATYPE_H_
00040 #define _OSG_FIELDCONTAINERFIELDDATATYPE_H_
00041 
00042 #include <OSGFieldDataType.h>
00043 #include <OSGFieldContainerPtr.h>
00044 #include <OSGFieldContainerFactory.h>
00045 #include <OSGFieldContainerType.h>
00046 
00047 OSG_BEGIN_NAMESPACE
00048 
00049 #if !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
00050 
00051 #ifdef OSG_DOC_FILES_IN_MODULE
00052 
00056 #endif
00057 
00060 #if !defined(OSG_DOC_DEV_TRAITS)
00061 
00062 #endif
00063 
00064 template <>
00065 struct FieldTraitsRecurseMapper<FieldContainerPtr, false> : 
00066     public FieldTraitsRecurseBase<FieldContainerPtr>
00067 {
00068     enum                    { bHasParent = 0x00       };
00069 
00070     static UInt32 getBinSize(const FieldContainerPtr &)
00071     {
00072         return sizeof(UInt32);
00073     }
00074 
00075     static UInt32 getBinSize(const FieldContainerPtr *,
00076                                    UInt32             uiNumObjects)
00077     {
00078         return sizeof(UInt32) * uiNumObjects;
00079     }
00080 
00081     static void copyToBin(      BinaryDataHandler &pMem, 
00082                           const FieldContainerPtr &pObject)
00083     {
00084         UInt32 id;
00085 
00086         if(pObject==NullFC)
00087         {
00088             // id=0 indicates an Null Ptr
00089             id = 0;
00090         }
00091         else
00092         {
00093             id = pObject.getFieldContainerId();
00094         }
00095 
00096         pMem.putValue(id);
00097     }
00098 
00099     static void copyToBin(      BinaryDataHandler &pMem, 
00100                           const FieldContainerPtr *pObjectStore,
00101                                 UInt32             uiNumObjects)
00102     {
00103         for(UInt32 i = 0; i < uiNumObjects; i++)
00104         {
00105             copyToBin(pMem, pObjectStore[i]);
00106         }
00107     }
00108 
00109     static void copyFromBin(BinaryDataHandler &pMem, 
00110                             FieldContainerPtr &pObject)
00111     {
00112         UInt32 id;
00113 
00114         pMem.getValue(id);
00115 
00116         if(0 != id)
00117         {
00118             pObject = FieldContainerFactory::the()->getMappedContainer(id);
00119         }
00120         else
00121         {
00122             pObject = NullFC;
00123         }
00124     }
00125 
00126     static void copyFromBin(BinaryDataHandler &pMem, 
00127                             FieldContainerPtr *pObjectStore,
00128                             UInt32             uiNumObjects)
00129     {
00130         for(UInt32 i = 0; i < uiNumObjects; i++)
00131         {
00132             copyFromBin(pMem, pObjectStore[i]);
00133         }
00134     }
00135 
00136     static bool      getFromString(FieldContainerPtr& OSG_CHECK_ARG(outVal),
00137                                    const Char8     *& OSG_CHECK_ARG(inVal ) )
00138     {
00139         //TO_BE_DONE
00140         return false;
00141     }
00142     
00143     static void      putToString  (const FieldContainerPtr &inVal,
00144                                          std::string       &outVal)
00145     {
00146         typedef TypeTraits<UInt16> TypeTrait;
00147 
00148         Char8 buffer[15];
00149 
00150         sprintf(buffer, "%p", inVal.getBaseCPtr());
00151 
00152         outVal = buffer;
00153     }
00154 };
00155 
00156 #if !defined(OSG_DOC_DEV_TRAITS)
00157 
00159 #endif
00160 
00163 #if !defined(OSG_DOC_DEV_TRAITS)
00164 
00165 #endif
00166 
00167 template <>
00168 struct OSG_SYSTEMLIB_DLLMAPPING FieldDataTraits<FieldContainerPtr> : 
00169     public FieldTraitsRecurseMapper<FieldContainerPtr, false>
00170 {
00171     static DataType                 _type;
00172 
00173     enum                            { StringConvertable = ToStringConvertable};
00174 
00175     static DataType &getType (void) { return _type;                          }
00176  
00177     static char     *getSName(void) { return "SFFieldContainerPtr";          }
00178     static char     *getMName(void) { return "MFFieldContainerPtr";          }
00179 };
00180 
00181 #if !defined(OSG_DOC_DEV_TRAITS)
00182 
00184 #endif
00185 
00186 #endif // !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
00187 
00188 OSG_END_NAMESPACE
00189 
00190 #define OSGFIELDCONTAINERFIELDDATATYPE_HEADER_CVSID "@(#)$Id: $"
00191 
00192 #endif /* _OSG_FIELDCONTAINERDATATYPE_H_ */
00193 
00194 
00195 
00196 
00197 
00198 
00199 

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