// $Id$
//
-// Copyright (C) 2009
+// Copyright (C) 2009
// Fraunhofer Institute for Open Communication Systems (FOKUS)
-// Competence Center NETwork research (NET), St. Augustin, GERMANY
-// Stefan Bund <g0dil@berlios.de>
//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
+// The contents of this file are subject to the Fraunhofer FOKUS Public License
+// Version 1.0 (the "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+// http://senf.berlios.de/license.html
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// The Fraunhofer FOKUS Public License Version 1.0 is based on,
+// but modifies the Mozilla Public License Version 1.1.
+// See the full license text for the amendments.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the License.
+//
+// The Original Code is Fraunhofer FOKUS code.
+//
+// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
+// (registered association), Hansastraße 27 c, 80686 Munich, Germany.
+// All Rights Reserved.
+//
+// Contributor(s):
+// Stefan Bund <g0dil@berlios.de>
/** \file
\brief MultiConnectorMixin inline template implementation */
-//#include "MultiConnectorMixin.ih"
+#include "MultiConnectorMixin.ih"
// Custom includes
#define prefix_ inline
-///////////////////////////////cti.p///////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// senf::ppi::module::detail::MultiConnectorWrapper<Module,Connector>
+
+template <class Module, class Connector>
+prefix_ void senf::ppi::module::detail::MultiConnectorWrapper<Module, Connector>::v_disconnected()
+{
+ Connector::v_disconnected();
+ static_cast<Module&>(this->module()).disconnected(*this);
+}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,KeyType_,ContainerType_>
template <class Self_, class ConnectorType_, class KeyType_, class ContainerType_>
prefix_ ContainerType_ &
return connectors_;
}
+template <class Self_, class ConnectorType_, class KeyType_, class ContainerType_>
+prefix_ void
+senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,KeyType_,ContainerType_>::
+connectorDestroy(ConnectorType const &)
+{}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,void,ContainerType_>
+
template <class Self_, class ConnectorType_, class ContainerType_>
prefix_ ContainerType_ &
senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,void,ContainerType_>::connectors()
return connectors_;
}
-#ifdef DOXYGEN
-
-// Only for exposition
-// Other implementations with 0..SENF_MULTI_CONNECTOR_MAX_ARGS arguments accordingly
-
-template <class Self_, class ConnectorType_, class KeyType_, class ContainerType_>
-template <class A1>
-prefix_ ConnectorType_ &
-senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,KeyType_,ContainerType_>::
-newConnector(A1 const & a1)
+template <class Self_, class ConnectorType_, class ContainerType_>
+prefix_ ContainerType_ const &
+senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,void,ContainerType_>::connectors()
+ const
{
- std::auto_ptr<ConnectorType_> conn (new ConnectorType_);
- KeyType_ key (static_cast<Self_*>(this)->connectorSetup(*conn, a1));
- return * connectors_.insert(key, conn).first->second;
+ return connectors_;
}
template <class Self_, class ConnectorType_, class ContainerType_>
-template <class A1>
-prefix_ ConnectorType_ &
+prefix_ void
senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,void,ContainerType_>::
-newConnector(A1 const & a1)
-{
- connectors_.push_back(new ConnectorType_);
- ConnectorType_ & conn (connectors_.back());
- try { static_cast<Self_*>(this)->connectorSetup(conn , a1); }
- catch (...) { connectors_.pop_back(); throw; }
- return conn;
-}
+connectorDestroy(ConnectorType const &)
+{}
-template <class Source, class Target , class A1>
-typename boost::enable_if<
- boost::is_base_of<senf::ppi::connector::OutputConnector, typename Source::ConnectorType>,
- typename Source::ConnectorType & >::type
-senf::ppi::connect(Source & source, Target & target , A1 const & a1)
-{
- connect(source.newConnector(a1), target);
-}
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,void,void>
-template <class Source, class Target , class A1>
-typename boost::enable_if<
- boost::is_base_of<senf::ppi::connector::InputConnector, typename Target::ConnectorType>,
- typename Target::ConnectorType & >::type
-senf::ppi::connect(Source & source, Target & target , A1 const & a1)
+template <class Self_, class ConnectorType_>
+prefix_ void
+senf::ppi::module::MultiConnectorMixin<Self_,ConnectorType_,void,void>::
+disconnected(ConnectorType_ const & c)
{
- connect(source, target.newConnector(a1));
+ static_cast<Self_*>(this)->connectorDestroy(&c);
}
-#else
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef DOXYGEN
// Include 'Implementation' from MultiConnectorMixin.mpp
#define BOOST_PP_ITERATION_PARAMS_1 (4, ( \
3 ))
#include BOOST_PP_ITERATE()
-// Include 'senf::ppi::detail implementation' from MultiConnectorMixin.mpp
-#define BOOST_PP_ITERATION_PARAMS_1 (4, ( \
- 0, \
- 2*SENF_MULTI_CONNECTOR_MAX_ARGS, \
- SENF_ABSOLUTE_INCLUDE_PATH(PPI/MultiConnectorMixin.mpp), \
- 7 ))
-#include BOOST_PP_ITERATE()
-
#endif
-///////////////////////////////cti.e///////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
#undef prefix_
\f