1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2003 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 \*---------------------------------------------------------------------------*/
45 #include "OSGTypeBase.h"
46 #include "OSGMemoryObject.h"
47 #include "OSGBaseRefCountPolicies.h"
48 #include "OSGRefCountPtr.h"
49 #include "OSGTransitPtr.h"
50 #include "OSGStringUtils.h"
62 typedef BaseThread
*(*CreateThreadF
)(const Char8
*szName
,
65 typedef Barrier
*(*CreateBarrierF
)(const Char8
*szName
,
68 typedef CondVar
*(*CreateCondVarF
)(const Char8
*szName
,
71 typedef Lock
*(*CreateLockF
)(const Char8
*szName
,
74 typedef LockPool
*(*CreateLockPoolF
)(const Char8
*szName
,
77 typedef Semaphore
*(*CreateSemaphoreF
)(const Char8
*szName
,
80 typedef void (*InitThreadingF
) (void);
82 //---------------------------------------------------------------------------
84 //---------------------------------------------------------------------------
86 /*! \ingroup GrpBaseMultiThreading
87 \ingroup GrpLibOSGBase
90 class OSG_BASE_DLLMAPPING MPType
: public TypeBase
92 /*========================== PRIVATE ================================*/
96 /*========================== PUBLIC =================================*/
100 /*---------------------------------------------------------------------*/
101 /*! \name Constructor */
104 MPType(const Char8
*szName
,
105 const Char8
*szParentName
,
106 const UInt32 uiNamespace
= GlobalNamespace
);
109 /*---------------------------------------------------------------------*/
110 /*! \name Destructor */
113 virtual ~MPType(void);
116 /*========================= PROTECTED ===============================*/
120 /*========================== PRIVATE ================================*/
122 typedef TypeBase Inherited
;
126 /*!\brief prohibit default function (move to 'public' if needed) */
127 MPType(const MPType
&source
);
128 /*!\brief prohibit default function (move to 'public' if needed) */
129 void operator =(const MPType
&source
);
135 //---------------------------------------------------------------------------
137 //---------------------------------------------------------------------------
139 /*! \ingroup GrpBaseMultiThreading
140 \ingroup GrpLibOSGBase
143 class OSG_BASE_DLLMAPPING MPThreadType
: public MPType
145 /*========================== PRIVATE ================================*/
149 /*========================== PUBLIC =================================*/
153 /*---------------------------------------------------------------------*/
154 /*! \name Constructor */
157 MPThreadType(const Char8
*szName
,
158 const Char8
*szParentName
,
159 CreateThreadF fCreateThread
,
160 InitThreadingF fInitThreading
,
161 const UInt32 uiNamespace
= GlobalNamespace
);
164 /*---------------------------------------------------------------------*/
165 /*! \name Destructor */
168 virtual ~MPThreadType(void);
171 /*---------------------------------------------------------------------*/
172 /*! \name Construction */
175 BaseThread
*create(const Char8
*szName
, bool bGlobal
);
178 /*========================= PROTECTED ===============================*/
182 typedef MPType Inherited
;
184 /*---------------------------------------------------------------------*/
185 /*! \name Class Specific */
188 static UInt32 _uiThreadCount
;
189 CreateThreadF _fCreateThread
;
192 /*========================== PRIVATE ================================*/
196 /*!\brief prohibit default function (move to 'public' if needed) */
197 MPThreadType(const MPThreadType
&source
);
198 /*!\brief prohibit default function (move to 'public' if needed) */
199 void operator =(const MPThreadType
&source
);
205 //---------------------------------------------------------------------------
207 //---------------------------------------------------------------------------
209 /*! \ingroup GrpBaseMultiThreading
210 \ingroup GrpLibOSGBase
213 class OSG_BASE_DLLMAPPING MPBarrierType
: public MPType
215 /*========================== PRIVATE ================================*/
219 /*========================== PUBLIC =================================*/
223 /*---------------------------------------------------------------------*/
224 /*! \name Constructor */
227 MPBarrierType(const Char8
*szName
,
228 const Char8
*szParentName
,
229 CreateBarrierF fCreateBarrier
,
230 const UInt32 uiNamespace
= GlobalNamespace
);
233 /*---------------------------------------------------------------------*/
234 /*! \name Destructor */
237 virtual ~MPBarrierType(void);
240 /*---------------------------------------------------------------------*/
241 /*! \name Construction */
244 Barrier
*create(const Char8
*szName
, bool bGlobal
);
247 /*========================= PROTECTED ===============================*/
251 typedef MPType Inherited
;
253 /*---------------------------------------------------------------------*/
254 /*! \name Class Specific */
257 static UInt32 _uiBarrierCount
;
258 CreateBarrierF _fCreateBarrier
;
261 /*========================== PRIVATE ================================*/
265 /*!\brief prohibit default function (move to 'public' if needed) */
266 MPBarrierType(const MPBarrierType
&source
);
267 /*!\brief prohibit default function (move to 'public' if needed) */
268 void operator =(const MPBarrierType
&source
);
271 //---------------------------------------------------------------------------
273 //---------------------------------------------------------------------------
275 /*! \ingroup GrpBaseMultiThreading
276 \ingroup GrpLibOSGBase
279 class OSG_BASE_DLLMAPPING MPCondVarType
: public MPType
281 /*========================== PRIVATE ================================*/
285 /*========================== PUBLIC =================================*/
289 /*---------------------------------------------------------------------*/
290 /*! \name Constructor */
293 MPCondVarType(const Char8
*szName
,
294 const Char8
*szParentName
,
295 CreateCondVarF fCreateCondVar
,
296 const UInt32 uiNamespace
= GlobalNamespace
);
299 /*---------------------------------------------------------------------*/
300 /*! \name Destructor */
303 virtual ~MPCondVarType(void);
306 /*---------------------------------------------------------------------*/
307 /*! \name Construction */
310 CondVar
*create(const Char8
*szName
, bool bGlobal
);
313 /*========================= PROTECTED ===============================*/
316 typedef MPType Inherited
;
318 /*---------------------------------------------------------------------*/
319 /*! \name Class Specific */
322 static UInt32 _uiCondVarCount
;
323 CreateCondVarF _fCreateCondVar
;
326 /*========================== PRIVATE ================================*/
330 /*!\brief prohibit default function (move to 'public' if needed) */
331 MPCondVarType(const MPCondVarType
&source
);
332 /*!\brief prohibit default function (move to 'public' if needed) */
333 void operator =(const MPCondVarType
&source
);
338 //---------------------------------------------------------------------------
340 //---------------------------------------------------------------------------
342 /*! \ingroup GrpBaseMultiThreading
343 \ingroup GrpLibOSGBase
346 class OSG_BASE_DLLMAPPING MPLockType
: public MPType
348 /*========================== PRIVATE ================================*/
352 /*========================== PUBLIC =================================*/
356 /*---------------------------------------------------------------------*/
357 /*! \name Constructor */
360 MPLockType(const Char8
*szName
,
361 const Char8
*szParentName
,
362 CreateLockF fCreateLock
,
363 const UInt32 uiNamespace
= GlobalNamespace
);
366 /*---------------------------------------------------------------------*/
367 /*! \name Destructor */
370 virtual ~MPLockType(void);
373 /*---------------------------------------------------------------------*/
374 /*! \name Construction */
377 Lock
*create(const Char8
*szName
, bool bGlobal
);
380 /*========================= PROTECTED ===============================*/
383 typedef MPType Inherited
;
385 /*---------------------------------------------------------------------*/
386 /*! \name Class Specific */
389 static UInt32 _uiLockCount
;
390 CreateLockF _fCreateLock
;
393 /*========================== PRIVATE ================================*/
397 /*!\brief prohibit default function (move to 'public' if needed) */
398 MPLockType(const MPLockType
&source
);
399 /*!\brief prohibit default function (move to 'public' if needed) */
400 void operator =(const MPLockType
&source
);
406 //---------------------------------------------------------------------------
408 //---------------------------------------------------------------------------
410 /*! \ingroup GrpBaseMultiThreading
411 \ingroup GrpLibOSGBase
413 class OSG_BASE_DLLMAPPING MPLockPoolType
: public MPType
415 /*========================== PRIVATE ================================*/
419 /*========================== PUBLIC =================================*/
423 /*---------------------------------------------------------------------*/
424 /*! \name Constructor */
427 MPLockPoolType(const Char8
*szName
,
428 const Char8
*szParentName
,
429 CreateLockPoolF fCreateLockPool
,
430 const UInt32 uiNamespace
= GlobalNamespace
);
433 /*---------------------------------------------------------------------*/
434 /*! \name Destructor */
437 virtual ~MPLockPoolType(void);
440 /*---------------------------------------------------------------------*/
441 /*! \name Construction */
444 LockPool
*create(const Char8
*szName
, bool bGlobal
);
447 /*========================= PROTECTED ===============================*/
451 typedef MPType Inherited
;
453 /*---------------------------------------------------------------------*/
454 /*! \name Class Specific */
457 static UInt32 _uiLockPoolCount
;
458 CreateLockPoolF _fCreateLockPool
;
461 /*========================== PRIVATE ================================*/
465 /*!\brief prohibit default function (move to 'public' if needed) */
466 MPLockPoolType(const MPLockPoolType
&source
);
467 /*!\brief prohibit default function (move to 'public' if needed) */
468 void operator =(const MPLockPoolType
&source
);
473 //---------------------------------------------------------------------------
475 //---------------------------------------------------------------------------
477 /*! \ingroup GrpBaseMultiThreading
478 \ingroup GrpLibOSGBase
481 class OSG_BASE_DLLMAPPING MPSemaphoreType
: public MPType
483 /*========================== PRIVATE ================================*/
487 /*========================== PUBLIC =================================*/
491 /*---------------------------------------------------------------------*/
492 /*! \name Constructor */
495 MPSemaphoreType(const Char8
*szName
,
496 const Char8
*szParentName
,
497 CreateSemaphoreF fCreateSemaphore
,
498 const UInt32 uiNamespace
= GlobalNamespace
);
501 /*---------------------------------------------------------------------*/
502 /*! \name Destructor */
505 virtual ~MPSemaphoreType(void);
508 /*---------------------------------------------------------------------*/
509 /*! \name Construction */
512 Semaphore
*create(const Char8
*szName
, bool bGlobal
);
515 /*========================= PROTECTED ===============================*/
518 typedef MPType Inherited
;
520 /*---------------------------------------------------------------------*/
521 /*! \name Class Specific */
524 static UInt32 _uiSemaphoreCount
;
525 CreateSemaphoreF _fCreateSemaphore
;
528 /*========================== PRIVATE ================================*/
532 /*!\brief prohibit default function (move to 'public' if needed) */
533 MPSemaphoreType(const MPSemaphoreType
&source
);
534 /*!\brief prohibit default function (move to 'public' if needed) */
535 void operator =(const MPSemaphoreType
&source
);
540 //---------------------------------------------------------------------------
542 //---------------------------------------------------------------------------
544 /*! \ingroup GrpBaseMultiThreading
545 \ingroup GrpLibOSGBase
547 class OSG_BASE_DLLMAPPING MPBase
: public MemoryObject
549 /*========================== PUBLIC =================================*/
552 /*---------------------------------------------------------------------*/
553 /*! \name Class Get */
556 static const MPType
&getStaticType (void);
557 static UInt32
getStaticTypeId(void);
560 /*---------------------------------------------------------------------*/
564 virtual MPType
&getType (void);
565 virtual const MPType
&getType (void) const;
566 UInt32
getTypeId(void);
567 const Char8
*getCName (void) const;
569 bool isGlobal (void) const;
572 /*========================= PROTECTED ===============================*/
576 typedef MemoryObject Inherited
;
578 /*---------------------------------------------------------------------*/
579 /*! \name Class Specific */
587 /*---------------------------------------------------------------------*/
588 /*! \name Constructor */
591 MPBase(const Char8
*szName
, bool bGlobal
);
594 /*---------------------------------------------------------------------*/
595 /*! \name Destructor */
598 virtual ~MPBase(void);
601 /*========================== PRIVATE ================================*/
605 /*!\brief prohibit default function (move to 'public' if needed) */
606 MPBase(const MPBase
&source
);
607 /*!\brief prohibit default function (move to 'public' if needed) */
608 void operator =(const MPBase
&source
);
611 typedef MPBase
*MPBaseP
;
615 #include "OSGMPBase.inl"
617 #endif /* _OSGMPBASE_H_ */