]>
jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/File/FileMonsterDAO.h
75515bb44e5b0d6dedc3ffcb8dcb29b6b43a8750
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>
10 using boost::shared_ptr
;
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 shared_ptr
<MonsterGO
> GetById(const string
&Id
) const;
39 virtual vector
< shared_ptr
<MonsterGO
> > GetMonstersByLevelId(const string
&LevelId
) const;
41 virtual bool IdExists(const string
&Id
) const;
43 void LoadMonsterCache(void);
49 // Helper Methods /////////////////////////////////////////////////////
51 //! Creates the MonsterGO found at iterator position
52 shared_ptr
<MonsterGO
> CreateMonsterFromLine(const string
&line
) const;
54 //! Get the Monster database file path
55 string
GetMonsterFilePath(void) const;
57 void Initialize(const string
&filename
);
59 map
<string
, shared_ptr
<MonsterGO
> > spMonsterCache
;
61 } } } // GameServ.DataLayer.DataAccessObjects.File
63 #endif // __GS__FileMonsterDAO_H__