Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

712 lines
18 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef GENERICPERSISTENTMANAGER_H
  5. #define GENERICPERSISTENTMANAGER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "replay/replayhandle.h"
  11. #include "replay/ienginereplay.h"
  12. #include "replay/replayutils.h"
  13. #include "basethinker.h"
  14. #include "utllinkedlist.h"
  15. #include "utlstring.h"
  16. #include "KeyValues.h"
  17. #include "filesystem.h"
  18. #include "convar.h"
  19. #include "replay/ireplayserializeable.h"
  20. #include "replay/ireplaycontext.h"
  21. #include "replay/shared_defs.h"
  22. #include "replay_dbg.h"
  23. #include "vprof.h"
  24. #include "fmtstr.h"
  25. #include "UtlSortVector.h"
  26. // memdbgon must be the last include file in a .cpp file!!!
  27. #include "tier0/memdbgon.h"
  28. //----------------------------------------------------------------------------------------
  29. extern IEngineReplay *g_pEngine;
  30. //----------------------------------------------------------------------------------------
  31. template< class T >
  32. class CGenericPersistentManager : public CBaseThinker
  33. {
  34. public:
  35. CGenericPersistentManager();
  36. virtual ~CGenericPersistentManager();
  37. virtual bool Init( bool bLoad = true );
  38. virtual void Shutdown();
  39. virtual T *Create() = 0; // Create an object
  40. T *CreateAndGenerateHandle(); // Creates a new object and generates a unique handle
  41. void Add( T *pNewObj ); // Commit the object - NOTE: The Create*() functions don't call Add() for you
  42. void Remove( ReplayHandle_t hObj ); // Remove() will remove the object, remove any .dmx associated with the object on disk, and usually delete attached files (like .dems or movies, etc, depending on what the manager implementation is)
  43. void Remove( T *pObj );
  44. void RemoveFromIndex( int it );
  45. void Clear(); // Remove all objects - NOTE: Doesn't save right away
  46. bool WriteObjToFile( T *pObj, const char *pFilename ); // Write object data to an arbitrary file
  47. bool Save(); // Saves any unsaved data immediately
  48. void FlagIndexForFlush(); // Mark index as dirty
  49. void FlagForFlush( T *pObj, bool bForceImmediate ); // Mark an object as dirty
  50. void FlagForUnload( T *pObj ); // Unload as soon as possible
  51. T *Find( ReplayHandle_t hHandle );
  52. int FindIteratorFromHandle( ReplayHandle_t hHandle );
  53. int Count() const;
  54. bool IsDirty( T *pNewObj );
  55. virtual void Think(); // IReplayThinker implementation - NOTE: not meant to be called directly - called from think manager
  56. virtual const char *GetIndexPath() const; // Should return path where index file lives
  57. private:
  58. class CLessFunctor
  59. {
  60. public:
  61. bool Less( const T *pSrc1, const T *pSrc2, void *pContext )
  62. {
  63. return pSrc1->GetHandle() < pSrc2->GetHandle();
  64. }
  65. };
  66. public:
  67. typedef CUtlSortVector< T *, CLessFunctor > ObjContainer_t;
  68. ObjContainer_t m_vecObjs;
  69. protected:
  70. // For derived classes to implement:
  71. virtual IReplayContext *GetReplayContext() const = 0;
  72. virtual const char *GetRelativeIndexPath() const = 0; // Should return relative (to replay/client or replay/server) path where index file lives - NOTE: Last char should be a slash
  73. virtual const char *GetIndexFilename() const = 0; // Should return just the name of the file, e.g. "replays.dmx"
  74. virtual const char *GetDebugName() const = 0;
  75. virtual bool ShouldDeleteObjects() const { return true; } // TODO: Used by Clear() - I'm not convinced this is needed yet though.
  76. virtual int GetVersion() const = 0;
  77. virtual bool ShouldSerializeToIndividualFiles() const { return true; }
  78. virtual bool ShouldSerializeIndexWithFullPath() const { return false; }
  79. virtual bool ShouldLoadObj( const T *pObj ) const { return true; }
  80. virtual void OnObjLoaded( T *pObj ) {}
  81. virtual int GetHandleBase() const { return 0; } // Subclass can implement this to provide a base/minimum for handles
  82. virtual void PreLoad() {}
  83. const char *GetIndexFullFilename() const; // Should return the full path to the main .dmx file
  84. bool HaveDirtyObjects() const;
  85. bool HaveObjsToUnload() const;
  86. bool ReadObjFromFile( const char *pFile, T *&pOut, bool bForceLoad );
  87. bool Load();
  88. virtual float GetNextThinkTime() const; // IReplayThinker implementation
  89. void FlushThink();
  90. void UnloadThink();
  91. void CreateIndexDir();
  92. void ReadObjFromKeyValues( KeyValues *pObjData );
  93. T* ReadObjFromKeyValues( KeyValues *pObjData, bool bForceLoad );
  94. bool ReadObjFromFile( const char *pFile );
  95. void UpdateHandleSeed( ReplayHandle_t hNewHandle );
  96. typedef CUtlLinkedList< T *, int > ListContainer_t;
  97. ReplayHandle_t m_nHandleSeed;
  98. int m_nVersion;
  99. bool m_bIndexDirty;
  100. ListContainer_t m_lstDirtyObjs;
  101. ListContainer_t m_lstObjsToUnload;
  102. float m_flNextFlushTime;
  103. float m_flNextUnloadTime;
  104. };
  105. //----------------------------------------------------------------------------------------
  106. template< class T >
  107. bool CGenericPersistentManager< T >::Init( bool bLoad/*=true*/ )
  108. {
  109. // Make directory structure is in place
  110. CreateIndexDir();
  111. // Initialize handle seed to start at base
  112. m_nHandleSeed = GetHandleBase();
  113. return bLoad ? Load() : true;
  114. }
  115. template< class T >
  116. void CGenericPersistentManager< T >::Shutdown()
  117. {
  118. Save();
  119. }
  120. template< class T >
  121. CGenericPersistentManager< T >::CGenericPersistentManager()
  122. : m_nHandleSeed( 0 ),
  123. m_nVersion( -1 ),
  124. m_bIndexDirty( false ),
  125. m_flNextFlushTime( 0.0f ),
  126. m_flNextUnloadTime( 0.0f )
  127. {
  128. }
  129. template< class T >
  130. CGenericPersistentManager< T >::~CGenericPersistentManager()
  131. {
  132. Clear();
  133. }
  134. template< class T >
  135. void CGenericPersistentManager< T >::Clear()
  136. {
  137. if ( ShouldDeleteObjects() )
  138. {
  139. m_vecObjs.PurgeAndDeleteElements();
  140. }
  141. else
  142. {
  143. m_vecObjs.RemoveAll();
  144. }
  145. // NOTE: This list contains pointers to objects in m_vecObjs, so no destruction of elements here
  146. m_lstDirtyObjs.RemoveAll();
  147. m_lstObjsToUnload.RemoveAll();
  148. }
  149. template< class T >
  150. int CGenericPersistentManager< T >::Count() const
  151. {
  152. return m_vecObjs.Count();
  153. }
  154. template< class T >
  155. void CGenericPersistentManager< T >::FlagIndexForFlush()
  156. {
  157. m_bIndexDirty = true;
  158. IF_REPLAY_DBG2( Warning( "%f %s: Index flagged\n", g_pEngine->GetHostTime(), GetDebugName() ) );
  159. }
  160. template< class T >
  161. void CGenericPersistentManager< T >::FlagForFlush( T *pObj, bool bForceImmediate )
  162. {
  163. if ( !pObj )
  164. {
  165. AssertMsg( 0, "Trying to flag a NULL object for flush." );
  166. return;
  167. }
  168. // Add to dirty list if it's not already there
  169. if ( m_lstDirtyObjs.Find( pObj ) == m_lstDirtyObjs.InvalidIndex() )
  170. {
  171. m_lstDirtyObjs.AddToTail( pObj );
  172. }
  173. IF_REPLAY_DBG2( Warning( "%f %s: Obj %s flagged for flush\n", g_pEngine->GetHostTime(), GetDebugName(), pObj->GetDebugName() ) );
  174. // Force write now?
  175. if ( bForceImmediate )
  176. {
  177. Save();
  178. }
  179. }
  180. template< class T >
  181. void CGenericPersistentManager< T >::FlagForUnload( T *pObj )
  182. {
  183. AssertMsg(
  184. ShouldSerializeToIndividualFiles(),
  185. "This functionality should only be used for managers that write to individual files, i.e. NOT managers that maintain one monolithic index."
  186. );
  187. if ( !pObj )
  188. {
  189. AssertMsg( 0, "Trying to flag a NULL object for unload." );
  190. return;
  191. }
  192. if ( m_lstObjsToUnload.Find( pObj ) == m_lstObjsToUnload.InvalidIndex() )
  193. {
  194. m_lstObjsToUnload.AddToTail( pObj );
  195. }
  196. IF_REPLAY_DBG2( Warning( "%f %s: Obj %s flagged for unload\n", g_pEngine->GetHostTime(), GetDebugName(), pObj->GetDebugName() ) );
  197. }
  198. template< class T >
  199. bool CGenericPersistentManager< T >::IsDirty( T *pNewObj )
  200. {
  201. return m_lstDirtyObjs.Find( pNewObj ) != m_lstDirtyObjs.InvalidIndex();
  202. }
  203. template< class T >
  204. void CGenericPersistentManager< T >::Add( T *pNewObj )
  205. {
  206. IF_REPLAY_DBG2( Warning( "Adding object with handle %i\n", pNewObj->GetHandle() ) );
  207. Assert( m_vecObjs.Find( pNewObj ) == m_vecObjs.InvalidIndex() );
  208. m_vecObjs.Insert( pNewObj );
  209. FlagIndexForFlush();
  210. FlagForFlush( pNewObj, false );
  211. }
  212. template< class T >
  213. void CGenericPersistentManager< T >::Remove( ReplayHandle_t hObj )
  214. {
  215. int itObj = FindIteratorFromHandle( hObj );
  216. if ( itObj == m_vecObjs.InvalidIndex() )
  217. {
  218. AssertMsg( 0, "Attemting to remove an object which does not exist." );
  219. return;
  220. }
  221. RemoveFromIndex( itObj );
  222. }
  223. template< class T >
  224. void CGenericPersistentManager< T >::Remove( T *pObj )
  225. {
  226. const int it = m_vecObjs.Find( pObj );
  227. if ( it != m_vecObjs.InvalidIndex() )
  228. {
  229. RemoveFromIndex( it );
  230. }
  231. }
  232. template< class T >
  233. void CGenericPersistentManager< T >::RemoveFromIndex( int it )
  234. {
  235. T *pObj = m_vecObjs[ it ]; // NOTE: Constant speed since the implementation of
  236. // CUtlLinkedList indexes into an array
  237. // Remove file associated w/ this object if necessary
  238. if ( ShouldSerializeToIndividualFiles() )
  239. {
  240. CUtlString strFullFilename = pObj->GetFullFilename();
  241. bool bSimulateDelete = false;
  242. #if _DEBUG
  243. extern ConVar replay_fileserver_simulate_delete;
  244. bSimulateDelete = replay_fileserver_simulate_delete.GetBool();
  245. #endif
  246. if ( g_pFullFileSystem->FileExists( strFullFilename.Get() ) && !bSimulateDelete )
  247. {
  248. g_pFullFileSystem->RemoveFile( strFullFilename.Get() );
  249. }
  250. }
  251. Assert( !pObj->IsLocked() );
  252. // Let the object do stuff before it gets deleted
  253. pObj->OnDelete();
  254. // If the object is in the dirty list, remove it - NOTE: this is safe
  255. m_lstDirtyObjs.FindAndRemove( pObj );
  256. // The object should not be in the 'objects-to-unload' list
  257. AssertMsg( m_lstObjsToUnload.Find( pObj ) == m_lstObjsToUnload.InvalidIndex(), "The object being removed was also in the unload list - is this OK? If so, code should be added to remove from that list as well." );
  258. // Remove the object
  259. m_vecObjs.Remove( it );
  260. // Free the object
  261. delete pObj;
  262. FlagIndexForFlush();
  263. }
  264. template< class T >
  265. T *CGenericPersistentManager< T >::Find( ReplayHandle_t hHandle )
  266. {
  267. FOR_EACH_VEC( m_vecObjs, i )
  268. {
  269. T *pCurObj = m_vecObjs[ i ];
  270. if ( hHandle == pCurObj->GetHandle() )
  271. {
  272. return pCurObj;
  273. }
  274. }
  275. return NULL;
  276. }
  277. template< class T >
  278. int CGenericPersistentManager< T >::FindIteratorFromHandle( ReplayHandle_t hHandle )
  279. {
  280. FOR_EACH_VEC( m_vecObjs, i )
  281. {
  282. T *pCurObj = m_vecObjs[ i ];
  283. if ( hHandle == pCurObj->GetHandle() )
  284. {
  285. return i;
  286. }
  287. }
  288. return m_vecObjs.InvalidIndex();
  289. }
  290. template< class T >
  291. bool CGenericPersistentManager< T >::Load()
  292. {
  293. bool bResult = true;
  294. Clear();
  295. PreLoad();
  296. const char *pFullFilename = GetIndexFullFilename();
  297. // Attempt to load from disk
  298. KeyValuesAD pRoot( pFullFilename );
  299. if ( pRoot->LoadFromFile( g_pFullFileSystem, pFullFilename ) )
  300. {
  301. // Get file format version
  302. m_nVersion = pRoot->GetInt( "version", -1 );
  303. if ( m_nVersion != GetVersion() )
  304. {
  305. Warning( "File (%s) has old format (%i).\n", pFullFilename, m_nVersion );
  306. }
  307. // Read from individual files?
  308. if ( ShouldSerializeToIndividualFiles() )
  309. {
  310. KeyValues *pFileIndex = pRoot->FindKey( "files" );
  311. if ( pFileIndex )
  312. {
  313. FOR_EACH_VALUE( pFileIndex, pValue )
  314. {
  315. const char *pName = pValue->GetName();
  316. if ( !ReadObjFromFile( pName ) )
  317. {
  318. Warning( "Failed to load data from file, \"%s\"\n", pName );
  319. }
  320. }
  321. }
  322. else
  323. {
  324. // Peek in directory and load files based on what's there
  325. CFmtStr fmtPath( "%s*.%s", GetIndexPath(), GENERIC_FILE_EXTENSION );
  326. FileFindHandle_t hFind;
  327. const char *pFilename = g_pFullFileSystem->FindFirst( fmtPath.Access(), &hFind );
  328. while ( pFilename )
  329. {
  330. // Ignore index file
  331. if ( V_stricmp( pFilename, GetIndexFilename() ) )
  332. {
  333. if ( !ReadObjFromFile( pFilename ) )
  334. {
  335. Warning( "Failed to load data from file, \"%s\"\n", pFilename );
  336. }
  337. }
  338. pFilename = g_pFullFileSystem->FindNext( hFind );
  339. }
  340. }
  341. }
  342. else
  343. {
  344. FOR_EACH_TRUE_SUBKEY( pRoot, pObjSubKey )
  345. {
  346. // Read data
  347. m_vecObjs.Insert( ReadObjFromKeyValues( pObjSubKey, false ) );
  348. }
  349. }
  350. // Let derived class do any per-object processing.
  351. FOR_EACH_VEC( m_vecObjs, i )
  352. {
  353. OnObjLoaded( m_vecObjs[ i ] );
  354. }
  355. }
  356. return bResult;
  357. }
  358. template< class T >
  359. bool CGenericPersistentManager< T >::WriteObjToFile( T *pObj, const char *pFilename )
  360. {
  361. // Create a keyvalues for the object
  362. KeyValuesAD pObjData( pObj->GetSubKeyTitle() );
  363. // Fill the keyvalues w/ data
  364. pObj->Write( pObjData );
  365. // Attempt to save the current object data to a separate file
  366. if ( !pObjData->SaveToFile( g_pFullFileSystem, pFilename ) )
  367. {
  368. Warning( "Failed to write file %s\n", pFilename );
  369. return false;
  370. }
  371. return true;
  372. }
  373. template< class T >
  374. bool CGenericPersistentManager< T >::Save()
  375. {
  376. IF_REPLAY_DBG2( Warning( "%f %s: Saving now...\n", g_pEngine->GetHostTime(), GetDebugName() ) );
  377. bool bResult = true;
  378. // Add subkey for movies
  379. KeyValuesAD pRoot( "root" );
  380. // Write format version
  381. pRoot->SetInt( "version", GetVersion() );
  382. // Write a file index instead of adding subkeys to the root?
  383. if ( ShouldSerializeToIndividualFiles() )
  384. {
  385. // Go through each object in the dirty list and write to a separate file
  386. FOR_EACH_LL( m_lstDirtyObjs, i )
  387. {
  388. T *pCurObj = m_lstDirtyObjs[ i ];
  389. // Write to the file
  390. bResult = bResult && WriteObjToFile( pCurObj, pCurObj->GetFullFilename() );
  391. }
  392. }
  393. // Write all objects to one monolithic file - writes all objects (ignores "dirtyness")
  394. else
  395. {
  396. FOR_EACH_VEC( m_vecObjs, i )
  397. {
  398. T *pCurObj = m_vecObjs[ i ];
  399. // Create a keyvalues for the object
  400. KeyValues *pCurObjData = new KeyValues( pCurObj->GetSubKeyTitle() );
  401. // Fill the keyvalues w/ data
  402. pCurObj->Write( pCurObjData );
  403. // Add as a subkey to the root keyvalues
  404. pRoot->AddSubKey( pCurObjData );
  405. }
  406. }
  407. // Clear the dirty list
  408. m_lstDirtyObjs.RemoveAll();
  409. // Write the index file if dirty
  410. if ( m_bIndexDirty )
  411. {
  412. return bResult && pRoot->SaveToFile( g_pFullFileSystem, GetIndexFullFilename() );
  413. }
  414. return bResult;
  415. }
  416. template< class T >
  417. T *CGenericPersistentManager< T >::CreateAndGenerateHandle()
  418. {
  419. T *pNewObj = Create();
  420. pNewObj->SetHandle( m_nHandleSeed++ ); Assert( Find( pNewObj->GetHandle() ) == NULL );
  421. FlagIndexForFlush();
  422. return pNewObj;
  423. }
  424. template< class T >
  425. float CGenericPersistentManager< T >::GetNextThinkTime() const
  426. {
  427. // Always think
  428. return 0.0f;
  429. }
  430. template< class T >
  431. void CGenericPersistentManager< T >::Think()
  432. {
  433. VPROF_BUDGET( "CGenericPersistentManager::Think", VPROF_BUDGETGROUP_REPLAY );
  434. CBaseThinker::Think();
  435. FlushThink();
  436. UnloadThink();
  437. }
  438. template< class T >
  439. void CGenericPersistentManager< T >::FlushThink()
  440. {
  441. const float flHostTime = g_pEngine->GetHostTime();
  442. bool bTimeToFlush = flHostTime >= m_flNextFlushTime;
  443. if ( !bTimeToFlush || ( !m_bIndexDirty && !HaveDirtyObjects() ) )
  444. return;
  445. // Flush now and clear dirty objects
  446. Save();
  447. // Reset
  448. m_bIndexDirty = false;
  449. // Setup next flush think
  450. extern ConVar replay_flushinterval;
  451. m_flNextFlushTime = flHostTime + replay_flushinterval.GetInt();
  452. }
  453. template< class T >
  454. void CGenericPersistentManager< T >::UnloadThink()
  455. {
  456. const float flHostTime = g_pEngine->GetHostTime();
  457. bool bTimeToUnload = flHostTime >= m_flNextUnloadTime;
  458. if ( !bTimeToUnload || !HaveObjsToUnload() )
  459. return;
  460. // Unload objects now
  461. FOR_EACH_LL( m_lstObjsToUnload, i )
  462. {
  463. T *pObj = m_lstObjsToUnload[ i ];
  464. // If the object has been marked as locked, don't unload it.
  465. if ( pObj->IsLocked() )
  466. continue;
  467. // If we're waiting to flush the file, don't unload it yet
  468. if ( IsDirty( pObj ) )
  469. continue;
  470. // Let the object do stuff before it gets deleted
  471. pObj->OnUnload();
  472. // Remove the object
  473. m_vecObjs.FindAndRemove( pObj );
  474. IF_REPLAY_DBG( Warning( "Unloading object %s\n", pObj->GetDebugName() ) );
  475. // Free the object
  476. delete pObj;
  477. }
  478. // Clear the list
  479. m_lstObjsToUnload.RemoveAll();
  480. // Think once a second
  481. m_flNextUnloadTime = flHostTime + 1.0f;
  482. }
  483. template< class T >
  484. const char *CGenericPersistentManager< T >::GetIndexPath() const
  485. {
  486. return Replay_va( "%s%s", GetReplayContext()->GetBaseDir(), GetRelativeIndexPath() );
  487. }
  488. template< class T >
  489. const char *CGenericPersistentManager< T >::GetIndexFullFilename() const // Should return the full path to the main .dmx file
  490. {
  491. return Replay_va( "%s%s", GetIndexPath(), GetIndexFilename() );
  492. }
  493. template< class T >
  494. bool CGenericPersistentManager< T >::HaveDirtyObjects() const
  495. {
  496. return m_lstDirtyObjs.Count() > 0;
  497. }
  498. template< class T >
  499. bool CGenericPersistentManager< T >::HaveObjsToUnload() const
  500. {
  501. return m_lstObjsToUnload.Count() > 0;
  502. }
  503. template< class T >
  504. void CGenericPersistentManager< T >::CreateIndexDir()
  505. {
  506. g_pFullFileSystem->CreateDirHierarchy( GetIndexPath(), "DEFAULT_WRITE_PATH" );
  507. }
  508. template< class T >
  509. bool CGenericPersistentManager< T >::ReadObjFromFile( const char *pFile, T *&pOut, bool bForceLoad )
  510. {
  511. // Use the full path and filename specified, or construct it if necessary
  512. CUtlString strFullFilename;
  513. if ( ShouldSerializeIndexWithFullPath() )
  514. {
  515. strFullFilename = pFile;
  516. }
  517. else
  518. {
  519. strFullFilename.Format( "%s%s", GetIndexPath(), pFile );
  520. }
  521. // Attempt to load the file
  522. KeyValuesAD pObjData( pFile );
  523. if ( !pObjData->LoadFromFile( g_pFullFileSystem, strFullFilename.Get() ) )
  524. {
  525. Warning( "Failed to load from file %s\n", strFullFilename.Get() );
  526. AssertMsg( 0, "Manager failed to load something..." );
  527. return false;
  528. }
  529. // Create and read a new object
  530. pOut = ReadObjFromKeyValues( pObjData, bForceLoad );
  531. if ( !pOut )
  532. return NULL;
  533. // Add the object to the manager
  534. m_vecObjs.Insert( pOut );
  535. return true;
  536. }
  537. template< class T >
  538. bool CGenericPersistentManager< T >::ReadObjFromFile( const char *pFile )
  539. {
  540. T *pNewObj;
  541. if ( !ReadObjFromFile( pFile, pNewObj, false ) )
  542. return false;
  543. return true;
  544. }
  545. template< class T >
  546. T* CGenericPersistentManager< T >::ReadObjFromKeyValues( KeyValues *pObjData, bool bForceLoad )
  547. {
  548. T *pNewObj = Create(); Assert( pNewObj );
  549. if ( !pNewObj )
  550. return NULL;
  551. // Attempt to read data for the object, and fail to load this particular object if the reader
  552. // says we should.
  553. if ( !pNewObj->Read( pObjData ) )
  554. {
  555. delete pNewObj;
  556. return NULL;
  557. }
  558. // This object OK to load? Only check if bForceLoad is false.
  559. if ( !bForceLoad && !ShouldLoadObj( pNewObj ) )
  560. {
  561. delete pNewObj;
  562. return NULL;
  563. }
  564. // Sync up handle seed
  565. UpdateHandleSeed( pNewObj->GetHandle() );
  566. return pNewObj;
  567. }
  568. template< class T >
  569. void CGenericPersistentManager< T >::UpdateHandleSeed( ReplayHandle_t hNewHandle )
  570. {
  571. m_nHandleSeed = (ReplayHandle_t)( GetHandleBase() + MAX( (uint32)m_nHandleSeed, (uint32)hNewHandle ) + 1 );
  572. #ifdef _DEBUG
  573. FOR_EACH_VEC( m_vecObjs, i )
  574. {
  575. AssertMsg( m_nHandleSeed != m_vecObjs[ i ]->GetHandle(), "Handle seed collision!" );
  576. }
  577. #endif
  578. }
  579. //----------------------------------------------------------------------------------------
  580. #define FOR_EACH_OBJ( _manager, _i ) FOR_EACH_VEC( _manager->m_vecObjs, _i )
  581. //----------------------------------------------------------------------------------------
  582. #endif // GENERICPERSISTENTMANAGER_H