home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 06 General Architectures / 06 Rabin / database.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-12-10  |  984 b   |  46 lines

  1. /* Copyright (C) Steve Rabin, 2001. 
  2.  * All rights reserved worldwide.
  3.  *
  4.  * This software is provided "as is" without express or implied
  5.  * warranties. You may freely copy and compile this source into
  6.  * applications you distribute provided that the copyright text
  7.  * below is included in the resulting source code, for example:
  8.  * "Portions Copyright (C) Steve Rabin, 2001"
  9.  */
  10.  
  11. #ifndef __DATABASE_H__
  12. #define __DATABASE_H__
  13.  
  14. #include <vector>
  15. #include "global.h"
  16. #include "singleton.h"
  17.  
  18. class GameObject;
  19.  
  20. typedef std::vector<GameObject*> dbContainer;
  21.  
  22.  
  23. class Database : public Singleton <Database>
  24. {
  25. public:
  26.  
  27.     Database( void );
  28.     ~Database( void );
  29.  
  30.     void Store( GameObject & object );
  31.     void Remove( objectID id );
  32.     GameObject* Find( objectID id );
  33.  
  34.     objectID GetNewObjectID( void );
  35.  
  36. private:
  37.  
  38.     objectID nextFreeID;
  39.  
  40.     //Make this a more efficient data structure (like a hash table)
  41.     dbContainer database;
  42.  
  43. };
  44.  
  45.  
  46. #endif    // __DATABASE_H__