changed: gcc8 base update
[opensg.git] / Source / Contrib / ComputeBase / Base / OSGComputeFunctorFieldTraits.h
blob636e9fb53345a7d026449c412c3d20ef11bae7e6
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2003 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGCOMPUTEFUNCTORFIELDTRAITS_H_
40 #define _OSGCOMPUTEFUNCTORFIELDTRAITS_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGFieldTraits.h"
46 #include "OSGDataType.h"
48 #include "OSGContainerForwards.h"
49 #include "OSGContribComputeBaseDef.h"
51 OSG_BEGIN_NAMESPACE
53 class HardwareContext;
55 typedef boost::function<void (HardwareContext *, DrawEnv *)> ComputeFunctor;
57 struct ComputeFunctorCallback
59 ComputeFunctor _func;
60 UInt32 _uiId;
61 std::string _createSymbol;
63 typedef std::allocator<void> Alloc;
65 ComputeFunctorCallback(void) : _func(), _uiId(), _createSymbol() {}
68 #if !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
70 #ifdef OSG_DOC_FILES_IN_MODULE
71 /*! \file
72 \ingroup
73 \ingroup
75 #endif
77 /*! \ingroup
79 #if !defined(OSG_DOC_DEV_TRAITS)
80 /*! \hideinhierarchy */
81 #endif
83 template <>
84 struct FieldTraits<ComputeFunctorCallback> :
85 public FieldTraitsTemplateBase<ComputeFunctorCallback>
87 private:
89 static DataType _type;
91 public:
93 typedef FieldTraits<ComputeFunctorCallback> Self;
96 enum { Convertible = Self::NotConvertible };
98 static OSG_CONTRIBCOMPUTEBASE_DLLMAPPING
99 DataType &getType (void);
101 static const Char8 *getSName (void)
103 return "SFComputeFunctorCallback";
106 static const Char8 *getMName (void)
108 return "MFComputeFunctorCallback";
111 static SizeT getBinSize(const ComputeFunctorCallback &)
113 return 0;
116 static SizeT getBinSize(const ComputeFunctorCallback *,
117 SizeT uiNumObjects)
119 return 0 * uiNumObjects;
122 static void copyToBin( BinaryDataHandler &pMem,
123 const ComputeFunctorCallback &pObject)
125 #if 0
126 UInt32 containerId;
128 if(pObject == NullFC)
130 // containerId=0 indicates an Null Ptr
131 containerId = 0;
133 else
135 containerId = pObject->getId();
138 pMem.putValue(containerId);
139 #endif
142 static void copyToBin( BinaryDataHandler &pMem,
143 const ComputeFunctorCallback *pObjectStore,
144 SizeT uiNumObjects)
146 #if 0
147 for(UInt32 i = 0; i < uiNumObjects; i++)
149 copyToBin(pMem, pObjectStore[i]);
151 #endif
154 static void copyFromBin(BinaryDataHandler &pMem,
155 ComputeFunctorCallback &pObject)
157 #if 0
158 UInt32 containerId;
160 pMem.getValue(containerId);
162 if(0 != containerId)
164 pObject = FieldContainerFactory::the()->getMappedContainer(containerId);
166 else
168 pObject = NullFC;
170 #endif
173 static void copyFromBin(BinaryDataHandler &pMem,
174 ComputeFunctorCallback *pObjectStore,
175 SizeT uiNumObjects)
177 #if 0
178 for(UInt32 i = 0; i < uiNumObjects; i++)
180 copyFromBin(pMem, pObjectStore[i]);
182 #endif
187 #if !defined(OSG_DOC_DEV_TRAITS)
188 /*! \class FieldTraitsTemplateBase<NodeCorePtr> */
189 /*! \hideinhierarchy */
190 #endif
192 #endif // !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)
194 OSG_END_NAMESPACE
196 #endif /* _OSGCOMPUTEFUNCTORFIELDTRAITS_H_ */