prefix_ void senf::ppi::IOEvent::v_enable()
{
- event_.enable();
+ if (fd_ != -1)
+ event_.enable();
}
prefix_ void senf::ppi::IOEvent::v_disable()
{
- event_.disable();
+ if (fd_ != -1)
+ event_.disable();
}
prefix_ void senf::ppi::IOEvent::cb(int event)
--- /dev/null
+// $Id$
+//
+// 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.
+//
+// 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.
+//
+// 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.
+
+/** \file
+ \brief IOEvent inline non-template implementation */
+
+//#include "IOEvent.ih"
+
+// Custom includes
+
+#define prefix_ inline
+///////////////////////////////cci.p///////////////////////////////////////
+
+prefix_ senf::ppi::IOEvent::IOEvent()
+ : fd_ (-1),
+ event_ ("senf::ppi::IOEvent", boost::bind(&IOEvent::cb,this,_1))
+{}
+
+///////////////////////////////cci.e///////////////////////////////////////
+#undef prefix_
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
event_ ("senf::ppi::IOEvent", boost::bind(&IOEvent::cb,this,_1), fd_, events, false)
{}
+template <class Handle>
+prefix_ void senf::ppi::IOEvent::set(Handle handle, unsigned events)
+{
+ if (handle) {
+ fd_ = senf::scheduler::get_descriptor(handle);
+ event_.events(events).handle(fd_);
+ }
+ else {
+ event_.disable();
+ fd_ = -1;
+ }
+}
+
///////////////////////////////cti.e///////////////////////////////////////
#undef prefix_
///\name Structors and default members
///@{
+ IOEvent();
+
template <class Handle>
IOEvent(Handle handle, unsigned events);
///@}
///////////////////////////////////////////////////////////////////////////
+ template <class Handle>
+ void set(Handle handle, unsigned events);
+
/** \brief Unhandled error condition */
struct ErrorException : public senf::Exception
{ ErrorException() : senf::Exception("senf::ppi::IOEvent::ErrorException"){} };
: GenericActiveInputJack (input)
{}
-prefix_ senf::ppi::connector::ActiveInputJack<senf::Packet>::ActiveInputJack(ActiveInput<> & input)
- : GenericActiveInputJack (input)
+template <class PacketType>
+prefix_
+senf::ppi::connector::ActiveInputJack<PacketType>::ActiveInputJack(ActiveInputJack & input)
+ : GenericActiveInputJack (input.connector())
+{}
+
+template <class PacketType>
+prefix_
+senf::ppi::connector::ActiveInputJack<PacketType>::ActiveInputJack(ActiveInputJack<> & input)
+ : GenericActiveInputJack (input.connector())
+{}
+
+prefix_
+senf::ppi::connector::ActiveInputJack<senf::Packet>::ActiveInputJack(ActiveInput<> & input)
+ : GenericActiveInputJack (input)
+{}
+
+prefix_
+senf::ppi::connector::ActiveInputJack<senf::Packet>::ActiveInputJack(ActiveInputJack & input)
+ : GenericActiveInputJack (input.connector())
{}
template <class PacketType>
: GenericActiveOutputJack (output)
{}
-prefix_
-senf::ppi::connector::ActiveOutputJack<senf::Packet>::ActiveOutputJack(ActiveOutput<> & output)
- : GenericActiveOutputJack (output)
+template <class PacketType>
+prefix_ senf::ppi::connector::ActiveOutputJack<PacketType>::
+ActiveOutputJack(ActiveOutputJack & output)
+ : GenericActiveOutputJack (output.connector())
+{}
+
+template <class PacketType>
+prefix_ senf::ppi::connector::ActiveOutputJack<PacketType>::
+ActiveOutputJack(ActiveOutputJack<> & output)
+ : GenericActiveOutputJack (output.connector())
+{}
+
+prefix_ senf::ppi::connector::ActiveOutputJack<senf::Packet>::
+ActiveOutputJack(ActiveOutput<> & output)
+ : GenericActiveOutputJack (output)
+{}
+
+prefix_ senf::ppi::connector::ActiveOutputJack<senf::Packet>::
+ActiveOutputJack(ActiveOutputJack & output)
+ : GenericActiveOutputJack (output.connector())
{}
template <class PacketType>
: GenericPassiveInputJack (input)
{}
+template <class PacketType>
+prefix_
+senf::ppi::connector::PassiveInputJack<PacketType>::PassiveInputJack(PassiveInputJack & input)
+ : GenericPassiveInputJack (input.connector())
+{}
+
+template <class PacketType>
+prefix_ senf::ppi::connector::PassiveInputJack<PacketType>::
+PassiveInputJack(PassiveInputJack<> & input)
+ : GenericPassiveInputJack (input.connector())
+{}
+
prefix_
senf::ppi::connector::PassiveInputJack<senf::Packet>::PassiveInputJack(PassiveInput<> & input)
: GenericPassiveInputJack (input)
{}
+prefix_ senf::ppi::connector::PassiveInputJack<senf::Packet>::
+PassiveInputJack(PassiveInputJack & input)
+ : GenericPassiveInputJack (input.connector())
+{}
+
template <class PacketType>
prefix_ senf::ppi::connector::PassiveOutputJack<PacketType>::
PassiveOutputJack(PassiveOutput<PacketType> & output)
: GenericPassiveOutputJack (output)
{}
-prefix_
-senf::ppi::connector::PassiveOutputJack<senf::Packet>::PassiveOutputJack(PassiveOutput<> & output)
- : GenericPassiveOutputJack (output)
+template <class PacketType>
+prefix_ senf::ppi::connector::PassiveOutputJack<PacketType>::
+PassiveOutputJack(PassiveOutputJack & output)
+ : GenericPassiveOutputJack (output.connector())
+{}
+
+template <class PacketType>
+prefix_ senf::ppi::connector::PassiveOutputJack<PacketType>::
+PassiveOutputJack(PassiveOutputJack<> & output)
+ : GenericPassiveOutputJack (output.connector())
+{}
+
+prefix_ senf::ppi::connector::PassiveOutputJack<senf::Packet>::
+PassiveOutputJack(PassiveOutput<> & output)
+ : GenericPassiveOutputJack (output)
+{}
+
+prefix_ senf::ppi::connector::PassiveOutputJack<senf::Packet>::
+PassiveOutputJack(PassiveOutputJack & output)
+ : GenericPassiveOutputJack (output.connector())
{}
template <class T>
public:
explicit ActiveInputJack(ActiveInput<PacketType> & input);
explicit ActiveInputJack(ActiveInput<> & input);
+
+ explicit ActiveInputJack(ActiveInputJack & input);
+ explicit ActiveInputJack(ActiveInputJack<> & input);
};
#ifndef DOXYGEN
{
public:
explicit ActiveInputJack(ActiveInput<> & input);
+ explicit ActiveInputJack(ActiveInputJack & input);
};
#endif
public:
explicit ActiveOutputJack(ActiveOutput<PacketType> & output);
explicit ActiveOutputJack(ActiveOutput<> & output);
+
+ explicit ActiveOutputJack(ActiveOutputJack & output);
+ explicit ActiveOutputJack(ActiveOutputJack<> & output);
};
#ifndef DOXYGEN
{
public:
explicit ActiveOutputJack(ActiveOutput<> & output);
+ explicit ActiveOutputJack(ActiveOutputJack & output);
};
#endif
public:
explicit PassiveInputJack(PassiveInput<PacketType> & input);
explicit PassiveInputJack(PassiveInput<> & input);
+
+ explicit PassiveInputJack(PassiveInputJack & input);
+ explicit PassiveInputJack(PassiveInputJack<> & input);
};
#ifndef DOXYGEN
{
public:
explicit PassiveInputJack(PassiveInput<> & input);
+ explicit PassiveInputJack(PassiveInputJack & input);
};
#endif
public:
explicit PassiveOutputJack(PassiveOutput<PacketType> & output);
explicit PassiveOutputJack(PassiveOutput<> & output);
+
+ explicit PassiveOutputJack(PassiveOutputJack & output);
+ explicit PassiveOutputJack(PassiveOutputJack<> & output);
};
#ifndef DOXYGEN
{
public:
explicit PassiveOutputJack(PassiveOutput<> & output);
+ explicit PassiveOutputJack(PassiveOutputJack & output);
};
#endif
// senf::ppi::module::ActiveSocketSource<Reader>
template <class Reader>
+prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource()
+{}
+
+template <class Reader>
+prefix_ senf::ppi::module::ActiveSocketSource<Reader>::ActiveSocketSource(Reader reader)
+ : reader_(reader)
+{}
+
+template <class Reader>
prefix_ senf::ppi::module::ActiveSocketSource<Reader>::
ActiveSocketSource(Handle handle)
- : handle_(handle), event_(handle_, IOEvent::Read), reader_()
+ : handle_(handle), event_(handle_, IOEvent::Read)
{
registerEvent( event_, &ActiveSocketSource::read );
route(event_, output);
return reader_;
}
+template <class Reader>
+prefix_ typename senf::ppi::module::ActiveSocketSource<Reader>::Handle
+senf::ppi::module::ActiveSocketSource<Reader>::handle()
+{
+ return handle_;
+}
+
+template <class Reader>
+prefix_ void senf::ppi::module::ActiveSocketSource<Reader>::handle(Handle handle)
+{
+ handle_ = handle;
+ event_.set(handle_, IOEvent::Read);
+}
+
///////////////////////////////cti.e///////////////////////////////////////
#undef prefix_
connector::ActiveOutput<typename Reader::PacketType> output;
///< Output connector to which the data received is written
- ActiveSocketSource(Handle handle); ///< Create new reader for the given handle
+ ActiveSocketSource(); ///< Create non-connected reader
+ /**< The reader will be disabled until a socket is set
+ \pre Requires \a Reader to be default constructible */
+ explicit ActiveSocketSource(Reader reader); ///< Create non-connected reader
+ /**< The reader will be disabled until a socket is set
+ \pre Requires \a Reader to be copy constructible */
+ explicit ActiveSocketSource(Handle handle); ///< Create new reader for the given handle
/**< Data will be read from \a handle and be parsed by \a
Reader.
\pre Requires \a Reader to be default constructible
\param[in] handle Handle to read data from */
Reader & reader(); ///< Access Reader helper
+ Handle handle(); ///< Access handle
+ void handle(Handle handle); ///< Set handle
+ /**< Assigning an empty or in-valid() handle will disable
+ the module until a new, valid handle is assigned. */
private:
void read();
env.Clean('all', '.prepare-stamp')
-# Not nice, but until we get to fixing the dependency jungle
-# concerning generated sources ...
-scripts = []
-dependencies = []
-
SConscript(glob.glob("*/SConscript"))
SENFSCons.StandardTargets(env)