Classes | |
| struct | osg::InitFuncWrapper |
| struct | osg::StaticInitFuncWrapper |
add init functions | |
| *void | osg::addInitFunction (InitFuncF initFunc) |
| void | osg::addPreMPInitFunction (InitFuncF initFunc) |
add exit function | |
| *void | osg::addSystemExitFunction (ExitFuncF exitFunc) |
| void | osg::addPostMPExitFunction (ExitFuncF exitFunc) |
init / exit | |
| *void | osg::preloadSharedObject (const Char8 *szName) |
| static void | osg::osgExitWrapper (void) |
| bool | osg::osgInit (Int32, Char8 **) |
| bool | osg::osgExit (void) |
Typedefs | |
| typedef bool(* | osg::InitFuncF )(void) |
| typedef bool(* | osg::ExitFuncF )(void) |
Enumerations | |
| enum | osg::SystemState { osg::Startup = 0x01, osg::Running = 0x02, osg::Shutdown = 0x03 } |
Variables | |
| SystemState | osg::GlobalSystemState = Startup |
|
|
init function prototype order :
Definition at line 641 of file OSGBaseFunctions.h. |
|
|
exit function prototype order :
Definition at line 653 of file OSGBaseFunctions.h. |
|
|
Definition at line 621 of file OSGBaseFunctions.h.
|
|
|
addInitFunction, function called by osgInit after the multithreading is initialized and after dynamically loading a shared object Definition at line 90 of file OSGBaseFunctions.cpp. References osg::osgInitFunctions. Referenced by osg::VRMLWriteAction::ActionInitializer::ActionInitializer(), osg::FieldContainerFactory::FieldContainerFactory(), and osg::InitFuncWrapper::InitFuncWrapper(). 00091 { 00092 if(osgInitFunctions == NULL) 00093 { 00094 osgInitFunctions = new std::vector<InitFuncF>(0); 00095 } 00096 00097 osgInitFunctions->push_back(initFunc); 00098 }
|
|
|
addMPInitFunction, function called by osgInit before the multithreading is initialized. Definition at line 105 of file OSGBaseFunctions.cpp. References osg::osgPreMPInitFunctions. 00106 { 00107 if(osgPreMPInitFunctions == NULL) 00108 { 00109 osgPreMPInitFunctions = new std::vector<InitFuncF>; 00110 } 00111 00112 osgPreMPInitFunctions->push_back(initFunc); 00113 }
|
|
|
addSystemExitFunction, function called by osgExit before multithreading is termininated Definition at line 125 of file OSGBaseFunctions.cpp. References osg::osgSystemExitFunctions. Referenced by osg::VRMLWriteAction::ActionInitializer::ActionInitializer(), and osg::FieldContainerFactory::FieldContainerFactory(). 00126 { 00127 if(osgSystemExitFunctions == NULL) 00128 { 00129 osgSystemExitFunctions = new std::vector<ExitFuncF>(0); 00130 } 00131 00132 osgSystemExitFunctions->push_back(exitFunc); 00133 }
|
|
|
addPostMPExitFunction, function called by osgExit after multithreading is terminated Definition at line 140 of file OSGBaseFunctions.cpp. References osg::osgPostMPExitFunctions. 00141 { 00142 if(osgPostMPExitFunctions == NULL) 00143 { 00144 osgPostMPExitFunctions = new std::vector<ExitFuncF>; 00145 } 00146 00147 osgPostMPExitFunctions->push_back(exitFunc); 00148 }
|
|
|
Definition at line 158 of file OSGBaseFunctions.cpp. References osg::osgPreloadSharedObject. 00159 { 00160 if(osgPreloadSharedObject == NULL) 00161 { 00162 osgPreloadSharedObject = new std::vector<std::string>; 00163 } 00164 00165 std::string tmpString(szName); 00166 00167 osgPreloadSharedObject->push_back(tmpString); 00168 }
|
|
|
Definition at line 173 of file OSGBaseFunctions.cpp. References osg::osgExit(). Referenced by osg::osgInit(). 00174 { 00175 osgExit(); 00176 }
|
|
||||||||||||
|
Definition at line 181 of file OSGBaseFunctions.cpp. References FINFO, osg::Directory::getEntries(), osg::GlobalSystemState, osg::osgExitWrapper(), osg::osgInitFunctions, osg::osgPreloadSharedObject, osg::osgPreMPInitFunctions, osg::PluginPattern, and osg::Running. 00182 { 00183 // without it floats could be written as "1,456" ... 00184 setlocale(LC_NUMERIC, "English"); 00185 00186 UInt32 i; 00187 bool returnValue = true; 00188 00189 returnValue = SharedObjectHandler::the()->initialize(); 00190 00191 if(osgPreloadSharedObject != NULL) 00192 { 00193 for(UInt32 i = 0; i < osgPreloadSharedObject->size(); ++i) 00194 { 00195 SharedObjectHandler::the()->getOSGSharedObject( 00196 (*osgPreloadSharedObject)[i].c_str()); 00197 } 00198 } 00199 00200 char *szEnvLibs = getenv("OSG_LOAD_LIBS"); 00201 00202 if(szEnvLibs != NULL) 00203 { 00204 std::string tmpString(szEnvLibs); 00205 string_token_iterator libIt(tmpString, ":"); 00206 00207 string_token_iterator libEnd; 00208 00209 while(libIt != libEnd) 00210 { 00211 SharedObjectHandler::the()->getOSGSharedObject( 00212 (*libIt).c_str()); 00213 00214 ++libIt; 00215 } 00216 } 00217 00218 const char *szEnvPlugins = getenv("OSG_PLUGIN_PATH"); 00219 const char *szEnvPluginPattern = getenv("OSG_PLUGIN_PATTERN"); 00220 00221 if(szEnvPlugins != NULL) 00222 { 00223 if(szEnvPluginPattern == NULL) 00224 { 00225 szEnvPluginPattern = PluginPattern; 00226 } 00227 00228 FINFO(("Get Plugins %s from %s\n", 00229 szEnvPluginPattern, 00230 szEnvPlugins)); 00231 00232 std::vector<Char8 *> *pPlugins = 00233 Directory::getEntries(szEnvPlugins, szEnvPluginPattern); 00234 00235 if(pPlugins != NULL) 00236 { 00237 std::string szPluginName; 00238 00239 for(UInt32 i = 0; i < pPlugins->size(); ++i) 00240 { 00241 if((*pPlugins)[i][0] == '.') 00242 { 00243 if((*pPlugins)[i][1] == '\0') 00244 { 00245 continue; 00246 } 00247 else if((*pPlugins)[i][1] == '.' && 00248 (*pPlugins)[i][2] == '\0') 00249 { 00250 continue; 00251 } 00252 } 00253 00254 szPluginName.assign(szEnvPlugins); 00255 szPluginName += '/'; 00256 szPluginName += (*pPlugins)[i]; 00257 00258 SharedObjectHandler::the()->getSharedObject( 00259 szPluginName.c_str()); 00260 } 00261 } 00262 00263 delete pPlugins; 00264 } 00265 00266 SharedObjectHandler::the()->dump(); 00267 00268 if(returnValue == false) 00269 return returnValue; 00270 00271 if(osgPreMPInitFunctions != NULL) 00272 { 00273 for(i = 0; i < osgPreMPInitFunctions->size(); i++) 00274 { 00275 returnValue &= (*osgPreMPInitFunctions)[i](); 00276 00277 if(returnValue == false) 00278 break; 00279 } 00280 00281 osgPreMPInitFunctions->clear(); 00282 } 00283 00284 if(returnValue == false) 00285 return returnValue; 00286 00287 returnValue &= ThreadManager::initialize(); 00288 00289 if(returnValue == false) 00290 return returnValue; 00291 00292 if(osgInitFunctions != NULL) 00293 { 00294 for(i = 0; i < osgInitFunctions->size(); i++) 00295 { 00296 returnValue &= (*osgInitFunctions)[i](); 00297 00298 if(returnValue == false) 00299 break; 00300 } 00301 00302 osgInitFunctions->clear(); 00303 } 00304 00305 if(returnValue == false) 00306 return returnValue; 00307 00308 #ifdef OSG_GV_BETA 00309 returnValue &= FactoryController::the()->initialize(); 00310 #endif 00311 00312 GlobalSystemState = Running; 00313 00314 atexit(osgExitWrapper); 00315 00316 return returnValue; 00317 }
|
|
|
Definition at line 322 of file OSGBaseFunctions.cpp. References osg::GlobalSystemState, osg::osgPostMPExitFunctions, osg::osgSystemExitFunctions, osg::Running, and osg::Shutdown. Referenced by osg::osgExitWrapper(). 00323 { 00324 bool returnValue = true; 00325 00326 if(GlobalSystemState != Running) 00327 return true; 00328 00329 GlobalSystemState = Shutdown; 00330 00331 #ifdef OSG_GV_BETA 00332 returnValue &= FactoryController::the()->terminate(); 00333 #endif 00334 00335 if(osgSystemExitFunctions != NULL) 00336 { 00337 for(Int32 i = osgSystemExitFunctions->size() - 1; i >= 0; i--) 00338 { 00339 returnValue &= (*osgSystemExitFunctions)[i](); 00340 00341 if(returnValue == false) 00342 break; 00343 } 00344 } 00345 00346 returnValue &= ThreadManager::terminate(); 00347 00348 if(osgPostMPExitFunctions != NULL) 00349 { 00350 for(Int32 i = osgPostMPExitFunctions->size() - 1; i >= 0; i--) 00351 { 00352 returnValue &= (*osgPostMPExitFunctions)[i](); 00353 00354 if(returnValue == false) 00355 break; 00356 } 00357 } 00358 00359 return returnValue; 00360 }
|
|
1.4.3