Eris  1.3.23
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 
80  long getEntities() const
81  { return _entities; }
82 
83 protected:
84  friend class Meta;
85  friend class Connection;
86 
88  ServerInfo(const std::string &host);
89 
92  void processServer(const Atlas::Objects::Entity::RootEntity &svr);
93 
94  void setPing(int p);
95  void setStatus(Status s);
96 
97 private:
98  Status m_status;
99 
100  std::string _host;
101 
102  std::string _name,
103  _ruleset,
104  _server;
105 
106  int _clients;
107  int _ping;
108  long _entities;
109 
110  double _uptime;
111 
112  std::string m_version,
113  m_buildDate;
114 };
115 
116 } // of namespace Eris
117 
118 #endif
119 
const std::string & getBuildDate() const
the server program build-date, as a free text string
Definition: ServerInfo.h:62
int getPing() const
the round-trip time to the server.
Definition: ServerInfo.h:72
Information about a specific game server, retrieved via the Meta-server and anonymous GETs...
Definition: ServerInfo.h:21
const std::string & getServername() const
retrieve the human-readable name of the server (e.g &#39;Bob&#39;s Mason Server&#39;)
Definition: ServerInfo.h:46
long getEntities() const
the number of entities on the server
Definition: ServerInfo.h:80
const std::string & getVersion() const
the server program version, as a free text string
Definition: ServerInfo.h:58
Definition: Account.cpp:33
const std::string & getServer() const
the server program name, i.e &#39;stage&#39; or &#39;cyphesis&#39;
Definition: ServerInfo.h:54
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: Connection.h:37
server query timed out
Definition: ServerInfo.h:30
const std::string & getRuleset() const
retrieve a human-readable name of the ruleset (e.g. &#39;mason&#39; or &#39;circe&#39;)
Definition: ServerInfo.h:50
Status
Definition: ServerInfo.h:26
Meta encapsulates the meta-game system, including the meta-server protocol and queries.
Definition: Metaserver.h:35
double getUptime() const
the server&#39;s uptime in seconds
Definition: ServerInfo.h:76
const std::string & getHostname() const
retrive the hostname (or dotted-decimal IP) of the server.
Definition: ServerInfo.h:42
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
int getNumClients() const
the number of clients currently connected to the server
Definition: ServerInfo.h:66