]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/File/FileMasterDAO.h
Consolidated all the individual level files into a single levels.dat file.
[irc/gameservirc.git] / gameserv-2.0 / libgameservgldl / include / GameServ / DataLayer / File / FileMasterDAO.h
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1b33b68eb760c520f2867691f8da5cf3db9e2cad 100644 (file)
@@ -0,0 +1,61 @@
+#ifndef __GS__FILEMASTERDAO_H__\r
+#define __GS__FILEMASTERDAO_H__\r
+\r
+#include <GameServ/GameLayer/GameObjects/MasterGO.h>\r
+#include <GameServ/DataLayer/IMasterDAO.h>\r
+using GameServ::GameLayer::GameObjects::MasterGO;\r
+using GameServ::DataLayer::DataAccessObjects::IMasterDAO;\r
+\r
+#include <boost/smart_ptr/shared_ptr.hpp>\r
+using boost::shared_ptr;\r
+\r
+#include <string>\r
+using std::string;\r
+\r
+#include <vector>\r
+using std::vector;\r
+\r
+#include <map>\r
+using std::map;\r
+\r
+namespace GameServ {  namespace DataLayer { namespace File\r
+{\r
+       //! File implementation of IMasterDAO interface\r
+       /*!\r
+               If you're using an File datasource, you will be using this\r
+               DAO to access Masters.\r
+       */\r
+       class FileMasterDAO : public IMasterDAO\r
+       {\r
+       public:\r
+               // Ctors, Dtors ///////////////////////////////////////////////////////\r
+               FileMasterDAO(void);\r
+               FileMasterDAO(const string &filename);\r
+               virtual ~FileMasterDAO();\r
+\r
+               // Methods ////////////////////////////////////////////////////////////\r
+               virtual shared_ptr<MasterGO> GetById(const string &Id) const;\r
+\r
+               virtual bool IdExists(const string &Id) const;\r
+\r
+               void LoadMasterCache(void);\r
+\r
+       private:\r
+               //! Data file\r
+               string mFilename;\r
+\r
+               // Helper Methods /////////////////////////////////////////////////////\r
+\r
+               //! Creates the MasterGO found at iterator position\r
+               shared_ptr<MasterGO> CreateMasterFromLine(const string &line) const;\r
+\r
+               //! Get the Master database file path\r
+               string GetMasterFilePath(void) const;\r
+\r
+               void Initialize(const string &filename);\r
+\r
+               map<string, shared_ptr<MasterGO> > spMasterCache;\r
+       };\r
+} } } // GameServ.DataLayer.DataAccessObjects.File\r
+\r
+#endif // __GS__FileMasterDAO_H__\r