MultiConnectorMixin.ct
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief MultiConnectorMixin non-inline template implementation */
16 
17 #include "MultiConnectorMixin.ih"
18 
19 // Custom includes
20 
21 #include <boost/lambda/lambda.hpp>
22 
23 #define prefix_
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 // senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,KeyType_,ContainerType_>
28 
29 template <class Self_, class ConnectorType_, class KeyType_, class ContainerType_>
30 prefix_ void
31 senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,KeyType_,ContainerType_>::
32 disconnected(ConnectorType_ const & c)
33 {
34  typename ContainerType::iterator i (
35  find_if(connectors_.begin(), connectors_.end(),
36  boost::bind(&ContainerType_::value_type::second,_1) == &c));
37  if (i != connectors_.end()) {
38  static_cast<Self_*>(this)->connectorDestroy(c);
39  connectors_.erase(i);
40  }
41 }
42 
43 //-/////////////////////////////////////////////////////////////////////////////////////////////////
44 // senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,void,ContainerType_>
45 
46 template <class Self_, class ConnectorType_, class ContainerType_>
47 prefix_ void
48 senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,void,ContainerType_>::
49 disconnected(ConnectorType_ const & c)
50 {
51  using boost::lambda::_1;
52 
53  typename ContainerType::iterator i (
54  find_if(connectors_.begin(), connectors_.end(), &_1 == &c));
55  if (i != connectors_.end()) {
56  static_cast<Self_*>(this)->connectorDestroy(c);
57  connectors_.erase(i);
58  }
59 }
60 
61 //-/////////////////////////////////////////////////////////////////////////////////////////////////
62 #undef prefix_
63 
64 
65 // Local Variables:
66 // mode: c++
67 // fill-column: 100
68 // comment-column: 40
69 // c-file-style: "senf"
70 // indent-tabs-mode: nil
71 // ispell-local-dictionary: "american"
72 // compile-command: "scons -u test"
73 // End: