fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Test / GroupLib / OSGTestStage.cpp
blobea2333ab6ea59db2e8df5626899647b1a3691bdb
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 "OSGTestStage.h"
49 #include "OSGRenderAction.h"
51 OSG_BEGIN_NAMESPACE
53 // Documentation for this class is emitted in the
54 // OSGTestStageBase.cpp file.
55 // To modify it, please change the .fcd file (OSGTestStage.fcd) and
56 // regenerate the base file.
58 /***************************************************************************\
59 * Class variables *
60 \***************************************************************************/
62 /***************************************************************************\
63 * Class methods *
64 \***************************************************************************/
66 void TestStage::initMethod(InitPhase ePhase)
68 Inherited::initMethod(ePhase);
70 if(ePhase == TypeObject::SystemPost)
72 RenderAction::registerEnterDefault(
73 TestStage::getClassType(),
74 reinterpret_cast<Action::Callback>(&TestStage::renderEnter));
76 RenderAction::registerLeaveDefault(
77 TestStage::getClassType(),
78 reinterpret_cast<Action::Callback>(&TestStage::renderLeave));
83 /***************************************************************************\
84 * Instance methods *
85 \***************************************************************************/
87 /*-------------------------------------------------------------------------*\
88 - private -
89 \*-------------------------------------------------------------------------*/
91 /*----------------------- constructors & destructors ----------------------*/
93 TestStage::TestStage(void) :
94 Inherited()
98 TestStage::TestStage(const TestStage &source) :
99 Inherited(source)
103 TestStage::~TestStage(void)
107 /*----------------------------- class specific ----------------------------*/
109 void TestStage::changed(ConstFieldMaskArg whichField,
110 UInt32 origin,
111 BitVector details)
113 Inherited::changed(whichField, origin, details);
116 void TestStage::enterCB(DrawEnv *pEnv)
118 fprintf(stderr, "TestStage Part Enter\n");
121 void TestStage::dump( UInt32 ,
122 const BitVector ) const
124 SLOG << "Dump TestStage NI" << std::endl;
128 Action::ResultE TestStage::renderEnter(Action *action)
130 #ifdef OSG_DUMP_TRAVERSAL
131 FDEBUG_GV(("Enter TestStage %p\n", &(*pCore)));
132 #endif
134 RenderAction *a = dynamic_cast<RenderAction *>(action);
136 #ifdef OSG_DEBUGX
137 if(this != NULL && this->getMessage().size() != 0)
139 fprintf(stderr, "StartEnter TS %s\n",
140 this->getMessage().c_str());
142 #endif
144 Stage::ValidationStatus eStatus = this->validateOnEnter(a);
146 if(eStatus == TraversalValidator::Run)
148 this->pushPartition(a);
150 #ifdef OSG_DEBUG
151 RenderPartition *pPart = a->getActivePartition();
153 if(this != NULL && this->getMessage().size() != 0)
155 pPart->setDebugString(this->getMessage());
157 #endif
161 #ifdef OSG_DEBUGX
162 if(this != NULL && this->getMessage().size() != 0)
164 fprintf(stderr, "FinishedEnter TS %s\n",
165 this->getMessage().c_str());
167 #endif
169 return Action::Continue;
172 Action::ResultE TestStage::renderLeave(Action *action)
174 #ifdef OSG_DUMP_TRAVERSAL
175 FDEBUG_GV(("Leave TestStage %p\n", &(*pCore)));
176 #endif
178 RenderAction *a = dynamic_cast<RenderAction *>(action);
180 #ifdef OSG_DEBUGX
181 if(this != NULL && this->getMessage().size() != 0)
183 fprintf(stderr, "StartLeave TS %s\n",
184 this->getMessage().c_str());
186 #endif
188 TraversalValidator::ValidationStatus eStatus = this->validateOnLeave(a);
190 if(eStatus == TraversalValidator::Run)
192 this->popPartition(a);
195 #ifdef OSG_DEBUGX
196 if(this != NULL && this->getMessage().size() != 0)
198 fprintf(stderr, "FinishedLeave TS %s\n",
199 this->getMessage().c_str());
202 a->dumpPartitionList();
203 #endif
205 return Action::Continue;
208 /*------------------------------------------------------------------------*/
209 /* cvs id's */
211 OSG_END_NAMESPACE