]> git.donarmstrong.com Git - bamtools.git/blob - src/api/internal/io/HostInfo_p.h
5660a38e92ee8a7ccc1fa1e4763bbab7edf2329f
[bamtools.git] / src / api / internal / io / HostInfo_p.h
1 #ifndef HOSTINFO_P_H
2 #define HOSTINFO_P_H
3
4 #include "api/internal/io/HostAddress_p.h"
5 #include <string>
6 #include <vector>
7
8 namespace BamTools {
9 namespace Internal {
10
11 class HostInfo {
12
13     public:
14         enum ErrorType { NoError = 0
15                        , HostNotFound
16                        , UnknownError
17                        };
18
19     // ctors & dtor
20     public:
21         HostInfo(void);
22         HostInfo(const HostInfo& other);
23         ~HostInfo(void);
24
25     // HostInfo interface
26     public:
27         std::string HostName(void) const;
28         void SetHostName(const std::string& name);
29
30         std::vector<HostAddress> Addresses(void) const;
31         void SetAddresses(const std::vector<HostAddress>& addresses);
32
33         HostInfo::ErrorType GetError(void) const;
34         std::string GetErrorString(void) const;
35
36     // internal methods
37     private:
38         void SetError(const HostInfo::ErrorType error);
39         void SetErrorString(const std::string& errorString);
40
41     // static methods
42     public:
43         static HostInfo Lookup(const std::string& hostname,
44                                const std::string& port);
45
46     // data members
47     private:
48         std::string m_hostName;
49         std::vector<HostAddress> m_addresses;
50         HostInfo::ErrorType m_error;
51         std::string m_errorString;
52 };
53
54 } // namespace Internal
55 } // namespace BamTools
56
57 #endif // HOSTINFO_P_H