source: trunk/FACT++/src/DimServerList.h@ 20115

Last change on this file since 20115 was 13836, checked in by tbretz, 13 years ago
Added some workaround to make these classes not derive from DimInfoHandler - this clashes with the new StateMachineDim -- this must be fixed, it is still asnychronous with the event loop\!
File size: 2.5 KB
Line 
1#ifndef FACT_DimServerList
2#define FACT_DimServerList
3
4#include <vector>
5#include <string>
6
7#include "dic.hxx"
8
9class DimServerListImp;
10
11class DimServerList : public DimInfoHandler
12{
13public:
14 typedef std::vector<std::string> ServerList;
15
16private:
17 DimServerListImp *fList;
18 ServerList fServerList; /// A list with the available servers
19 DimInfo fDimServers; /// A DimInfo to retrieve the SERVER_LIST from teh DNS server
20
21protected:
22 void infoHandler();
23
24public:
25 DimServerList(DimServerListImp *list);
26
27 /// @returns a reference to the list of servers
28 const ServerList &GetServerList() const { return fServerList; }
29
30 /// @returns whether the given server is in the list or not
31 /// @param server string with the server which availability should be checked
32 bool HasServer(const std::string &server) const;
33};
34
35class DimServerListImp
36{
37 DimServerList fList;
38
39public:
40 DimServerListImp() : fList(this) { }
41 virtual ~DimServerListImp() { }
42
43 virtual void AddServer(const std::string &) { };
44 virtual void RemoveServer(std::string) { };
45 virtual void RemoveAllServers() { };
46
47 /// @returns a reference to the list of servers
48 const DimServerList::ServerList &GetServerList() const { return fList.GetServerList(); }
49
50 /// @returns whether the given server is in the list or not
51 /// @param server string with the server which availability should be checked
52 bool HasServer(const std::string &server) const { return fList.HasServer(server); }
53};
54
55#endif
56
57// ***************************************************************************
58/** @fn DimServerList::AddServer(const std::string &server)
59
60This virtual function is called as a callback whenever a new server appears
61to be available on the dns.
62
63The default is to do nothing.
64
65@param server
66 Server name of the server which was added
67
68**/
69// ***************************************************************************
70/** @fn DimServerList::RemoveServer(const std::string &server)
71
72This virtual function is called as a callback whenever a server disappears
73from the dns.
74
75The default is to do nothing.
76
77@param server
78 Server name of the server which was removed
79
80
81**/
82// ***************************************************************************
83/** @fn DimServerList::RemoveAllServers()
84
85This virtual function is called as a callback whenever a all servers
86disappear, e.g. the dns has vanished.
87
88The default is to do nothing.
89
90
91**/
92// ***************************************************************************
Note: See TracBrowser for help on using the repository browser.