]> jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/IPlayerDAO.h
Finished some work on FilePlayerDAO
[irc/gameservirc.git] / gameserv-2.0 / libgameservgldl / include / GameServ / DataLayer / IPlayerDAO.h
1 #ifndef __GS__IPlayerDAO_H__
2 #define __GS__IPlayerDAO_H__
3
4 #include <GameServ/GameLayer/GameObjects/PlayerGO.h>
5 using GameServ::GameLayer::GameObjects::PlayerGO;
6
7 #include <boost/shared_ptr.hpp>
8 using boost::shared_ptr;
9
10 #include <vector>
11 using std::vector;
12 #include <list>
13 using std::list;
14 #include <string>
15 using std::string;
16
17 namespace GameServ { namespace DataLayer { namespace DataAccessObjects
18 {
19 //! Interface for Player Data Access Objects
20 /*!
21 This is the interface for all Player DAOs. Each specific datasource
22 will need to inherit this common interface.
23 */
24 class IPlayerDAO
25 {
26 public:
27 // Ctors, Dtors ///////////////////////////////////////////////////////
28 IPlayerDAO(void);
29 virtual ~IPlayerDAO(void); // Needs to be virtual
30
31 //! Get the Player using a unique data/object Id
32 /*!
33 \param Id Unique identifier
34 \return A boost shared pointer to a Player game object if found
35 otherwise the list is empty.
36 */
37 virtual shared_ptr<PlayerGO> GetById(const string &Id) const = 0;
38
39 /*! Get a list of Player Ids by Name
40 \param Name The partial name of the Player to match against the beginning of a Player name
41 \return A collection of Player Ids matching the name
42 */
43 virtual list<string> GetIdsByName(const string &Name) const = 0;
44
45 //! Function to quickly search to see if an Id exists or not
46 /*!
47 \param Id The Id of the game object to search for
48 \return true if the Id is valid and exists in the data, false otherwise
49 */
50 virtual bool IdExists(const string &Id) const = 0;
51
52 virtual void Insert(shared_ptr<PlayerGO> spPlayer) = 0;
53 virtual void Update(shared_ptr<PlayerGO> spPlayer) = 0;
54 private:
55
56
57 };
58 } } }
59 #endif // __GS__IPlayerDAO_H__