simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
ServerClientMgr.h
1 /*
2  * TSServerClientMgr.h
3  *
4  * Created on: Jul 31, 2014
5  * Author: Silvestro di Luise
6  * Silvestro.Di.Luise@cern.ch
7  *
8  *
9  *
10  *
11  *
12  */
13 
14 #ifndef TSSERVERCLIENTMGR_H_
15 #define TSSERVERCLIENTMGR_H_
16 
17 #include <map>
18 
19 #include <TString.h>
20 
21 
23 
24 public:
25 
26  ServerClientMgr(TString owner_name);//,TSServerClientMgr& owner);
28  virtual ~ServerClientMgr();
29 
30  void AddClient(ServerClientMgr *);
31  void AddServer(ServerClientMgr *);
32 
33  bool AnyClientChanged() {return fAnyClientChanged;}
34  bool AnyServerChanged() {return fAnyServerChanged;}
35 
36  bool BroadcastActive() {return kBroadcastIsActive;}
37  void BroadcastToClients(int);
38  void BroadcastToServers(int);
39 
40  ServerClientMgr* GetClient(int) const;
41  int GetClientStatus(int) const;
42  ServerClientMgr* GetServer(int) const;
43  int GetServerStatus(int) const;
44  int GetNumOfClients() const {return fNumOfClients;}
45  int GetNumOfServers() const {return fNumOfServers;}
46  int GetNumOfClientsChanged() const {return fNumOfClientsChanged;}
47  int GetNumOfServersChanged() const {return fNumOfServersChanged;}
48 
49  TString GetOwnerName() const {return fOwnerName;}
50  TString GetStatusName(int) const;
51 
52  void PrintServersAndClients();
53  void RemoveClient(ServerClientMgr*);
54  void RemoveServer(ServerClientMgr*);
55  void ResetAll();
56  void SetClientStatus(ServerClientMgr *, int);
57  void SetServerStatus(ServerClientMgr *, int);
58 
59  bool ServerChanged(ServerClientMgr *);
60  bool ServerRemoved(ServerClientMgr *);
61 
62  int kChanged;
63  int kUnChanged;
64  int kRemoved;
65 
66  static bool kBroadcastIsActive;
67  static bool kDebug;
68 
69 private:
70 
71  TString fOwnerName;
72 
73  ServerClientMgr *fOwner;
74 
75  bool fAnyClientChanged;
76  bool fAnyServerChanged;
77  int fNumOfClientsChanged;
78  int fNumOfServersChanged;
79 
80  int fNumOfClients;
81  int fNumOfServers;
82  std::map<int,ServerClientMgr*> fServers;
83  std::map<int,ServerClientMgr*> fClients;
84  std::map<int,int> fClientsStatus;
85  std::map<int,int> fServersStatus;
86 
87  void fResetCounters();
88 };
89 
90 #endif /* TSSERVERCLIENTMGR_H_ */
Definition: ServerClientMgr.h:22