void PureClientContext::m_handleReleasingInterface(
     common::ClientInterfacePtr const &iface) {
     bool isEmpty = m_interfaces.removeInterface(iface);
     if (isEmpty) {
         m_removeCallbacksOnPath(iface->getPath());
     }
 }
 void PureClientContext::m_handleNewInterface(
     common::ClientInterfacePtr const &iface) {
     bool isNew = m_interfaces.addInterface(iface);
     if (isNew) {
         m_connectCallbacksOnPath(iface->getPath());
     }
 }
Beispiel #3
0
 bool
 InterfaceTree::removeInterface(common::ClientInterfacePtr const &iface) {
     auto &ifaces = getInterfacesForPath(iface->getPath());
     auto it = std::find(begin(ifaces), end(ifaces), iface);
     if (it != end(ifaces)) {
         ifaces.erase(it);
     }
     return ifaces.empty();
 }
Beispiel #4
0
    bool InterfaceTree::addInterface(common::ClientInterfacePtr const &iface) {
        auto &ifaces = getInterfacesForPath(iface->getPath());
        bool ret = ifaces.empty();

        // Makes sure we only have one copy of any interface pointer in the
        // vector
        auto it = std::find(begin(ifaces), end(ifaces), iface);
        if (it == end(ifaces)) {
            ifaces.push_back(iface);
        }
        return ret;
    }