enqueueInitializable();
if (! peer().initializationScheduled())
peer().enqueueInitializable();
+
+ v_connected();
+ peer_->v_connected();
+
}
senf::ppi::connector::Connector::TraceState senf::ppi::connector::Connector::traceState_ (
return typeid(void);
}
+prefix_ void senf::ppi::connector::Connector::unregisterConnector()
+{
+ if (module_)
+ module_->unregisterConnector(*this);
+}
+
+prefix_ void senf::ppi::connector::Connector::setModule(module::Module & module)
+{
+ module_ = &module;
+}
+
prefix_ void senf::ppi::connector::Connector::v_disconnected()
- const
+{}
+
+prefix_ void senf::ppi::connector::Connector::v_connected()
{}
///////////////////////////////////////////////////////////////////////////
unregisterConnector();
}
+prefix_ void senf::ppi::connector::PassiveConnector::v_disconnected()
+{
+ Connector::v_disconnected();
+ peer_ = 0;
+}
+
+prefix_ void senf::ppi::connector::PassiveConnector::v_connected()
+{
+ Connector::v_connected();
+ peer_ = & dynamic_cast<ActiveConnector&>(Connector::peer());
+}
+
////////////////////////////////////////
// private members
unregisterConnector();
}
+prefix_ void senf::ppi::connector::ActiveConnector::v_disconnected()
+{
+ Connector::v_disconnected();
+ peer_ = 0;
+}
+
+prefix_ void senf::ppi::connector::ActiveConnector::v_connected()
+{
+ Connector::v_connected();
+ peer_ = & dynamic_cast<PassiveConnector&>(Connector::peer());
+}
+
////////////////////////////////////////
// private members
}
}
+prefix_ void senf::ppi::connector::InputConnector::v_disconnected()
+{
+ Connector::v_disconnected();
+ peer_ = 0;
+}
+
+prefix_ void senf::ppi::connector::InputConnector::v_connected()
+{
+ Connector::v_connected();
+ peer_ = & dynamic_cast<OutputConnector&>(Connector::peer());
+}
+
////////////////////////////////////////
// private members
{}
///////////////////////////////////////////////////////////////////////////
+// senf::ppi::connector::OutputConnector
+
+prefix_ void senf::ppi::connector::OutputConnector::v_disconnected()
+{
+ Connector::v_disconnected();
+ peer_ = 0;
+}
+
+prefix_ void senf::ppi::connector::OutputConnector::v_connected()
+{
+ Connector::v_connected();
+ peer_ = & dynamic_cast<InputConnector&>(Connector::peer());
+}
+
+///////////////////////////////////////////////////////////////////////////
// senf::ppi::connector::GenericActiveInput
////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// senf::ppi::connector::GenericPassiveInput
+prefix_ void senf::ppi::connector::GenericPassiveInput::v_disconnected()
+{
+ PassiveConnector::v_disconnected();
+ InputConnector::v_disconnected();
+ peer_ = 0;
+}
+
+prefix_ void senf::ppi::connector::GenericPassiveInput::v_connected()
+{
+ PassiveConnector::v_connected();
+ InputConnector::v_connected();
+ peer_ = & dynamic_cast<GenericActiveOutput&>(Connector::peer());
+}
+
////////////////////////////////////////
// private members
}
}
+///////////////////////////////////////////////////////////////////////////
+// senf::ppi::connector::GenericPassiveOutput
+
+prefix_ void senf::ppi::connector::GenericPassiveOutput::v_disconnected()
+{
+ PassiveConnector::v_disconnected();
+ OutputConnector::v_disconnected();
+ peer_ = 0;
+}
+
+prefix_ void senf::ppi::connector::GenericPassiveOutput::v_connected()
+{
+ PassiveConnector::v_connected();
+ OutputConnector::v_connected();
+ peer_ = & dynamic_cast<GenericActiveInput&>(Connector::peer());
+}
+
+///////////////////////////////////////////////////////////////////////////
+// senf::ppi::connector::GenericActiveInput
+
+prefix_ void senf::ppi::connector::GenericActiveInput::v_disconnected()
+{
+ ActiveConnector::v_disconnected();
+ InputConnector::v_disconnected();
+ peer_ = 0;
+}
+
+prefix_ void senf::ppi::connector::GenericActiveInput::v_connected()
+{
+ ActiveConnector::v_connected();
+ InputConnector::v_connected();
+ peer_ = & dynamic_cast<GenericPassiveOutput&>(Connector::peer());
+}
+
+///////////////////////////////////////////////////////////////////////////
+// senf::ppi::connector::GenericActiveOutput
+
+prefix_ void senf::ppi::connector::GenericActiveOutput::v_disconnected()
+{
+ ActiveConnector::v_disconnected();
+ OutputConnector::v_disconnected();
+ peer_ = 0;
+}
+
+prefix_ void senf::ppi::connector::GenericActiveOutput::v_connected()
+{
+ ActiveConnector::v_connected();
+ OutputConnector::v_connected();
+ peer_ = & dynamic_cast<GenericPassiveInput&>(Connector::peer());
+}
+
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "Connectors.mpp"
return peer_;
}
-prefix_ void senf::ppi::connector::Connector::unregisterConnector()
-{
- if (module_)
- module_->unregisterConnector(*this);
-}
-
-////////////////////////////////////////
-// private members
-
-prefix_ void senf::ppi::connector::Connector::setModule(module::Module & module)
-{
- module_ = &module;
-}
-
///////////////////////////////////////////////////////////////////////////
// senf::ppi::connector::PassiveConnector
prefix_ senf::ppi::connector::ActiveConnector & senf::ppi::connector::PassiveConnector::peer()
const
{
- return dynamic_cast<ActiveConnector&>(Connector::peer());
+ SENF_ASSERT(peer_, "senf::ppi::connect() call missing");
+ return *peer_;
}
prefix_ bool senf::ppi::connector::PassiveConnector::throttled()
prefix_ senf::ppi::connector::PassiveConnector & senf::ppi::connector::ActiveConnector::peer()
const
{
- return dynamic_cast<PassiveConnector&>(Connector::peer());
+ SENF_ASSERT(peer_, "senf::ppi::connect() call missing");
+ return *peer_;
}
prefix_ void senf::ppi::connector::ActiveConnector::onThrottle()
prefix_ senf::ppi::connector::OutputConnector & senf::ppi::connector::InputConnector::peer()
const
{
- return dynamic_cast<OutputConnector &>(Connector::peer());
+ SENF_ASSERT(peer_, "senf::ppi::connect() call missing");
+ return *peer_;
}
prefix_ senf::ppi::connector::InputConnector::queue_iterator
prefix_ senf::ppi::connector::InputConnector & senf::ppi::connector::OutputConnector::peer()
const
{
- return dynamic_cast<InputConnector&>(Connector::peer());
+ SENF_ASSERT(peer_, "senf::ppi::connect() call missing");
+ return *peer_;
}
prefix_ void senf::ppi::connector::OutputConnector::operator()(Packet const & p)
prefix_ senf::ppi::connector::GenericActiveOutput & senf::ppi::connector::GenericPassiveInput::peer()
const
{
- return dynamic_cast<GenericActiveOutput&>(Connector::peer());
+ SENF_ASSERT(peer_, "senf::ppi::connect() call missing");
+ return *peer_;
}
prefix_ bool senf::ppi::connector::GenericPassiveInput::boolean_test()
prefix_ senf::ppi::connector::GenericActiveInput & senf::ppi::connector::GenericPassiveOutput::peer()
const
{
- return dynamic_cast<GenericActiveInput&>(Connector::peer());
+ SENF_ASSERT(peer_, "senf::ppi::connect() call missing");
+ return *peer_;
}
prefix_ bool senf::ppi::connector::GenericPassiveOutput::boolean_test()
prefix_ senf::ppi::connector::GenericPassiveOutput & senf::ppi::connector::GenericActiveInput::peer()
const
{
- return dynamic_cast<GenericPassiveOutput&>(Connector::peer());
+ SENF_ASSERT(peer_, "senf::ppi::connect() call missing");
+ return *peer_;
}
prefix_ bool senf::ppi::connector::GenericActiveInput::boolean_test()
prefix_ senf::ppi::connector::GenericPassiveInput & senf::ppi::connector::GenericActiveOutput::peer()
const
{
- return dynamic_cast<GenericPassiveInput&>(Connector::peer());
+// return dynamic_cast<GenericPassiveInput&>(Connector::peer());
+ SENF_ASSERT(peer_, "senf::ppi::connect() call missing");
+ return *peer_;
}
prefix_ bool senf::ppi::connector::GenericActiveOutput::boolean_test()
void unregisterConnector();
+ virtual void v_disconnected();
+ virtual void v_connected();
+
private:
virtual std::type_info const & packetTypeID();
- virtual void v_disconnected() const;
-
void setModule(module::Module & module);
Connector * peer_;
void emit();
+ virtual void v_disconnected();
+ virtual void v_connected();
+
private:
virtual void v_init();
void registerRoute(ForwardingRoute & route);
void unregisterRoute(ForwardingRoute & route);
+ ActiveConnector * peer_;
+
typedef ppi::detail::Callback<>::type Callback;
Callback callback_;
bool remoteThrottled_;
bool nativeThrottled_;
+ ActiveConnector * myPeer_;
typedef std::vector<ForwardingRoute*> Routes;
Routes routes_;
protected:
ActiveConnector();
+ virtual void v_disconnected();
+ virtual void v_connected();
+
private:
virtual void v_init();
void registerRoute(ForwardingRoute & route);
void unregisterRoute(ForwardingRoute & route);
+ PassiveConnector * peer_;
+
Callback throttleCallback_;
Callback unthrottleCallback_;
protected:
InputConnector();
+ virtual void v_disconnected();
+ virtual void v_connected();
+
private:
void enqueue(Packet const & p);
virtual void v_enqueueEvent();
virtual void v_dequeueEvent();
+ OutputConnector * peer_;
Queue queue_;
friend class OutputConnector;
protected:
OutputConnector();
+
+ virtual void v_disconnected();
+ virtual void v_connected();
+
+ private:
+ InputConnector * peer_;
};
/** \brief Combination of PassiveConnector and InputConnector
void qdisc(QueueingDiscipline::None_t);
///< Disable queueing discipline
-
protected:
GenericPassiveInput();
+ virtual void v_disconnected();
+ virtual void v_connected();
+
private:
void v_enqueueEvent();
void v_dequeueEvent();
void v_unthrottleEvent();
+ GenericActiveOutput * peer_;
boost::scoped_ptr<QueueingDiscipline> qdisc_;
};
protected:
GenericPassiveOutput();
+ virtual void v_disconnected();
+ virtual void v_connected();
+
+ private:
+ GenericActiveInput * peer_;
};
/** \brief Combination of ActiveConnector and InputConnector
protected:
GenericActiveInput();
+ virtual void v_disconnected();
+ virtual void v_connected();
+
private:
void v_requestEvent();
+
+ GenericPassiveOutput * peer_;
};
/** \brief Combination of ActiveConnector and OutputConnector
protected:
GenericActiveOutput();
+ virtual void v_disconnected();
+ virtual void v_connected();
+
+ private:
+ GenericPassiveInput * peer_;
};
+
#ifndef DOXYGEN
# define TypedConnector_Input read
template <class Module, class Connector>
prefix_ void senf::ppi::module::detail::MultiConnectorWrapper<Module, Connector>::v_disconnected()
- const
{
+ Connector::v_disconnected();
static_cast<Module&>(this->module()).disconnected(*this);
}
: public Connector
{
private:
- virtual void v_disconnected() const;
+ virtual void v_disconnected();
};
#ifndef DOXYGEN
const
{
Packet p (next(nothrow));
- return p && p.is<OtherPacket>() ? p.as<OtherPacket>() : OtherPacket();
+ return p && p.is<OtherPacket>() ?
+ OtherPacket(p.ptr()->as<typename OtherPacket::type>()) : OtherPacket();
}
template <class OtherPacket>
prefix_ senf::ClockService::clock_type senf::ClockService::clock_m(abstime_type time)
{
- if (senf::scheduler::now() - baseClock_ > 1000000000ll)
+ if (scheduler::now() - baseClock_ > 1000000000ll)
restart_m();
boost::posix_time::time_duration delta (time - baseAbstime_);
return baseClock_ + clock_type( delta.ticks() )
{
if (clock == 0)
return abstime_type();
- if (senf::scheduler::now() - baseClock_ > 1000000000ll)
+ if (scheduler::now() - baseClock_ > 1000000000ll)
restart_m();
#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
return baseAbstime_ + boost::posix_time::nanoseconds(clock-baseClock_);
prefix_ senf::ClockService::clock_type senf::ClockService::from_timeval(timeval const & time)
{
- return from_time_t(time.tv_sec) + ClockService::microseconds(time.tv_usec);
+ return from_time_t(time.tv_sec) + microseconds(time.tv_usec);
}
prefix_ void senf::ClockService::restart()
senf::scheduler::detail::FIFORunner::priorityEnd(TaskInfo::Priority p)
{
switch (p) {
- case senf::scheduler::detail::FIFORunner::TaskInfo::PRIORITY_LOW :
+ case TaskInfo::PRIORITY_LOW :
return tasks_.end();
- case senf::scheduler::detail::FIFORunner::TaskInfo::PRIORITY_NORMAL :
+ case TaskInfo::PRIORITY_NORMAL :
return TaskList::current(normalPriorityEnd_);
- case senf::scheduler::detail::FIFORunner::TaskInfo::PRIORITY_HIGH :
+ case TaskInfo::PRIORITY_HIGH :
return TaskList::current(highPriorityEnd_);
}
return tasks_.begin();