]>
jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/File/FileMonsterDAO.h
1 #ifndef __GS__FILEMONSTERDAO_H__
2 #define __GS__FILEMONSTERDAO_H__
4 #include <GameServ/GameLayer/GameObjects/MonsterGO.h>
5 #include <GameServ/DataLayer/IMonsterDAO.h>
6 using GameServ::GameLayer::GameObjects::MonsterGO
;
7 using GameServ::DataLayer::DataAccessObjects::IMonsterDAO
;
9 #include <boost/smart_ptr/shared_ptr.hpp>
21 namespace GameServ
{ namespace DataLayer
{ namespace File
23 //! File implementation of IMonsterDAO interface
25 If you're using an File datasource, you will be using this
26 DAO to access Monsters.
28 class FileMonsterDAO
: public IMonsterDAO
31 // Ctors, Dtors ///////////////////////////////////////////////////////
33 FileMonsterDAO(const string
&filename
);
34 virtual ~FileMonsterDAO();
36 // Methods ////////////////////////////////////////////////////////////
37 virtual boost::shared_ptr
<MonsterGO
> GetById(const string
&Id
) const;
39 virtual vector
<string
> GetMonsterIdsByLevelId(const string
&LevelId
) const;
41 virtual bool IdExists(const string
&Id
) const;
43 void LoadMonsterCache(void);
46 void Update(boost::shared_ptr
<MonsterGO
> spMonster
);
47 void Insert(boost::shared_ptr
<MonsterGO
> spMonster
);
53 // Helper Methods /////////////////////////////////////////////////////
55 //! Creates the MonsterGO found at iterator position
56 boost::shared_ptr
<MonsterGO
> CreateMonsterFromLine(const string
&line
) const;
58 //! Get the Monster database file path
59 string
GetMonsterFilePath(void) const;
61 void Initialize(const string
&filename
);
63 map
<string
, boost::shared_ptr
<MonsterGO
> > spMonsterCache
;
65 } } } // GameServ.DataLayer.DataAccessObjects.File
67 #endif // __GS__FileMonsterDAO_H__