fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / RenderingBackend / OSGWindowDrawThread.cpp
blobef0f24da932341b30d206bb23773aa0620d783f0
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 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 //---------------------------------------------------------------------------
40 // Includes
41 //---------------------------------------------------------------------------
43 #include <cstdlib>
44 #include <cstdio>
46 #include "OSGConfig.h"
48 #include "OSGWindowDrawThread.h"
49 #include "OSGThreadManager.h"
50 #include "OSGWindow.h"
52 OSG_BEGIN_NAMESPACE
54 /***************************************************************************\
55 * Class variables *
56 \***************************************************************************/
58 MPThreadType WindowDrawThread::_type(
59 "OSGWindowDrawThread",
60 "OSGHardwareContextThread",
61 static_cast<CreateThreadF>(WindowDrawThread::create),
62 NULL);
64 /***************************************************************************\
65 * Class methods *
66 \***************************************************************************/
68 /***************************************************************************\
69 * Instance methods *
70 \***************************************************************************/
72 /*-------------------------------------------------------------------------*\
73 - private -
74 \*-------------------------------------------------------------------------*/
76 WindowDrawThread *WindowDrawThread::find(Char8 *szName)
78 BaseThread *pThread = ThreadManager::the()->findThread(szName);
80 return dynamic_cast<WindowDrawThread *>(pThread);
83 WindowDrawThread::ObjTransitPtr WindowDrawThread::get(Char8 *szName,
84 bool bGlobal)
86 BaseThreadTransitPtr pThread =
87 ThreadManager::the()->getThread(szName,
88 bGlobal,
89 "OSGWindowDrawThread");
91 return dynamic_pointer_cast<WindowDrawThread>(pThread);
96 BaseThread *WindowDrawThread::create(const Char8 *szName,
97 UInt32 uiId,
98 bool bGlobal)
100 return new WindowDrawThread(szName, uiId, bGlobal);
103 WindowDrawThread::WindowDrawThread(const Char8 *szName,
104 UInt32 uiId,
105 bool bGlobal) :
106 Inherited(szName,
107 uiId ,
108 bGlobal),
109 _oEnv ( )
111 Inherited::_pEnv = &_oEnv;
114 WindowDrawThread::~WindowDrawThread(void)
116 Inherited::_pEnv = NULL;
119 void WindowDrawThread::setWindow (Window *pWindow)
121 Inherited::setContext(pWindow);
123 _oEnv.setWindow(pWindow);
126 OSG_END_NAMESPACE