#include <OSGSharedObjectHandler.h>
Public Types | |
| typedef std::map< std::string, SharedObjectP > | SharedObjectMap |
| typedef SharedObjectMap::iterator | SharedObjectMapIt |
| typedef SharedObjectMap::const_iterator | SharedObjectMapConstIt |
| typedef std::vector< std::string > | NameStore |
| typedef std::vector< std::string >::iterator | NameStoreIt |
| typedef std::vector< std::string >::const_iterator | NameStoreConstIt |
Public Member Functions | |
| SharedObjectP | getSharedObject (const Char8 *szName) |
| SharedObjectP | getOSGSharedObject (const Char8 *szName) |
| SharedObjectP | findSharedObject (const Char8 *szName) const |
| void | removeSharedObject (const Char8 *szName) |
| void | removeSharedObject (SharedObjectP pObject) |
| void | registerLoadedObject (const Char8 *szName) |
| void | dump (void) |
Static Public Member Functions | |
| static SharedObjectHandlerP | the (void) |
Protected Member Functions | |
| SharedObjectHandler (void) | |
| virtual | ~SharedObjectHandler (void) |
| bool | initialize (void) |
| void | terminate (void) |
Protected Attributes | |
| SharedObjectMap | _mSharedObjects |
| NameStore | _vLoadedNames |
Static Protected Attributes | |
| static SharedObjectHandlerP | _the = NULL |
Private Member Functions | |
| SharedObjectHandler (const SharedObjectHandler &source) | |
| void | operator= (const SharedObjectHandler &source) |
Friends | |
| bool | osgInit (Int32 argc, Char8 **argv) |
| bool | osgExit (void) |
Definition at line 246 of file OSGSharedObjectHandler.h.
|
|
Definition at line 262 of file OSGSharedObjectHandler.h. |
|
|
Definition at line 264 of file OSGSharedObjectHandler.h. |
|
|
Definition at line 266 of file OSGSharedObjectHandler.h. |
|
|
Definition at line 269 of file OSGSharedObjectHandler.h. |
|
|
Definition at line 270 of file OSGSharedObjectHandler.h. |
|
|
Definition at line 271 of file OSGSharedObjectHandler.h. |
|
|
|
|
|
Definition at line 328 of file OSGSharedObjectHandler.cpp. References FINFO. 00328 : 00329 _mSharedObjects(), 00330 _vLoadedNames () 00331 { 00332 FINFO(("create SharedObjectHandler\n")); 00333 }
|
|
|
Definition at line 335 of file OSGSharedObjectHandler.cpp. References FINFO. 00336 { 00337 FINFO(("destroy SharedObjectHandler\n")); 00338 }
|
|
|
|
|
|
Definition at line 492 of file OSGSharedObjectHandler.cpp. References _mSharedObjects, _vLoadedNames, osg::MemoryObject::addRef(), FINFO, and getSharedObject(). 00493 { 00494 SharedObjectP pAppHandle = getSharedObject(NULL); 00495 00496 for(UInt32 i = 0; i < _vLoadedNames.size(); ++i) 00497 { 00498 FINFO(("Preloaded %s %p\n", _vLoadedNames[i].c_str(), pAppHandle)); 00499 00500 _mSharedObjects[_vLoadedNames[i]] = pAppHandle; 00501 pAppHandle->addRef(); 00502 } 00503 00504 _vLoadedNames.clear(); 00505 00506 return true; 00507 }
|
|
|
Definition at line 340 of file OSGSharedObjectHandler.cpp. References _mSharedObjects, _the, dump(), and FINFO. 00341 { 00342 FINFO(("terminate SharedObjectHandler\n")); 00343 00344 this->dump(); 00345 00346 SharedObjectMapIt soIt = _mSharedObjects.begin(); 00347 SharedObjectMapIt soEnd = _mSharedObjects.end (); 00348 00349 while(soIt != soEnd) 00350 { 00351 soIt->second->close(); 00352 00353 soIt->second->subRef(); 00354 00355 ++soIt; 00356 } 00357 00358 _the = NULL; 00359 delete this; 00360 }
|
|
|
Definition at line 304 of file OSGSharedObjectHandler.cpp. References _the. 00305 { 00306 if(_the == NULL) 00307 { 00308 _the = new SharedObjectHandler; 00309 } 00310 00311 return _the; 00312 }
|
|
|
Definition at line 368 of file OSGSharedObjectHandler.cpp. References _mSharedObjects, _vLoadedNames, osg::MemoryObject::addRef(), findSharedObject(), FINFO, osg::SharedObject::getName(), osg::GlobalSystemState, osg::SharedObject::open(), and osg::Running. Referenced by getOSGSharedObject(), and initialize(). 00370 { 00371 SharedObjectP returnValue = NULL; 00372 00373 returnValue = findSharedObject(szName); 00374 00375 if(returnValue == NULL) 00376 { 00377 returnValue = new SharedObject(szName); 00378 00379 returnValue->open (); 00380 returnValue->addRef(); 00381 00382 _mSharedObjects[returnValue->getName()] = returnValue; 00383 00384 if(GlobalSystemState == Running) 00385 { 00386 // FactoryController::the()->initializePendingElements(); 00387 } 00388 } 00389 00390 #if 0 00391 for(UInt32 i = 0; i < _vLoadedNames.size(); ++i) 00392 { 00393 FINFO(("Pulled in %s\n", _vLoadedNames[i].c_str())); 00394 } 00395 #endif 00396 00397 _vLoadedNames.clear(); 00398 00399 return returnValue; 00400 }
|
|
|
Definition at line 402 of file OSGSharedObjectHandler.cpp. References getSharedObject(). 00404 { 00405 SharedObjectP returnValue = NULL; 00406 00407 std::string tmpString; 00408 00409 #ifndef WIN32 00410 tmpString.append("lib"); 00411 tmpString.append(szName); 00412 tmpString.append(".so"); 00413 #else 00414 tmpString.append(szName); 00415 tmpString.append(".dll"); 00416 #endif 00417 00418 returnValue = getSharedObject(tmpString.c_str()); 00419 00420 return returnValue; 00421 }
|
|
|
Definition at line 423 of file OSGSharedObjectHandler.cpp. References _mSharedObjects, and osg::SharedObject::_szApplicationObjectName. Referenced by getSharedObject(). 00425 { 00426 SharedObjectMapConstIt mapIt; 00427 SharedObjectP returnValue = NULL; 00428 std::string szSearchName; 00429 00430 if(szName != NULL) 00431 { 00432 szSearchName.assign(szName); 00433 } 00434 else 00435 { 00436 szSearchName.assign(SharedObject::_szApplicationObjectName); 00437 } 00438 00439 mapIt = _mSharedObjects.find(szSearchName); 00440 00441 if(mapIt != _mSharedObjects.end()) 00442 { 00443 returnValue = mapIt->second; 00444 } 00445 00446 return returnValue; 00447 }
|
|
|
Definition at line 449 of file OSGSharedObjectHandler.cpp. References _mSharedObjects, and osg::SharedObject::_szApplicationObjectName. Referenced by removeSharedObject(). 00450 { 00451 SharedObjectMapIt mapIt; 00452 std::string szSearchName; 00453 00454 if(szName != NULL) 00455 { 00456 szSearchName.assign(szName); 00457 } 00458 else 00459 { 00460 szSearchName.assign(SharedObject::_szApplicationObjectName); 00461 } 00462 00463 mapIt = _mSharedObjects.find(szSearchName); 00464 00465 _mSharedObjects.erase(mapIt); 00466 }
|
|
|
Definition at line 468 of file OSGSharedObjectHandler.cpp. References osg::SharedObject::getCName(), and removeSharedObject(). 00469 { 00470 if(pObject != NULL) 00471 { 00472 removeSharedObject(pObject->getCName()); 00473 } 00474 }
|
|
|
Definition at line 476 of file OSGSharedObjectHandler.cpp. References _vLoadedNames. 00477 { 00478 std::string tmpString; 00479 00480 #ifndef WIN32 00481 tmpString.append("lib"); 00482 tmpString.append(szName); 00483 tmpString.append(".so"); 00484 #else 00485 tmpString.append(szName); 00486 tmpString.append(".dll"); 00487 #endif 00488 00489 _vLoadedNames.push_back(tmpString); 00490 }
|
|
|
Definition at line 509 of file OSGSharedObjectHandler.cpp. References _mSharedObjects, and FINFO. Referenced by terminate(). 00510 { 00511 SharedObjectMapIt soIt = _mSharedObjects.begin(); 00512 SharedObjectMapIt soEnd = _mSharedObjects.end (); 00513 00514 while(soIt != soEnd) 00515 { 00516 FINFO(("SO : %s | %p\n", soIt->first.c_str(), soIt->second)); 00517 00518 soIt->second->dump(); 00519 ++soIt; 00520 } 00521 }
|
|
||||||||||||
|
Definition at line 181 of file OSGBaseFunctions.cpp. 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. 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 }
|
|
|
Definition at line 286 of file OSGSharedObjectHandler.cpp. Referenced by terminate(), and the(). |
|
|
Definition at line 339 of file OSGSharedObjectHandler.h. Referenced by dump(), findSharedObject(), getSharedObject(), initialize(), removeSharedObject(), and terminate(). |
|
|
Definition at line 341 of file OSGSharedObjectHandler.h. Referenced by getSharedObject(), initialize(), and registerLoadedObject(). |
1.4.3