Changeset 11730 for trunk/FACT++


Ignore:
Timestamp:
07/31/11 12:02:11 (13 years ago)
Author:
tbretz
Message:
When removing something from a list we have to pass a copy instead of a reference otherwise the removal might remove the source of the reference.
Location:
trunk/FACT++/src
Files:
6 edited

Legend:

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

    r11150 r11730  
    9797//!     a runtime_error is the server to be removed is not in the list
    9898//
    99 void DimNetwork::RemoveServer(const string &s)
     99void DimNetwork::RemoveServer(string s)
    100100{
    101101    DimServiceInfoList::RemoveServer(s);
  • trunk/FACT++/src/DimNetwork.h

    r10481 r11730  
    7070
    7171    void AddServer(const std::string &s);
    72     void RemoveServer(const std::string &s);
     72    void RemoveServer(std::string s);
    7373    void RemoveAllServers();
    7474
  • trunk/FACT++/src/DimServerList.cc

    r10972 r11730  
    1313
    1414- virtual void AddServer(const std::string &)
    15 - virtual void RemoveServer(const std::string &)
     15- virtual void RemoveServer(const std::string)
    1616- virtual void RemoveAllServers()
    1717
  • trunk/FACT++/src/DimServerList.h

    r10427 r11730  
    1717
    1818    virtual void AddServer(const std::string &) { };
    19     virtual void RemoveServer(const std::string &) { };
     19    virtual void RemoveServer(std::string) { };
    2020    virtual void RemoveAllServers() { };
    2121
  • trunk/FACT++/src/DimServiceInfoList.cc

    r11713 r11730  
    113113//!
    114114//! @param s
    115 //!     server which should be removed
     115//!     server which should be removed. We need to make a copy, otherwise
     116//!     RemoveServer will destroy the staring the reference is pointing to
    116117//!
    117118//! @throws
    118119//!     a runtime_error is the server to be removed is not in the list
    119120//
    120 void DimServiceInfoList::RemoveServer(const string &s)
     121void DimServiceInfoList::RemoveServer(const string s)
    121122{
    122123    const ServiceInfoList::iterator v = fServiceInfoList.find(s);
     
    149150{
    150151    while (fServiceInfoList.size()>0)
    151     {
    152         // We need to make a copy, otherwise RemoveServer will
    153         // destroy the staring the reference is pointing to
    154         const string name = fServiceInfoList.begin()->first;
    155         RemoveServer(name);
    156     }
     152        RemoveServer(fServiceInfoList.begin()->first);
    157153}
    158154
  • trunk/FACT++/src/DimServiceInfoList.h

    r11274 r11730  
    4848protected:
    4949    void AddServer(const std::string &s);
    50     void RemoveServer(const std::string &s);
     50    void RemoveServer(std::string);
    5151    void RemoveAllServers();
    5252
    5353    virtual void AddService(const std::string &, const std::string &, const std::string &, bool) { }
    54     virtual void RemoveService(const std::string &, const std::string &, bool) { }
     54    virtual void RemoveService(std::string, std::string, bool) { }
    5555    virtual void RemoveAllServices(const std::string &) { }
    5656    virtual void AddDescription(const std::string &, const std::string &, const std::vector<Description> &) { }
Note: See TracChangeset for help on using the changeset viewer.