]>
Commit | Line | Data |
---|---|---|
1 | #ifndef __GS__FILELEVELDAO_H__\r | |
2 | #define __GS__FILELEVELDAO_H__\r | |
3 | \r | |
4 | #include <GameServ/GameLayer/GameObjects/LevelGO.h>\r | |
5 | #include <GameServ/DataLayer/ILevelDAO.h>\r | |
6 | using GameServ::GameLayer::GameObjects::LevelGO;\r | |
7 | using GameServ::DataLayer::DataAccessObjects::ILevelDAO;\r | |
8 | \r | |
9 | #include <boost/smart_ptr/shared_ptr.hpp>\r | |
10 | \r | |
11 | \r | |
12 | #include <string>\r | |
13 | using std::string;\r | |
14 | \r | |
15 | #include <vector>\r | |
16 | using std::vector;\r | |
17 | \r | |
18 | #include <map>\r | |
19 | using std::map;\r | |
20 | \r | |
21 | namespace GameServ { namespace DataLayer { namespace File\r | |
22 | {\r | |
23 | //! File implementation of ILevelDAO interface\r | |
24 | /*!\r | |
25 | If you're using an File datasource, you will be using this\r | |
26 | DAO to access Levels.\r | |
27 | */\r | |
28 | class FileLevelDAO : public ILevelDAO\r | |
29 | {\r | |
30 | public:\r | |
31 | // Ctors, Dtors ///////////////////////////////////////////////////////\r | |
32 | FileLevelDAO(void);\r | |
33 | FileLevelDAO(const string &filename);\r | |
34 | virtual ~FileLevelDAO();\r | |
35 | \r | |
36 | // Methods ////////////////////////////////////////////////////////////\r | |
37 | virtual boost::shared_ptr<LevelGO> GetById(const string &Id) const;\r | |
38 | \r | |
39 | virtual bool IdExists(const string &Id) const;\r | |
40 | \r | |
41 | virtual void Insert(boost::shared_ptr<LevelGO> spLevel);\r | |
42 | virtual void Update(boost::shared_ptr<LevelGO> spLevel);\r | |
43 | \r | |
44 | void LoadLevelCache(void);\r | |
45 | \r | |
46 | private:\r | |
47 | //! Data file\r | |
48 | string mFilename;\r | |
49 | \r | |
50 | // Helper Methods /////////////////////////////////////////////////////\r | |
51 | \r | |
52 | //! Creates the LevelGO found at iterator position\r | |
53 | boost::shared_ptr<LevelGO> CreateLevelFromLine(const string &line) const;\r | |
54 | \r | |
55 | //! Get the Level database file path\r | |
56 | string GetLevelFilePath(void) const;\r | |
57 | \r | |
58 | void Initialize(const string &filename);\r | |
59 | \r | |
60 | map<string, boost::shared_ptr<LevelGO> > spLevelCache;\r | |
61 | };\r | |
62 | } } } // GameServ.DataLayer.DataAccessObjects.File\r | |
63 | \r | |
64 | #endif // __GS__FileLevelDAO_H__\r |