]>
jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/File/FileLevelDAO.h
47be872dd7a2a686d0dac3fc3971fab2715e77b5
1 #ifndef __GS__FILELEVELDAO_H__
2 #define __GS__FILELEVELDAO_H__
4 #include <GameServ/GameLayer/GameObjects/LevelGO.h>
5 #include <GameServ/DataLayer/ILevelDAO.h>
6 using GameServ::GameLayer::GameObjects::LevelGO
;
7 using GameServ::DataLayer::DataAccessObjects::ILevelDAO
;
9 #include <boost/smart_ptr/shared_ptr.hpp>
10 using boost::shared_ptr
;
21 namespace GameServ
{ namespace DataLayer
{ namespace File
23 //! File implementation of ILevelDAO interface
25 If you're using an File datasource, you will be using this
28 class FileLevelDAO
: public ILevelDAO
31 // Ctors, Dtors ///////////////////////////////////////////////////////
33 FileLevelDAO(const string
&filename
);
34 virtual ~FileLevelDAO();
36 // Methods ////////////////////////////////////////////////////////////
37 virtual shared_ptr
<LevelGO
> GetById(const string
&Id
) const;
39 virtual bool IdExists(const string
&Id
) const;
41 virtual void Insert(shared_ptr
<LevelGO
> spLevel
);
42 virtual void Update(shared_ptr
<LevelGO
> spLevel
);
44 void LoadLevelCache(void);
50 // Helper Methods /////////////////////////////////////////////////////
52 //! Creates the LevelGO found at iterator position
53 shared_ptr
<LevelGO
> CreateLevelFromLine(const string
&line
) const;
55 //! Get the Level database file path
56 string
GetLevelFilePath(void) const;
58 void Initialize(const string
&filename
);
60 map
<string
, shared_ptr
<LevelGO
> > spLevelCache
;
62 } } } // GameServ.DataLayer.DataAccessObjects.File
64 #endif // __GS__FileLevelDAO_H__