#include <OSGFieldContainerFactoryImpl.h>
Public Types | |
| typedef TypeIdMapIt | TypeMapIterator |
Public Member Functions | |
Types | |
| *FieldContainerType * | findType (UInt32 uiTypeId) const |
| FieldContainerType * | findType (const Char8 *szName) const |
| UInt32 | getNumTypes (void) const |
| FieldContainerType * | findUninitializedType (const Char8 *szName) const |
| bool | initializePendingTypes (void) |
| TypeMapIterator | beginTypes (void) |
| TypeMapIterator | endTypes (void) |
Groups | |
| *UInt16 | findGroupId (const Char8 *szName) const |
| const Char8 * | findGroupName (UInt16 uiGroupId) const |
| UInt16 | getNumGroups (void) const |
Mapper | |
| *void | setMapper (FieldContainerMapper *pMapper) |
Get FieldContainer | |
| *FieldContainerPtr | getContainer (UInt32 uiFieldContainerId) const |
| FieldContainerPtr | getMappedContainer (UInt32 uiFieldContainerId) const |
Create Base FieldContainer | |
| *FieldContainerPtr | createFieldContainer (const Char8 *name) const |
| NodePtr | createNode (const Char8 *name) const |
| NodeCorePtr | createNodeCore (const Char8 *name) const |
| AttachmentPtr | createAttachment (const Char8 *name) const |
Write FCD From Name | |
| *void | writeFCD (Char8 *name=NULL, std::ostream *out=NULL) |
Get Containerstore | |
| *const FieldContainerStore * | getFieldContainerStore (void) const |
Static Public Member Functions | |
| static FieldContainerFactory * | the (void) |
Protected Types | |
| typedef std::map< UInt32, FieldContainerType * > | TypeIdMap |
| typedef std::map< IDStringLink, FieldContainerType * > | TypeNameMap |
| typedef std::map< IDStringLink, UInt16 > | GroupMap |
| typedef std::vector< FieldContainerType * > | UninitializedTypeStore |
| typedef std::vector< FieldContainerPtr > | FieldContainerStore |
| typedef TypeIdMap::iterator | TypeIdMapIt |
| typedef TypeNameMap::iterator | TypeNameMapIt |
| typedef GroupMap::iterator | GroupMapIt |
| typedef UninitializedTypeStore::iterator | UninitTypeStoreIt |
| typedef FieldContainerStore::iterator | FieldContainerStoreIt |
| typedef TypeIdMap::const_iterator | TypeIdMapConstIt |
| typedef TypeNameMap::const_iterator | TypeNameMapCnstIt |
| typedef GroupMap::const_iterator | GroupMapConstIt |
Protected Member Functions | |
Constructors | |
| * | FieldContainerFactory (void) |
Destructor | |
| *virtual | ~FieldContainerFactory (void) |
Instance Initialization / Termination | |
| *bool | initialize (void) |
| bool | terminate (void) |
| void | initTypeMap (void) |
Register | |
| *bool | unregisterFieldContainer (const FieldContainerPtr &pFieldContainer) |
| UInt32 | registerFieldContainer (const FieldContainerPtr &pFieldContainer) |
| UInt32 | registerType (FieldContainerType *pType) |
| UInt16 | registerGroup (const Char8 *szName) |
| void | unregisterType (FieldContainerType *pType) |
Write FCD From Type | |
| *void | writeSingleTypeFCD (std::ostream &out, const FieldContainerType *type) |
Static Protected Member Functions | |
Intialization / Termination | |
| *static bool | initializeFactory (void) |
| static bool | terminateFactory (void) |
Protected Attributes | |
Member | |
| *bool | _bInitialized |
| TypeIdMap * | _pTypeIdMap |
| TypeNameMap * | _pTypeNameMap |
| GroupMap * | _pGroupMap |
| UninitializedTypeStore * | _pUnitTypesStore |
| FieldContainerStore * | _pFieldContainerStore |
| Lock * | _pStoreLock |
| Lock * | _pMapLock |
| FieldContainerMapper * | _pMapper |
Static Protected Attributes | |
| static FieldContainerFactory * | _the = NULL |
| static TypeMapIterator | _defaultTypeMapIt |
Private Member Functions | |
| FieldContainerFactory (const FieldContainerFactory &source) | |
| prohibit default function (move to 'public' if needed) | |
| void | operator= (const FieldContainerFactory &source) |
| prohibit default function (move to 'public' if needed) | |
Friends | |
| class | FieldContainerType |
| class | FieldContainer |
| class | FieldContainerPtrBase |
Definition at line 83 of file OSGFieldContainerFactoryImpl.h.
|
|
Definition at line 90 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 92 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 94 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 96 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 97 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 99 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 100 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 101 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 102 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 103 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 105 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 106 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 107 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 114 of file OSGFieldContainerFactoryImpl.h. |
|
|
Definition at line 445 of file OSGFieldContainerFactory.cpp. References osg::addInitFunction(), osg::addSystemExitFunction(), osg::FieldContainerPtrBase::initialize(), initializeFactory(), initTypeMap(), osg::FieldContainerPtrBase::terminate(), and terminateFactory(). Referenced by the(). 00445 : 00446 _bInitialized (false), 00447 _pTypeIdMap (NULL ), 00448 _pTypeNameMap (NULL ), 00449 _pGroupMap (NULL ), 00450 _pUnitTypesStore (NULL ), 00451 _pFieldContainerStore(NULL ), 00452 _pStoreLock (NULL ), 00453 _pMapLock (NULL ), 00454 _pMapper (NULL ) 00455 { 00456 addInitFunction (&FieldContainerPtr::initialize ); 00457 addInitFunction (&FieldContainerFactory::initializeFactory); 00458 00459 addSystemExitFunction(&FieldContainerPtr::terminate ); 00460 addSystemExitFunction(&FieldContainerFactory::terminateFactory ); 00461 00462 initTypeMap(); 00463 }
|
|
|
Definition at line 468 of file OSGFieldContainerFactory.cpp.
|
|
|
|
|
|
|
Definition at line 88 of file OSGFieldContainerFactory.cpp. References _pTypeIdMap. Referenced by createAttachment(), createFieldContainer(), createNode(), createNodeCore(), osg::deepClone(), osg::deepCloneAttachments(), osg::FieldContainerType::initParentFields(), osg::SharePtrGraphOp::isInList(), osg::RemoteAspect::receiveSync(), and writeFCD(). 00089 { 00090 TypeIdMapConstIt typeIt; 00091 FieldContainerType *pType = NULL; 00092 00093 if(_pTypeIdMap) 00094 { 00095 typeIt = _pTypeIdMap->find(uiTypeId); 00096 pType = (typeIt == _pTypeIdMap->end()) ? NULL : (*typeIt).second; 00097 } 00098 00099 return pType; 00100 }
|
|
|
Definition at line 102 of file OSGFieldContainerFactory.cpp. References _pTypeNameMap. 00103 { 00104 TypeNameMapCnstIt typeIt; 00105 FieldContainerType *pType = NULL; 00106 00107 if(_pTypeNameMap) 00108 { 00109 typeIt = _pTypeNameMap->find(IDStringLink(szName)); 00110 pType = (typeIt == _pTypeNameMap->end()) ? NULL : (*typeIt).second; 00111 } 00112 00113 return pType; 00114 }
|
|
|
Definition at line 116 of file OSGFieldContainerFactory.cpp. References _pTypeNameMap. 00117 { 00118 return _pTypeNameMap ? _pTypeNameMap->size() : 0; 00119 }
|
|
|
Definition at line 121 of file OSGFieldContainerFactory.cpp. References _pUnitTypesStore, and osg::stringcmp(). Referenced by osg::FieldContainerType::initParentFields(). 00123 { 00124 FieldContainerType *returnValue = NULL; 00125 00126 if(_pUnitTypesStore == NULL || szName == NULL) 00127 return returnValue; 00128 00129 for(UInt32 i = 0; i < _pUnitTypesStore->size(); i++) 00130 { 00131 if(stringcmp(szName, (*_pUnitTypesStore)[i]->getCName()) == 0) 00132 { 00133 returnValue = (*_pUnitTypesStore)[i]; 00134 break; 00135 } 00136 } 00137 00138 return returnValue; 00139 }
|
|
|
Definition at line 145 of file OSGFieldContainerFactory.cpp. References _bInitialized, _pMapLock, _pTypeIdMap, _pUnitTypesStore, osg::Lock::aquire(), osg::TypeBase::getCName(), osg::TypeBase::getId(), osg::FieldContainerType::initialize(), osg::FieldContainerType::isInitialized(), PINFO, osg::Lock::release(), and SINFO. Referenced by initialize(). 00146 { 00147 bool returnValue = true; 00148 FieldContainerType *pType = NULL; 00149 00150 if(_bInitialized == false) 00151 return false; 00152 00153 SINFO << "OSGFieldContainerFactory init pending types" << std::endl; 00154 00155 if(_pUnitTypesStore != NULL) 00156 { 00157 if(_pMapLock != NULL) 00158 _pMapLock->aquire(); 00159 00160 UninitTypeStoreIt uninitIt = _pUnitTypesStore->begin(); 00161 00162 while(uninitIt != _pUnitTypesStore->end()) 00163 { 00164 pType = *uninitIt; 00165 00166 if(pType->isInitialized() == true) 00167 { 00168 uninitIt = _pUnitTypesStore->erase(uninitIt); 00169 00170 // (*_pTypeIdMap )[pType->getId() ] = pType; 00171 00172 TypeIdMap::value_type val(pType->getId(), pType); 00173 00174 _pTypeIdMap->insert(val); 00175 00176 (*_pTypeNameMap)[IDStringLink(pType->getCName())] = pType; 00177 } 00178 else 00179 { 00180 if(pType->initialize() == true) 00181 { 00182 uninitIt = _pUnitTypesStore->erase(uninitIt); 00183 00184 // (*_pTypeIdMap )[pType->getId() ] = pType; 00185 00186 TypeIdMap::value_type val(pType->getId(), pType); 00187 00188 _pTypeIdMap->insert(val); 00189 00190 (*_pTypeNameMap)[IDStringLink(pType->getCName())] = pType; 00191 } 00192 else 00193 { 00194 returnValue = false; 00195 00196 uninitIt++; 00197 } 00198 } 00199 } 00200 00201 if(_pMapLock != NULL) 00202 _pMapLock->release(); 00203 00204 PINFO << "(" 00205 << returnValue 00206 << "|" 00207 << _pUnitTypesStore->size() 00208 << ")" 00209 << std::endl; 00210 } 00211 00212 return returnValue; 00213 }
|
|
|
Definition at line 219 of file OSGFieldContainerFactory.cpp. References _defaultTypeMapIt, and _pTypeIdMap. Referenced by osg::RemoteAspect::RemoteAspect(). 00220 { 00221 TypeMapIterator returnValue = _defaultTypeMapIt; 00222 00223 if(_pTypeIdMap != NULL) 00224 { 00225 returnValue = _pTypeIdMap->begin(); 00226 } 00227 00228 return returnValue; 00229 }
|
|
|
Definition at line 231 of file OSGFieldContainerFactory.cpp. References _defaultTypeMapIt, and _pTypeIdMap. Referenced by osg::RemoteAspect::RemoteAspect(). 00232 { 00233 TypeMapIterator returnValue = _defaultTypeMapIt; 00234 00235 if(_pTypeIdMap != NULL) 00236 { 00237 returnValue = _pTypeIdMap->end(); 00238 } 00239 00240 return returnValue; 00241 }
|
|
|
Definition at line 247 of file OSGFieldContainerFactory.cpp. References _pGroupMap. Referenced by registerGroup(). 00248 { 00249 GroupMapConstIt gIt; 00250 00251 if (_pGroupMap) 00252 { 00253 gIt = _pGroupMap->find(IDStringLink(szName)); 00254 return ((gIt == _pGroupMap->end()) ? 0 : (*gIt).second); 00255 } 00256 00257 return 0; 00258 }
|
|
|
Definition at line 260 of file OSGFieldContainerFactory.cpp. References _pGroupMap. Referenced by osg::deepClone(), osg::deepCloneAttachments(), and osg::deepCloneTree(). 00261 { 00262 GroupMapConstIt gIt; 00263 00264 for(gIt = _pGroupMap->begin(); gIt != _pGroupMap->end(); gIt++) 00265 { 00266 if((*gIt).second == uiGroupId) 00267 return (*gIt).first.str(); 00268 } 00269 00270 return NULL; 00271 }
|
|
|
Definition at line 273 of file OSGFieldContainerFactory.cpp. References _pGroupMap. 00274 { 00275 return _pGroupMap ? _pGroupMap->size() : 0; 00276 }
|
|
|
Definition at line 54 of file OSGFieldContainerFactoryImpl.inl. References _pMapper. Referenced by osg::BINLoader::chargeFieldContainers(), and osg::RemoteAspect::receiveSync(). 00055 { 00056 _pMapper = pMapper; 00057 }
|
|
|
Definition at line 63 of file OSGFieldContainerFactoryImpl.inl. References _pFieldContainerStore, _pStoreLock, osg::Lock::aquire(), osg::NullFC, and osg::Lock::release(). Referenced by osg::ChangeList::apply(), osg::ChangeList::applyTo(), getMappedContainer(), osg::RemoteAspect::receiveSync(), osg::RemoteAspect::restoreChangeList(), osg::RemoteAspect::sendSync(), and osg::RemoteAspect::~RemoteAspect(). 00065 { 00066 FieldContainerPtr returnValue = NullFC; 00067 00068 _pStoreLock->aquire(); 00069 00070 if(uiContainerId < _pFieldContainerStore->size()) 00071 { 00072 returnValue = (*_pFieldContainerStore)[uiContainerId]; 00073 } 00074 00075 _pStoreLock->release(); 00076 00077 return returnValue; 00078 }
|
|
|
Definition at line 81 of file OSGFieldContainerFactoryImpl.inl. References _pMapper, getContainer(), and osg::FieldContainerMapper::map(). 00083 { 00084 if(_pMapper != NULL) 00085 { 00086 return getContainer(_pMapper->map(uiContainerId)); 00087 } 00088 else 00089 { 00090 return getContainer(uiContainerId); 00091 } 00092 }
|
|
|
Definition at line 282 of file OSGFieldContainerFactory.cpp. References osg::FieldContainerType::createFieldContainer(), and findType(). Referenced by osg::OSGLoader::beginNode(), osg::BINLoader::createFieldContainers(), osg::deepClone(), and osg::VRMLGeometryPartDesc::init(). 00284 { 00285 FieldContainerPtr returnValue; 00286 00287 const FieldContainerType *pType = findType(name); 00288 00289 if(pType != NULL) 00290 returnValue = pType->createFieldContainer(); 00291 00292 return returnValue; 00293 }
|
|
|
Definition at line 295 of file OSGFieldContainerFactory.cpp. References osg::FieldContainerType::createNode(), and findType(). 00296 { 00297 NodePtr returnValue; 00298 00299 const FieldContainerType *pType = findType(name); 00300 00301 if(pType != NULL) 00302 returnValue = pType->createNode(); 00303 00304 return returnValue; 00305 }
|
|
|
Definition at line 307 of file OSGFieldContainerFactory.cpp. References osg::FieldContainerType::createNodeCore(), and findType(). 00309 { 00310 NodeCorePtr returnValue; 00311 00312 const FieldContainerType *pType = findType(name); 00313 00314 if(pType != NULL) 00315 returnValue = pType->createNodeCore(); 00316 00317 return returnValue; 00318 }
|
|
|
Definition at line 320 of file OSGFieldContainerFactory.cpp. References osg::FieldContainerType::createAttachment(), and findType(). 00322 { 00323 AttachmentPtr returnValue; 00324 00325 const FieldContainerType *pType = findType(name); 00326 00327 if(pType != NULL) 00328 returnValue = pType->createAttachment(); 00329 00330 return returnValue; 00331 }
|
|
||||||||||||
|
Definition at line 342 of file OSGFieldContainerFactory.cpp. References _pTypeIdMap, findType(), osg::TypeBase::getCName(), SWARNING, and writeSingleTypeFCD(). 00343 { 00344 TypeIdMapIt type; 00345 const FieldContainerType *pType = NULL; 00346 00347 if(_pTypeIdMap == NULL) 00348 return; 00349 00350 if(name != NULL) 00351 { 00352 pType = findType(name); 00353 00354 if(pType == NULL) 00355 { 00356 SWARNING << "FieldContainerFactory::writeFCD: type " << name 00357 << " is unknown!" << std::endl; 00358 return; 00359 } 00360 00361 if(out != NULL) 00362 { 00363 writeSingleTypeFCD(*out, pType); 00364 } 00365 else 00366 { 00367 std::string s(pType->getCName()); 00368 00369 s.append(".fcd"); 00370 00371 std::ofstream f(s.c_str()); 00372 00373 writeSingleTypeFCD(f, pType); 00374 } 00375 00376 return; 00377 } 00378 00379 // write header once? 00380 if(out != NULL) 00381 { 00382 *out << "<?xml version=\"1.0\" ?>" << std::endl << std::endl; 00383 } 00384 00385 for( type = _pTypeIdMap->begin(); 00386 type != _pTypeIdMap->end (); 00387 ++type) 00388 { 00389 if(out != NULL) 00390 { 00391 writeSingleTypeFCD(*out, (*type).second); 00392 } 00393 else 00394 { 00395 std::string s((*type).second->getCName()); 00396 00397 s.append(".fcd"); 00398 00399 std::ofstream f(s.c_str()); 00400 00401 f << "<?xml version=\"1.0\" ?>" << std::endl << std::endl; 00402 00403 writeSingleTypeFCD(f, (*type).second); 00404 } 00405 00406 if(out != NULL) 00407 { 00408 *out << std::endl; 00409 } 00410 } 00411 }
|
|
|
Definition at line 417 of file OSGFieldContainerFactory.cpp. References _pFieldContainerStore. Referenced by osg::QSceneGraphView::onRawAddressEntered(). 00418 { 00419 return _pFieldContainerStore; 00420 }
|
|
|
Definition at line 426 of file OSGFieldContainerFactory.cpp. References initialize(), and the(). Referenced by FieldContainerFactory(). 00427 { 00428 bool returnValue = the()->initialize(); 00429 00430 // CHECKCHECK 00431 // clear changelist from prototypes, move this to a different place soon 00432 OSG::Thread::getCurrentChangeList()->clearAll(); 00433 00434 return returnValue; 00435 }
|
|
|
Definition at line 437 of file OSGFieldContainerFactory.cpp. References terminate(), and the(). Referenced by FieldContainerFactory().
|
|
|
Definition at line 475 of file OSGFieldContainerFactory.cpp. References _bInitialized, _pMapLock, _pStoreLock, osg::addRefP(), FDEBUG, osg::ThreadManager::getLock(), initializePendingTypes(), SINFO, and osg::ThreadManager::the(). Referenced by initializeFactory(). 00476 { 00477 TypeIdMapIt typeIt; 00478 00479 if(_bInitialized == true) 00480 return true; 00481 00482 SINFO << "init singleton FieldContainerFactory" << std::endl; 00483 00484 _pStoreLock = ThreadManager::the()->getLock( 00485 "OSGFieldContainerFactory::_pStoreLock"); 00486 00487 addRefP(_pStoreLock); 00488 00489 _pMapLock = ThreadManager::the()->getLock( 00490 "OSGFieldContainerFactory::_pMaoLock"); 00491 00492 addRefP(_pMapLock); 00493 00494 FDEBUG( ("Got shore lock %p, Got map %p", 00495 _pStoreLock, _pMapLock) ); 00496 00497 _bInitialized = true; 00498 00499 initializePendingTypes(); 00500 00501 return _pStoreLock != NULL && _pMapLock != NULL; 00502 }
|
|
|
Definition at line 504 of file OSGFieldContainerFactory.cpp. References _bInitialized, _pMapLock, _pStoreLock, _pTypeIdMap, SINFO, and osg::subRefP(). Referenced by terminateFactory(). 00505 { 00506 TypeIdMapIt typeIt; 00507 00508 SINFO << "terminate singleton FieldContainerFactory" << std::endl; 00509 00510 if(_bInitialized == false) 00511 return true; 00512 00513 if(_pTypeIdMap != NULL) 00514 { 00515 int i = 0; 00516 for( typeIt = _pTypeIdMap->begin(); 00517 typeIt != _pTypeIdMap->end(); 00518 ++typeIt) 00519 { 00520 (*typeIt).second->terminate(); 00521 00522 i++; 00523 } 00524 } 00525 00526 subRefP(_pStoreLock); 00527 subRefP(_pMapLock); 00528 00529 _bInitialized = false; 00530 00531 return true; 00532 }
|
|
|
Definition at line 534 of file OSGFieldContainerFactory.cpp. References _pGroupMap, _pTypeIdMap, _pTypeNameMap, and _pUnitTypesStore. Referenced by FieldContainerFactory(). 00535 { 00536 if(_pTypeIdMap == NULL && 00537 _pTypeNameMap == NULL) 00538 { 00539 _pTypeIdMap = new TypeIdMap; 00540 _pTypeNameMap = new TypeNameMap; 00541 _pGroupMap = new GroupMap; 00542 _pUnitTypesStore = new UninitializedTypeStore; 00543 } 00544 }
|
|
|
Definition at line 124 of file |