Changeset 13836 for trunk/FACT++


Ignore:
Timestamp:
05/23/12 17:04:32 (12 years ago)
Author:
tbretz
Message:
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\!
Location:
trunk/FACT++/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/DimNetwork.cc

    r11730 r13836  
    6868void DimNetwork::AddServer(const string &s)
    6969{
    70     DimServiceInfoList::AddServer(s);
     70    DimServiceInfoListImp::AddServer(s);
    7171    if (s=="DIM_DNS")
    7272        return;
     
    9999void DimNetwork::RemoveServer(string s)
    100100{
    101     DimServiceInfoList::RemoveServer(s);
     101    DimServiceInfoListImp::RemoveServer(s);
    102102    if (s=="DIM_DNS")
    103103        return;
     
    124124void DimNetwork::RemoveAllServers()
    125125{
    126     DimServiceInfoList::RemoveAllServers();
     126    DimServiceInfoListImp::RemoveAllServers();
    127127    DeleteClientList();
    128128}
  • trunk/FACT++/src/DimNetwork.h

    r11730 r13836  
    5959using namespace std;
    6060
    61 class DimNetwork : public MessageImp, public DimErrorRedirecter, public DimServiceInfoList
     61class DimNetwork : public MessageImp, public DimErrorRedirecter, public DimServiceInfoListImp
    6262{
    6363private:
  • trunk/FACT++/src/DimServerList.cc

    r13674 r13836  
    3434using namespace std;
    3535
     36
     37
    3638// --------------------------------------------------------------------------
    3739//
     
    3941//! DIS_DNS/SERVER_LIST.
    4042//
    41 DimServerList::DimServerList() :
     43DimServerList::DimServerList(DimServerListImp *list) : fList(list),
    4244    fDimServers("DIS_DNS/SERVER_LIST", const_cast<char*>(""), this)
    4345{
     
    6163    if (str[0]!='-' && str[0]!='+')
    6264    {
    63         RemoveAllServers();
     65        fList->RemoveAllServers();
    6466        fServerList.clear();
    6567    }
     
    9294            }
    9395
    94             RemoveServer(trunc);
     96            fList->RemoveServer(trunc);
    9597            fServerList.erase(v);
    9698
     
    108110            if (v!=fServerList.end())
    109111            {
    110                 RemoveServer(trunc);
     112                fList->RemoveServer(trunc);
    111113                fServerList.erase(v);
    112114
     
    117119
    118120            fServerList.push_back(trunc);
    119             AddServer(trunc);
     121            fList->AddServer(trunc);
    120122
    121123            continue;
     
    124126        // In any other case we just add the entry to the list
    125127        fServerList.push_back(server);
    126         AddServer(server);
     128        fList->AddServer(server);
    127129    }
    128130}
  • trunk/FACT++/src/DimServerList.h

    r13827 r13836  
    77#include "dic.hxx"
    88
     9class DimServerListImp;
     10
    911class DimServerList : public DimInfoHandler
    1012{
     
    1315
    1416private:
     17    DimServerListImp *fList;
    1518    ServerList fServerList;  /// A list with the available servers
    1619    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() { };
    2120
    2221protected:
     
    2423
    2524public:
    26     DimServerList();
     25    DimServerList(DimServerListImp *list);
    2726
    2827    /// @returns a reference to the list of servers
     
    3231    /// @param server string with the server which availability should be checked
    3332    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); }
    3453};
    3554
  • trunk/FACT++/src/DimServiceInfoList.cc

    r13220 r13836  
    121121void DimServiceInfoList::RemoveServer(const string s)
    122122{
    123     RemoveAllServices(s);
     123    fList->RemoveAllServices(s);
    124124
    125125    const ServiceInfoList::iterator v = fServiceInfoList.find(s);
     
    191191        if (str[0]!='+' && str[0]!='-')
    192192        {
    193             RemoveAllServices(server);
     193            fList->RemoveAllServices(server);
    194194            list.clear();
    195195        }
     
    239239                }*/
    240240
    241                 RemoveService(server, name, iscmd);
     241                fList->RemoveService(server, name, iscmd);
    242242                if (v!=list.end())
    243243                    list.erase(v);
     
    259259
    260260                list[name] = make_pair(fmt, iscmd);
    261                 AddService(server, name, fmt, iscmd);
     261                fList->AddService(server, name, fmt, iscmd);
    262262
    263263                continue;
     
    266266            // Add name the the list
    267267            list[name] = make_pair(fmt, iscmd);
    268             AddService(server, name, fmt, iscmd);
     268            fList->AddService(server, name, fmt, iscmd);
    269269        }
    270270
     
    294294            list[name] = make_pair(comment, vector<Description>(v.begin()+1, v.end()));
    295295
    296             AddDescription(server, name, v);
     296            fList->AddDescription(server, name, v);
    297297        }
    298298
     
    304304        vector<State> &vec = fServiceList[server].third;
    305305        vec = State::SplitStates(getInfo()->getString());
    306         AddStates(server, vec);
     306        fList->AddStates(server, vec);
    307307
    308308        return;
    309309    }
    310 
    311     DimServerList::infoHandler();
    312310}
    313311
     
    755753    SendDimCommand(server, str, dummy);
    756754}
     755
     756DimServiceInfoList::DimServiceInfoList(DimServiceInfoListImp *list) : DimServerList(list), fList(list) { }
  • trunk/FACT++/src/DimServiceInfoList.h

    r11730 r13836  
    1111
    1212class DimInfo;
     13class DimServiceInfoListImp;
    1314
    1415class DimServiceInfoList : public DimServerList
     
    3839
    3940private:
     41    DimServiceInfoListImp *fList;
    4042    ServiceInfoList fServiceInfoList; /// A map storing the service description to retrieve all informations
    4143    ServiceList     fServiceList;     /// A mal containing all the available informations
     
    4648    DimInfo *CreateDS(const std::string &str) const { return CreateDimInfo(str, "STATE_LIST"); }
    4749
    48 protected:
     50public:
    4951    void AddServer(const std::string &s);
    5052    void RemoveServer(std::string);
    5153    void RemoveAllServers();
    5254
     55protected:
     56    void infoHandler();
     57
     58public:
     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
     79class DimServiceInfoListImp : public DimServerListImp
     80{
     81public:
     82    DimServiceInfoList fInfo;
     83
     84protected:
     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
     89public:
    5390    virtual void AddService(const std::string &, const std::string &, const std::string &, bool) { }
    5491    virtual void RemoveService(std::string, std::string, bool) { }
     
    5794    virtual void AddStates(const std::string &, const std::vector<State> &) { }
    5895
    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;
     96public:
     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); }
    68104
    69105    std::vector<std::string> GetCommandList() const { return GetServiceList(true); }
    70106    std::vector<std::string> GetCommandList(const std::string &server) const { return GetServiceList(server, true); }
    71107
    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); }
    84129};
     130
     131
    85132
    86133// ***************************************************************************
Note: See TracChangeset for help on using the changeset viewer.