]>
jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/File/FileWeaponDAO.h
1 #ifndef __GS__FILEWEAPONDAO_H__
2 #define __GS__FILEWEAPONDAO_H__
4 #include <GameServ/GameLayer/GameObjects/WeaponGO.h>
5 #include <GameServ/DataLayer/IWeaponDAO.h>
6 using GameServ::GameLayer::GameObjects::WeaponGO
;
7 using GameServ::DataLayer::DataAccessObjects::IWeaponDAO
;
9 #include <boost/shared_ptr.hpp>
10 using boost::shared_ptr
;
21 namespace GameServ
{ namespace DataLayer
{ namespace File
23 //! File implementation of IWeaponDAO interface
25 If you're using an File datasource, you will be using this
26 DAO to access Weapons.
28 class FileWeaponDAO
: public IWeaponDAO
31 // Ctors, Dtors ///////////////////////////////////////////////////////
33 FileWeaponDAO(const string
&filename
);
34 virtual ~FileWeaponDAO();
36 // Methods ////////////////////////////////////////////////////////////
37 virtual shared_ptr
<WeaponGO
> GetById(const string
&Id
) const;
39 virtual bool IdExists(const string
&Id
) const;
41 void LoadWeaponCache(void);
47 // Helper Methods /////////////////////////////////////////////////////
49 //! Creates the WeaponGO found at iterator position
50 shared_ptr
<WeaponGO
> CreateWeaponFromLine(const string
&line
) const;
52 //! Get the Weapon database file path
53 string
GetWeaponFilePath(void) const;
55 void Initialize(const string
&filename
);
58 map
<string
, shared_ptr
<WeaponGO
> > spWeaponCache
;
60 } } } // GameServ.DataLayer.DataAccessObjects.File
62 #endif // __GS__FileWeaponDAO_H__