Eris  1.3.19
ServerInfo.h
1 #ifndef ERIS_SERVER_INFO_H
2 #define ERIS_SERVER_INFO_H
3 
4 #include <Atlas/Objects/ObjectsFwd.h>
5 
6 #include <string>
7 
8 namespace Eris {
9 
10 class Meta;
11 
22 {
23 public:
24  ServerInfo();
25 
26  typedef enum {
27  INVALID,
28  QUERYING,
29  VALID,
31  } Status;
32 
33  // bookmark / favourites functionality
34 
35 // accessors
36  Status getStatus() const
37  { return m_status; }
38 
42  const std::string& getHostname() const
43  { return _host; }
44 
46  const std::string& getServername() const
47  { return _name; }
48 
50  const std::string& getRuleset() const
51  { return _ruleset; }
52 
54  const std::string& getServer() const
55  { return _server; }
56 
58  const std::string& getVersion() const
59  { return m_version; }
60 
62  const std::string& getBuildDate() const
63  { return m_buildDate; }
64 
66  int getNumClients() const
67  { return _clients; }
68 
72  int getPing() const
73  { return _ping; }
74 
76  double getUptime() const
77  { return _uptime; }
78 
79 protected:
80  friend class Meta;
81  friend class Connection;
82 
84  ServerInfo(const std::string &host);
85 
88  void processServer(const Atlas::Objects::Entity::RootEntity &svr);
89 
90  void setPing(int p);
91  void setStatus(Status s);
92 
93 private:
94  Status m_status;
95 
96  std::string _host;
97 
98  std::string _name,
99  _ruleset,
100  _server;
101 
102  int _clients;
103  int _ping;
104 
105  double _uptime;
106 
107  std::string m_version,
108  m_buildDate;
109 };
110 
111 } // of namespace Eris
112 
113 #endif
114 
Information about a specific game server, retrieved via the Meta-server and anonymous GETs...
Definition: ServerInfo.h:21
int getNumClients() const
the number of clients currently connected to the server
Definition: ServerInfo.h:66
double getUptime() const
the server's uptime in seconds
Definition: ServerInfo.h:76
const std::string & getServername() const
retrieve the human-readable name of the server (e.g 'Bob's Mason Server')
Definition: ServerInfo.h:46
const std::string & getServer() const
the server program name, i.e 'stage' or 'cyphesis'
Definition: ServerInfo.h:54
const std::string & getRuleset() const
retrieve a human-readable name of the ruleset (e.g. 'mason' or 'circe')
Definition: ServerInfo.h:50
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: Connection.h:37
int getPing() const
the round-trip time to the server.
Definition: ServerInfo.h:72
server query timed out
Definition: ServerInfo.h:30
Status
Definition: ServerInfo.h:26
const std::string & getHostname() const
retrive the hostname (or dotted-decimal IP) of the server.
Definition: ServerInfo.h:42
Meta encapsulates the meta-game system, including the meta-server protocol and queries.
Definition: Metaserver.h:64
const std::string & getVersion() const
the server program version, as a free text string
Definition: ServerInfo.h:58
const std::string & getBuildDate() const
the server program build-date, as a free text string
Definition: ServerInfo.h:62
void processServer(const Atlas::Objects::Entity::RootEntity &svr)
called by Meta when info is received from the server, sets status to valid.
Definition: ServerInfo.cpp:40