Changeset 13836 for trunk/FACT++/src
- Timestamp:
- 05/23/12 17:04:32 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/DimNetwork.cc
r11730 r13836 68 68 void DimNetwork::AddServer(const string &s) 69 69 { 70 DimServiceInfoList ::AddServer(s);70 DimServiceInfoListImp::AddServer(s); 71 71 if (s=="DIM_DNS") 72 72 return; … … 99 99 void DimNetwork::RemoveServer(string s) 100 100 { 101 DimServiceInfoList ::RemoveServer(s);101 DimServiceInfoListImp::RemoveServer(s); 102 102 if (s=="DIM_DNS") 103 103 return; … … 124 124 void DimNetwork::RemoveAllServers() 125 125 { 126 DimServiceInfoList ::RemoveAllServers();126 DimServiceInfoListImp::RemoveAllServers(); 127 127 DeleteClientList(); 128 128 } -
trunk/FACT++/src/DimNetwork.h
r11730 r13836 59 59 using namespace std; 60 60 61 class DimNetwork : public MessageImp, public DimErrorRedirecter, public DimServiceInfoList 61 class DimNetwork : public MessageImp, public DimErrorRedirecter, public DimServiceInfoListImp 62 62 { 63 63 private: -
trunk/FACT++/src/DimServerList.cc
r13674 r13836 34 34 using namespace std; 35 35 36 37 36 38 // -------------------------------------------------------------------------- 37 39 // … … 39 41 //! DIS_DNS/SERVER_LIST. 40 42 // 41 DimServerList::DimServerList( ) :43 DimServerList::DimServerList(DimServerListImp *list) : fList(list), 42 44 fDimServers("DIS_DNS/SERVER_LIST", const_cast<char*>(""), this) 43 45 { … … 61 63 if (str[0]!='-' && str[0]!='+') 62 64 { 63 RemoveAllServers();65 fList->RemoveAllServers(); 64 66 fServerList.clear(); 65 67 } … … 92 94 } 93 95 94 RemoveServer(trunc);96 fList->RemoveServer(trunc); 95 97 fServerList.erase(v); 96 98 … … 108 110 if (v!=fServerList.end()) 109 111 { 110 RemoveServer(trunc);112 fList->RemoveServer(trunc); 111 113 fServerList.erase(v); 112 114 … … 117 119 118 120 fServerList.push_back(trunc); 119 AddServer(trunc);121 fList->AddServer(trunc); 120 122 121 123 continue; … … 124 126 // In any other case we just add the entry to the list 125 127 fServerList.push_back(server); 126 AddServer(server);128 fList->AddServer(server); 127 129 } 128 130 } -
trunk/FACT++/src/DimServerList.h
r13827 r13836 7 7 #include "dic.hxx" 8 8 9 class DimServerListImp; 10 9 11 class DimServerList : public DimInfoHandler 10 12 { … … 13 15 14 16 private: 17 DimServerListImp *fList; 15 18 ServerList fServerList; /// A list with the available servers 16 19 DimInfo fDimServers; /// A DimInfo to retrieve the SERVER_LIST from teh DNS server 17 18 virtual void AddServer(const std::string &) { };19 virtual void RemoveServer(std::string) { };20 virtual void RemoveAllServers() { };21 20 22 21 protected: … … 24 23 25 24 public: 26 DimServerList( );25 DimServerList(DimServerListImp *list); 27 26 28 27 /// @returns a reference to the list of servers … … 32 31 /// @param server string with the server which availability should be checked 33 32 bool HasServer(const std::string &server) const; 33 }; 34 35 class DimServerListImp 36 { 37 DimServerList fList; 38 39 public: 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); } 34 53 }; 35 54 -
trunk/FACT++/src/DimServiceInfoList.cc
r13220 r13836 121 121 void DimServiceInfoList::RemoveServer(const string s) 122 122 { 123 RemoveAllServices(s);123 fList->RemoveAllServices(s); 124 124 125 125 const ServiceInfoList::iterator v = fServiceInfoList.find(s); … … 191 191 if (str[0]!='+' && str[0]!='-') 192 192 { 193 RemoveAllServices(server);193 fList->RemoveAllServices(server); 194 194 list.clear(); 195 195 } … … 239 239 }*/ 240 240 241 RemoveService(server, name, iscmd);241 fList->RemoveService(server, name, iscmd); 242 242 if (v!=list.end()) 243 243 list.erase(v); … … 259 259 260 260 list[name] = make_pair(fmt, iscmd); 261 AddService(server, name, fmt, iscmd);261 fList->AddService(server, name, fmt, iscmd); 262 262 263 263 continue; … … 266 266 // Add name the the list 267 267 list[name] = make_pair(fmt, iscmd); 268 AddService(server, name, fmt, iscmd);268 fList->AddService(server, name, fmt, iscmd); 269 269 } 270 270 … … 294 294 list[name] = make_pair(comment, vector<Description>(v.begin()+1, v.end())); 295 295 296 AddDescription(server, name, v);296 fList->AddDescription(server, name, v); 297 297 } 298 298 … … 304 304 vector<State> &vec = fServiceList[server].third; 305 305 vec = State::SplitStates(getInfo()->getString()); 306 AddStates(server, vec);306 fList->AddStates(server, vec); 307 307 308 308 return; 309 309 } 310 311 DimServerList::infoHandler();312 310 } 313 311 … … 755 753 SendDimCommand(server, str, dummy); 756 754 } 755 756 DimServiceInfoList::DimServiceInfoList(DimServiceInfoListImp *list) : DimServerList(list), fList(list) { } -
trunk/FACT++/src/DimServiceInfoList.h
r11730 r13836 11 11 12 12 class DimInfo; 13 class DimServiceInfoListImp; 13 14 14 15 class DimServiceInfoList : public DimServerList … … 38 39 39 40 private: 41 DimServiceInfoListImp *fList; 40 42 ServiceInfoList fServiceInfoList; /// A map storing the service description to retrieve all informations 41 43 ServiceList fServiceList; /// A mal containing all the available informations … … 46 48 DimInfo *CreateDS(const std::string &str) const { return CreateDimInfo(str, "STATE_LIST"); } 47 49 48 p rotected:50 public: 49 51 void AddServer(const std::string &s); 50 52 void RemoveServer(std::string); 51 53 void RemoveAllServers(); 52 54 55 protected: 56 void infoHandler(); 57 58 public: 59 DimServiceInfoList(DimServiceInfoListImp *list); 60 ~DimServiceInfoList() { } 61 62 std::vector<std::string> GetServiceList(bool iscmd=false) const; 63 std::vector<std::string> GetServiceList(const std::string &server, bool iscmd=false) const; 64 65 std::vector<Description> GetDescription(const std::string &server, const std::string &service) const; 66 std::vector<State> GetStates(const std::string &server) const; 67 State GetState(const std::string &server, int state) const; 68 69 int IsCommand(const std::string &server, const std::string &service) const; 70 71 int PrintDescription(std::ostream &out, bool iscmd, const std::string &serv="", const std::string &service="") const; 72 int PrintStates(std::ostream &out, const std::string &serv="") const; 73 74 bool SendDimCommand(std::ostream &lout, const std::string &server, const std::string &str) const; 75 void SendDimCommand(const std::string &server, std::string str, std::ostream &lout) const; 76 void SendDimCommand(const std::string &server, const std::string &str) const; 77 }; 78 79 class DimServiceInfoListImp : public DimServerListImp 80 { 81 public: 82 DimServiceInfoList fInfo; 83 84 protected: 85 virtual void AddServer(const std::string &s) { fInfo.AddServer(s); } 86 virtual void RemoveServer(std::string s) { fInfo.RemoveServer(s); } 87 virtual void RemoveAllServers() { fInfo.RemoveAllServers(); } 88 89 public: 53 90 virtual void AddService(const std::string &, const std::string &, const std::string &, bool) { } 54 91 virtual void RemoveService(std::string, std::string, bool) { } … … 57 94 virtual void AddStates(const std::string &, const std::vector<State> &) { } 58 95 59 protected: 60 void infoHandler(); 61 62 public: 63 DimServiceInfoList() { } 64 ~DimServiceInfoList() { RemoveAllServers(); } 65 66 std::vector<std::string> GetServiceList(bool iscmd=false) const; 67 std::vector<std::string> GetServiceList(const std::string &server, bool iscmd=false) const; 96 public: 97 DimServiceInfoListImp() : fInfo(this) { } 98 ~DimServiceInfoListImp() { fInfo.RemoveAllServers(); } 99 100 std::vector<std::string> GetServiceList(bool iscmd=false) const 101 { return fInfo.GetServiceList(iscmd); } 102 std::vector<std::string> GetServiceList(const std::string &server, bool iscmd=false) const 103 { return fInfo.GetServiceList(server, iscmd); } 68 104 69 105 std::vector<std::string> GetCommandList() const { return GetServiceList(true); } 70 106 std::vector<std::string> GetCommandList(const std::string &server) const { return GetServiceList(server, true); } 71 107 72 std::vector<Description> GetDescription(const std::string &server, const std::string &service) const; 73 std::vector<State> GetStates(const std::string &server) const; 74 State GetState(const std::string &server, int state) const; 75 76 int IsCommand(const std::string &server, const std::string &service) const; 77 78 int PrintDescription(std::ostream &out, bool iscmd, const std::string &serv="", const std::string &service="") const; 79 int PrintStates(std::ostream &out, const std::string &serv="") const; 80 81 bool SendDimCommand(std::ostream &lout, const std::string &server, const std::string &str) const; 82 void SendDimCommand(const std::string &server, std::string str, std::ostream &lout) const; 83 void SendDimCommand(const std::string &server, const std::string &str) const; 108 std::vector<Description> GetDescription(const std::string &server, const std::string &service) const 109 { return fInfo.GetDescription(server, service); } 110 std::vector<State> GetStates(const std::string &server) const 111 { return fInfo.GetStates(server); } 112 State GetState(const std::string &server, int state) const 113 { return fInfo.GetState(server, state); } 114 115 int IsCommand(const std::string &server, const std::string &service) const 116 { return fInfo.IsCommand(server, service); } 117 118 int PrintDescription(std::ostream &out, bool iscmd, const std::string &serv="", const std::string &service="") const 119 { return fInfo.PrintDescription(out, iscmd, serv, service); } 120 int PrintStates(std::ostream &out, const std::string &serv="") const 121 { return fInfo.PrintStates(out, serv); } 122 123 bool SendDimCommand(std::ostream &lout, const std::string &server, const std::string &str) const 124 { return fInfo.SendDimCommand(lout, server, str); } 125 void SendDimCommand(const std::string &server, std::string str, std::ostream &lout) const 126 { return fInfo.SendDimCommand(server, str, lout); } 127 void SendDimCommand(const std::string &server, const std::string &str) const 128 { return fInfo.SendDimCommand(server, str); } 84 129 }; 130 131 85 132 86 133 // ***************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.