Classes | |
| struct | osg::CompileConfig |
| 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 **, UInt16 major, UInt16 minor, UInt16 release, bool debug, bool dll, bool mt) |
| 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 |
| typedef bool(* osg::InitFuncF)(void) |
init function prototype
order :
Definition at line 644 of file OSGBaseFunctions.h.
| typedef bool(* osg::ExitFuncF)(void) |
exit function prototype
order :
Definition at line 656 of file OSGBaseFunctions.h.
| enum osg::SystemState |
| void osg::addInitFunction | ( | InitFuncF | initFunc | ) |
addInitFunction, function called by osgInit after the multithreading is initialized and after dynamically loading a shared object
Definition at line 106 of file OSGBaseFunctions.cpp.
References osg::osgInitFunctions.
Referenced by osg::VRMLWriteAction::ActionInitializer::ActionInitializer(), osg::FieldContainerFactory::FieldContainerFactory(), osg::InitFuncWrapper::InitFuncWrapper(), and osg::TextureTransformChunk::initMethod().
00107 { 00108 if(osgInitFunctions == NULL) 00109 { 00110 osgInitFunctions = new std::vector<InitFuncF>(0); 00111 } 00112 00113 osgInitFunctions->push_back(initFunc); 00114 }
| void osg::addPreMPInitFunction | ( | InitFuncF | initFunc | ) |
addMPInitFunction, function called by osgInit before the multithreading is initialized.
Definition at line 121 of file OSGBaseFunctions.cpp.
References osg::osgPreMPInitFunctions.
00122 { 00123 if(osgPreMPInitFunctions == NULL) 00124 { 00125 osgPreMPInitFunctions = new std::vector<InitFuncF>; 00126 } 00127 00128 osgPreMPInitFunctions->push_back(initFunc); 00129 }
| void osg::addSystemExitFunction | ( | ExitFuncF | exitFunc | ) |
addSystemExitFunction, function called by osgExit before multithreading is termininated
Definition at line 141 of file OSGBaseFunctions.cpp.
References osg::osgSystemExitFunctions.
Referenced by osg::VRMLWriteAction::ActionInitializer::ActionInitializer(), osg::FieldContainerFactory::FieldContainerFactory(), and osg::TextFaceFactory::TextFaceFactory().
00142 { 00143 if(osgSystemExitFunctions == NULL) 00144 { 00145 osgSystemExitFunctions = new std::vector<ExitFuncF>(0); 00146 } 00147 00148 osgSystemExitFunctions->push_back(exitFunc); 00149 }
| void osg::addPostMPExitFunction | ( | ExitFuncF | exitFunc | ) |
addPostMPExitFunction, function called by osgExit after multithreading is terminated
Definition at line 156 of file OSGBaseFunctions.cpp.
References osg::osgPostMPExitFunctions.
00157 { 00158 if(osgPostMPExitFunctions == NULL) 00159 { 00160 osgPostMPExitFunctions = new std::vector<ExitFuncF>; 00161 } 00162 00163 osgPostMPExitFunctions->push_back(exitFunc); 00164 }
| void osg::preloadSharedObject | ( | const Char8 * | szName | ) |
Definition at line 174 of file OSGBaseFunctions.cpp.
References osg::osgPreloadSharedObject.
00175 { 00176 if(osgPreloadSharedObject == NULL) 00177 { 00178 osgPreloadSharedObject = new std::vector<std::string>; 00179 } 00180 00181 std::string tmpString(szName); 00182 00183 osgPreloadSharedObject->push_back(tmpString); 00184 }
| static void osg::osgExitWrapper | ( | void | ) | [static] |
Definition at line 189 of file OSGBaseFunctions.cpp.
References osg::osgExit().
Referenced by osg::osgInit().
00190 { 00191 osgExit(); 00192 }
| bool osg::osgInit | ( | Int32 | , | |
| Char8 ** | , | |||
| UInt16 | major, | |||
| UInt16 | minor, | |||
| UInt16 | release, | |||
| bool | debug, | |||
| bool | dll, | |||
| bool | mt | |||
| ) |
Definition at line 303 of file OSGBaseFunctions.cpp.
References osg::CompileConfig::compare(), osg::SharedObjectHandler::dump(), FINFO, osg::Directory::getEntries(), osg::SharedObjectHandler::getOSGSharedObject(), osg::SharedObjectHandler::getSharedObject(), osg::GlobalSystemState, osg::ThreadManager::initialize(), osg::SharedObjectHandler::initialize(), OSG_MAJOR_VERSION, OSG_MINOR_VERSION, OSG_RELEASE_VERSION, osg::osgExitWrapper(), osg::osgInitFunctions, osg::osgPreloadSharedObject, osg::osgPreMPInitFunctions, osg::PluginPattern, osg::Running, and osg::SharedObjectHandler::the().
00306 { 00307 CompileConfig prog(major, minor, release, debug, dll, mt), 00308 lib(OSG_MAJOR_VERSION, OSG_MINOR_VERSION, 00309 OSG_RELEASE_VERSION, 00310 #ifdef _DEBUG 00311 true, 00312 #else 00313 false, 00314 #endif 00315 #ifdef _DLL 00316 true, 00317 #else 00318 false, 00319 #endif 00320 #ifdef _MT 00321 true 00322 #else 00323 false 00324 #endif 00325 ); 00326 00327 if(lib.compare(prog)) 00328 { 00329 exit(1); 00330 } 00331 00332 // without it floats could be written as "1,456" ... 00333 setlocale(LC_NUMERIC, "English"); 00334 00335 UInt32 i; 00336 bool returnValue = true; 00337 00338 returnValue = SharedObjectHandler::the()->initialize(); 00339 00340 if(osgPreloadSharedObject != NULL) 00341 { 00342 for(UInt32 i = 0; i < osgPreloadSharedObject->size(); ++i) 00343 { 00344 SharedObjectHandler::the()->getOSGSharedObject( 00345 (*osgPreloadSharedObject)[i].c_str()); 00346 } 00347 } 00348 00349 #ifdef WIN32 00350 std::string pathSep(";"); 00351 #else 00352 std::string pathSep(":"); 00353 #endif 00354 00355 char *szEnvLibs = getenv("OSG_LOAD_LIBS"); 00356 00357 if(szEnvLibs != NULL) 00358 { 00359 std::string tmpString(szEnvLibs); 00360 string_token_iterator libIt(tmpString, pathSep.c_str()); 00361 00362 string_token_iterator libEnd; 00363 00364 while(libIt != libEnd) 00365 { 00366 SharedObjectHandler::the()->getOSGSharedObject( 00367 (*libIt).c_str()); 00368 00369 ++libIt; 00370 } 00371 } 00372 00373 const char *szEnvPlugins = getenv("OSG_PLUGIN_PATH"); 00374 const char *szEnvPluginPattern = getenv("OSG_PLUGIN_PATTERN"); 00375 00376 if(szEnvPlugins != NULL) 00377 { 00378 if(szEnvPluginPattern == NULL) 00379 { 00380 szEnvPluginPattern = PluginPattern; 00381 } 00382 00383 FINFO(("Get Plugins %s from %s\n", 00384 szEnvPluginPattern, 00385 szEnvPlugins)); 00386 00387 std::vector<Char8 *> *pPlugins = 00388 Directory::getEntries(szEnvPlugins, szEnvPluginPattern); 00389 00390 if(pPlugins != NULL) 00391 { 00392 std::string szPluginName; 00393 00394 for(UInt32 i = 0; i < pPlugins->size(); ++i) 00395 { 00396 if((*pPlugins)[i][0] == '.') 00397 { 00398 if((*pPlugins)[i][1] == '\0') 00399 { 00400 continue; 00401 } 00402 else if((*pPlugins)[i][1] == '.' && 00403 (*pPlugins)[i][2] == '\0') 00404 { 00405 continue; 00406 } 00407 } 00408 00409 szPluginName.assign(szEnvPlugins); 00410 szPluginName += '/'; 00411 szPluginName += (*pPlugins)[i]; 00412 00413 FINFO(("Loading plugin %s\n", 00414 szPluginName.c_str())); 00415 00416 SharedObjectHandler::the()->getSharedObject( 00417 szPluginName.c_str()); 00418 } 00419 } 00420 00421 delete pPlugins; 00422 } 00423 00424 SharedObjectHandler::the()->dump(); 00425 00426 if(returnValue == false) 00427 return returnValue; 00428 00429 if(osgPreMPInitFunctions != NULL) 00430 { 00431 for(i = 0; i < osgPreMPInitFunctions->size(); i++) 00432 { 00433 returnValue &= (*osgPreMPInitFunctions)[i](); 00434 00435 if(returnValue == false) 00436 break; 00437 } 00438 00439 osgPreMPInitFunctions->clear(); 00440 } 00441 00442 if(returnValue == false) 00443 return returnValue; 00444 00445 returnValue &= ThreadManager::initialize(); 00446 00447 if(returnValue == false) 00448 return returnValue; 00449 00450 if(osgInitFunctions != NULL) 00451 { 00452 for(i = 0; i < osgInitFunctions->size(); i++) 00453 { 00454 returnValue &= (*osgInitFunctions)[i](); 00455 00456 if(returnValue == false) 00457 break; 00458 } 00459 00460 osgInitFunctions->clear(); 00461 } 00462 00463 if(returnValue == false) 00464 return returnValue; 00465 00466 #ifdef OSG_GV_BETA 00467 returnValue &= FactoryController::the()->initialize(); 00468 #endif 00469 00470 GlobalSystemState = Running; 00471 00472 atexit(osgExitWrapper); 00473 00474 return returnValue; 00475 }
| bool osg::osgExit | ( | void | ) |
Definition at line 480 of file OSGBaseFunctions.cpp.
References osg::GlobalSystemState, osg::osgPostMPExitFunctions, osg::osgSystemExitFunctions, osg::Running, osg::Shutdown, osg::ThreadManager::terminate(), osg::SharedObjectHandler::terminate(), and osg::SharedObjectHandler::the().
Referenced by osg::osgExitWrapper().
00481 { 00482 bool returnValue = true; 00483 00484 if(GlobalSystemState != Running) 00485 return true; 00486 00487 GlobalSystemState = Shutdown; 00488 00489 #ifdef OSG_GV_BETA 00490 returnValue &= FactoryController::the()->terminate(); 00491 #endif 00492 SharedObjectHandler::the()->terminate(); 00493 00494 if(osgSystemExitFunctions != NULL) 00495 { 00496 for(Int32 i = osgSystemExitFunctions->size() - 1; i >= 0; i--) 00497 { 00498 returnValue &= (*osgSystemExitFunctions)[i](); 00499 00500 if(returnValue == false) 00501 break; 00502 } 00503 } 00504 00505 returnValue &= ThreadManager::terminate(); 00506 00507 if(osgPostMPExitFunctions != NULL) 00508 { 00509 for(Int32 i = osgPostMPExitFunctions->size() - 1; i >= 0; i--) 00510 { 00511 returnValue &= (*osgPostMPExitFunctions)[i](); 00512 00513 if(returnValue == false) 00514 break; 00515 } 00516 } 00517 00518 return returnValue; 00519 }
| SystemState osg::GlobalSystemState = Startup |
Definition at line 81 of file OSGBaseFunctions.cpp.
Referenced by osg::SharedObjectHandler::getSharedObject(), osg::Window::onCreate(), osg::VertexProgramChunk::onCreate(), osg::TextureChunk::onCreate(), osg::Surface::onCreate(), osg::SHLChunk::onCreate(), osg::ShaderParameterChunk::onCreate(), osg::Geometry::onCreate(), osg::FragmentProgramChunk::onCreate(), osg::FBOViewport::onCreate(), osg::FatBorderChunk::onCreate(), osg::CubeTextureChunk::onCreate(), osg::Window::onCreateAspect(), osg::MaterialPool::onDestroy(), osg::osgExit(), osg::osgInit(), osg::ChangeList::setReadWriteDefault(), osg::Window::staticAcquire(), osg::Window::staticRelease(), and osg::FieldContainerType::~FieldContainerType().
1.5.5