Eris  1.4.0
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 #include <vector>
8 
9 namespace Eris {
10 
11 class Meta;
12 
23 {
24 public:
25  ServerInfo();
26 
27  typedef enum {
28  INVALID,
29  QUERYING,
30  VALID,
32  } Status;
33 
34  // bookmark / favourites functionality
35 
36 // accessors
37  Status getStatus() const
38  { return m_status; }
39 
43  const std::string& getHostname() const
44  { return _host; }
45 
47  const std::string& getServername() const
48  { return _name; }
49 
51  const std::string& getRuleset() const
52  { return _ruleset; }
53 
55  const std::string& getServer() const
56  { return _server; }
57 
59  const std::string& getVersion() const
60  { return m_version; }
61 
63  const std::string& getBuildDate() const
64  { return m_buildDate; }
65 
67  int getNumClients() const
68  { return _clients; }
69 
73  int getPing() const
74  { return _ping; }
75 
77  double getUptime() const
78  { return _uptime; }
79 
81  long getEntities() const
82  { return _entities; }
83 
84  const std::vector<std::string>& getAssets() const {
85  return m_assets;
86  }
87 
88 protected:
89  friend class Meta;
90  friend class Connection;
91 
93  explicit ServerInfo(const std::string &host);
94 
97  void processServer(const Atlas::Objects::Entity::RootEntity &svr);
98 
99  void setPing(int p);
100  void setStatus(Status s);
101 
102 private:
103  Status m_status;
104 
105  std::string _host;
106 
107  std::string _name,
108  _ruleset,
109  _server;
110 
111  int _clients;
112  int _ping;
113  long _entities;
114 
115  double _uptime;
116 
117  std::string m_version;
118  std::string m_buildDate;
119 
123  std::vector<std::string> m_assets;
124 };
125 
126 } // of namespace Eris
127 
128 #endif
129 
const std::string & getBuildDate() const
the server program build-date, as a free text string
Definition: ServerInfo.h:63
int getPing() const
the round-trip time to the server.
Definition: ServerInfo.h:73
Information about a specific game server, retrieved via the Meta-server and anonymous GETs...
Definition: ServerInfo.h:22
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:47
long getEntities() const
the number of entities on the server
Definition: ServerInfo.h:81
const std::string & getVersion() const
the server program version, as a free text string
Definition: ServerInfo.h:59
Every Eris class and type lives inside the Eris namespace; certain utility functions live in the Util...
Definition: Account.cpp:34
const std::string & getServer() const
the server program name, i.e &#39;stage&#39; or &#39;cyphesis&#39;
Definition: ServerInfo.h:55
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: Connection.h:36
server query timed out
Definition: ServerInfo.h:31
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:51
Status
Definition: ServerInfo.h:27
Meta encapsulates the meta-game system, including the meta-server protocol and queries.
Definition: Metaserver.h:36
double getUptime() const
the server&#39;s uptime in seconds
Definition: ServerInfo.h:77
const std::string & getHostname() const
retrive the hostname (or dotted-decimal IP) of the server.
Definition: ServerInfo.h:43
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:67