changed: gcc8 base update
[opensg.git] / Source / Contrib / ComputeBase / Base / OSGComputeAlgorithm.h
blobb5df66838300aca16423272ac70ca85e81419fbb
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 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 _OSGCOMPUTEALGORITHM_H_
40 #define _OSGCOMPUTEALGORITHM_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include <queue>
47 #include "OSGComputeAlgorithmBase.h"
48 #include "OSGAction.h"
49 #include "OSGDrawTask.h"
51 OSG_BEGIN_NAMESPACE
53 class DrawEnv;
54 class Action;
56 //! Stage
57 //! \ingroup GrpSystemNodeCoresMisc
59 class OSG_CONTRIBCOMPUTEBASE_DLLMAPPING ComputeAlgorithm :
60 public ComputeAlgorithmBase
62 /*========================== PUBLIC =================================*/
64 public:
66 /*---------------------------------------------------------------------*/
67 /*! \name Sync */
68 /*! \{ */
70 virtual void changed(ConstFieldMaskArg whichField,
71 UInt32 origin,
72 BitVector detail);
74 /*---------------------------------------------------------------------*/
75 /*! \name Execute */
76 /*! \{ */
78 virtual Action::ResultE renderEnter(Action *pAction ) = 0;
79 virtual Action::ResultE renderLeave(Action *pAction ) = 0;
80 virtual void execute (HardwareContext *pContext,
81 DrawEnv *pEnv ) = 0;
83 /*! \} */
84 /*---------------------------------------------------------------------*/
85 /*! \name Dump */
86 /*! \{ */
88 virtual void dump( UInt32 uiIndent = 0,
89 const BitVector bvFlags = 0) const;
91 /*! \} */
92 /*========================= PROTECTED ===============================*/
94 protected:
96 typedef ComputeAlgorithmBase Inherited;
98 /*---------------------------------------------------------------------*/
99 /*! \name Constructors */
100 /*! \{ */
102 ComputeAlgorithm(void);
103 ComputeAlgorithm(const ComputeAlgorithm &source);
105 /*! \} */
106 /*---------------------------------------------------------------------*/
107 /*! \name Destructors */
108 /*! \{ */
110 virtual ~ComputeAlgorithm(void);
112 /*! \} */
113 /*---------------------------------------------------------------------*/
114 /*! \name Draw */
115 /*! \{ */
117 /*! \} */
118 /*---------------------------------------------------------------------*/
119 /*! \name Init */
120 /*! \{ */
122 static void initMethod(InitPhase ePhase);
124 /*! \} */
125 /*========================== PRIVATE ================================*/
127 private:
129 friend class FieldContainer;
130 friend class ComputeAlgorithmBase;
132 /*---------------------------------------------------------------------*/
133 /*! \name thread local */
134 /*! \{ */
136 /*! \} */
137 /*---------------------------------------------------------------------*/
138 /*! \name load thread */
139 /*! \{ */
141 /*! \} */
142 /*---------------------------------------------------------------------*/
144 /*!\brief prohibit default function (move to 'public' if needed) */
145 void operator =(const ComputeAlgorithm &source);
148 typedef ComputeAlgorithm *ComputeAlgorithmP;
150 class OSG_CONTRIBCOMPUTEBASE_DLLMAPPING ComputeAlgorithmDrawTask :
151 public DrawTask
153 /*========================== PUBLIC =================================*/
155 public:
157 static const UInt32 Algorithm = Inherited::LastType + 1;
158 static const UInt32 AlgorithmWithBarrier = Inherited::LastType + 2;
159 static const UInt32 LastType = AlgorithmWithBarrier;
161 typedef DrawTask Inherited;
164 /*---------------------------------------------------------------------*/
165 /*! \name Statistic */
166 /*! \{ */
168 ComputeAlgorithmDrawTask(UInt32 uiType);
169 ComputeAlgorithmDrawTask(ComputeAlgorithmP pAlgorithm, UInt32 uiType);
171 /*! \} */
172 /*---------------------------------------------------------------------*/
173 /*! \name Access */
174 /*! \{ */
176 virtual void execute(HardwareContext *pContext, DrawEnv *pEnv);
178 /*! \} */
179 /*---------------------------------------------------------------------*/
180 /*! \name Access */
181 /*! \{ */
183 void activateBarrier(bool bVal );
184 void setAlgorithm (ComputeAlgorithmP pAlgorithm);
186 /*! \} */
187 /*---------------------------------------------------------------------*/
188 /*! \name Access */
189 /*! \{ */
191 void waitForBarrier(void);
193 /*! \} */
194 /*---------------------------------------------------------------------*/
195 /*! \name Access */
196 /*! \{ */
198 /*! \} */
199 /*---------------------------------------------------------------------*/
200 /*! \name Access */
201 /*! \{ */
203 virtual void dump(UInt32 uiIndent);
205 /*! \} */
206 /*========================= PROTECTED ===============================*/
208 protected:
210 /*---------------------------------------------------------------------*/
211 /*! \name Member */
212 /*! \{ */
214 ComputeAlgorithmUnrecPtr _pAlgorithm;
215 BarrierRefPtr _pBarrier;
217 /*! \} */
218 /*---------------------------------------------------------------------*/
219 /*! \name Destructor */
220 /*! \{ */
222 virtual ~ComputeAlgorithmDrawTask(void);
224 /*! \} */
225 /*========================== PRIVATE ================================*/
227 private:
229 /*! \brief prohibit default function (move to 'public' if needed) */
230 ComputeAlgorithmDrawTask(const ComputeAlgorithmDrawTask &source);
231 /*! \brief prohibit default function (move to 'public' if needed) */
232 void operator =(const ComputeAlgorithmDrawTask &source);
235 typedef RefCountPtr<ComputeAlgorithmDrawTask,
236 MemObjRefCountPolicy > ComputeAlgorithmDrawTaskRefPtr;
238 OSG_END_NAMESPACE
240 #include "OSGComputeAlgorithmBase.inl"
241 #include "OSGComputeAlgorithm.inl"
243 #endif /* _OSGCOMPUTEALGORITHM_H_ */