//-/////////////////////////////////////////////////////////////////////////////////////////////////
//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// senf::ppi::module::Module
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// private members
+
+prefix_ void senf::ppi::module::Module::registerConnector(connector::Connector & connector)
+{
+ if (std::find(connectorRegistry_.begin(), connectorRegistry_.end(), &connector)
+ == connectorRegistry_.end()) {
+ connectorRegistry_.push_back(&connector);
+ connector.setModule(*this);
+ }
+}
+
+prefix_ void senf::ppi::module::Module::unregisterConnector(connector::Connector & connector)
+{
+ ConnectorRegistry::iterator i (std::find(connectorRegistry_.begin(), connectorRegistry_.end(),
+ &connector));
+ if (i != connectorRegistry_.end())
+ connectorRegistry_.erase(i);
+
+ routes_.erase_if(boost::bind(&RouteBase::hasConnector, _1, boost::cref(connector)));
+}
+
+prefix_ senf::ppi::RouteBase &
+senf::ppi::module::Module::addRoute(std::auto_ptr<RouteBase> route)
+{
+ routes_.push_back(route.release());
+ return routes_.back();
+}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// protected members
+
+prefix_ void senf::ppi::module::Module::noroute(connector::Connector & connector)
+{
+ registerConnector(connector);
+ connector.setModule(*this);
+}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
#undef prefix_
//#include "Module.mpp"
return ModuleManager::instance();
}
-prefix_ void senf::ppi::module::Module::registerConnector(connector::Connector & connector)
-{
- if (std::find(connectorRegistry_.begin(), connectorRegistry_.end(), &connector)
- == connectorRegistry_.end()) {
- connectorRegistry_.push_back(&connector);
- connector.setModule(*this);
- }
-}
-
-prefix_ void senf::ppi::module::Module::unregisterConnector(connector::Connector & connector)
-{
- ConnectorRegistry::iterator i (std::find(connectorRegistry_.begin(), connectorRegistry_.end(),
- &connector));
- if (i != connectorRegistry_.end())
- connectorRegistry_.erase(i);
-
- routes_.erase_if(boost::bind(&RouteBase::hasConnector, _1, boost::cref(connector)));
-}
-
prefix_ void senf::ppi::module::Module::unregisterEvent(EventDescriptor & event)
{
routes_.erase_if(boost::bind(&RouteBase::hasEvent, _1, boost::cref(event)));
}
-prefix_ senf::ppi::RouteBase &
-senf::ppi::module::Module::addRoute(std::auto_ptr<RouteBase> route)
-{
- routes_.push_back(route.release());
- return routes_.back();
-}
-
//-/////////////////////////////////////////////////////////////////////////////////////////////////
// public members
moduleManager().registerModule(*this);
}
-prefix_ void senf::ppi::module::Module::noroute(connector::Connector & connector)
-{
- registerConnector(connector);
- connector.setModule(*this);
-}
-
prefix_ void senf::ppi::module::Module::destroy()
{
eventManager().destroyModule(*this);
//-/////////////////////////////////////////////////////////////////////////////////////////////////
// senf::ppi::module::PassiveQueue
+prefix_ senf::ppi::module::PassiveQueue::PassiveQueue()
+{
+ route(input,output);
+ input.onRequest(&PassiveQueue::onInput);
+ output.onRequest(&PassiveQueue::onOutput);
+}
+
//-/////////////////////////////////////////////////////////////////////////////////////////////////
// private members
#define prefix_ inline
//-/////////////////////////////////////////////////////////////////////////////////////////////////
-//-/////////////////////////////////////////////////////////////////////////////////////////////////
-// senf::ppi::module::PassiveQueue
-prefix_ senf::ppi::module::PassiveQueue::PassiveQueue()
-{
- route(input,output);
- input.onRequest(&PassiveQueue::onInput);
- output.onRequest(&PassiveQueue::onOutput);
-}
//-/////////////////////////////////////////////////////////////////////////////////////////////////
#undef prefix_
//-/////////////////////////////////////////////////////////////////////////////////////////////////
// MIHBaseTLVParser
-prefix_ void senf::MIHBaseTLVParser::validateTL(boost::uint8_t expectedType, MIHTLVLengthParser::value_type expectedLength)
+prefix_ void senf::MIHBaseTLVParser::validateType(boost::uint8_t expectedType)
const
{
if (! check( 1 + senf::bytes(length_()) + length()) )
throw InvalidMIHPacketException("truncated TLV.") << " Type: " << senf::str(type());
if (type() != expectedType)
- throw InvalidMIHPacketException("invalid TLV type") << " Type: " << senf::str(type());
+ throw InvalidMIHPacketException("invalid TLV type: ") << senf::str(type());
+}
+
+prefix_ void senf::MIHBaseTLVParser::validateTypeLength(boost::uint8_t expectedType, MIHTLVLengthParser::value_type expectedLength)
+ const
+{
+ validateType( expectedLength);
if (length() != expectedLength)
throw InvalidMIHPacketException("invalid length in TLV.") << " Type: " << senf::str(type());
}
maxLength( maxl + senf::bytes(listSize_()));
}
-
//-/////////////////////////////////////////////////////////////////////////////////////////////////
// senf::MIHFIdTLVParser
prefix_ void senf::MIHStatusTLVParser::validate()
const
{
- validateTL( typeId, 1);
+ validateTypeLength( typeId, 1);
if (value() >= 4)
throw InvalidMIHPacketException("invalid value in MIHStatusTLV ") << senf::str(value());
}
prefix_ void senf::MIHRegisterReqCodeTLVParser::validate()
const
{
- validateTL( typeId, 1);
+ validateTypeLength( typeId, 1);
if (value() >= 2)
throw InvalidMIHPacketException("invalid value in MIHRegisterReqCodeTLV ") << senf::str(value());
}
prefix_ void senf::MIHValidTimeIntervalTLVParser::validate()
const
{
- validateTL( typeId, 4);
+ validateTypeLength( typeId, 4);
}
//-/////////////////////////////////////////////////////////////////////////////////////////////////
*/
void maxLength(MIHTLVLengthParser::value_type maxl) const;
- void validateTL(boost::uint8_t type, MIHTLVLengthParser::value_type length) const;
+ void validateType(boost::uint8_t type) const;
+ void validateTypeLength(boost::uint8_t type, MIHTLVLengthParser::value_type length) const;
};
return p;
}
+prefix_ void senf::Packet::dump(std::ostream & os)
+ const
+{
+ last(); // Make sure the packet is complete
+ ptr()->dump(os);
+}
+
//-/////////////////////////////////////////////////////////////////////////////////////////////////
#undef prefix_
//#include "Packet.mpp"
ptr()->finalizeTo(last().ptr());
}
-prefix_ void senf::Packet::dump(std::ostream & os)
- const
-{
- last(); // Make sure the packet is complete
- ptr()->dump(os);
-}
-
prefix_ senf::TypeIdValue senf::Packet::typeId()
const
{
#include <boost/cstdint.hpp>
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
- /** \brief Accumulate measurement values
-
- The accumulator mainly do the prelimenary work for the senf::Statistic class.
- It accumulates certain values with in an interval to be used by senf::Statistics
-
- \li the senf::Statistics class
- \li statistics sources
-
- This class provides the average, standard deviation, min, max values over one
- interval, means until clear() is called. It rather directly calculates the results
- then collection all single values provided by calling accumulate().
- \see senf::Statistics to process accumulated values
- \ingroup senf_statistics
- */
-
- struct StatisticsData{
- float min;
- float max;
- float avg;
- float stddev;
- boost::uint32_t count;
- };
+ struct StatisticsData
+ {
+ float min;
+ float max;
+ float avg;
+ float stddev;
+ boost::uint32_t count;
+ };
+
+ /** \brief Accumulate measurement values
+
+ The accumulator mainly do the prelimenary work for the senf::Statistic class.
+ It accumulates certain values with in an interval to be used by senf::Statistics
+
+ \li the senf::Statistics class
+ \li statistics sources
+
+ This class provides the average, standard deviation, min, max values over one
+ interval, means until clear() is called. It rather directly calculates the results
+ then collection all single values provided by calling accumulate().
+ \see senf::Statistics to process accumulated values
+ \ingroup senf_statistics
+ */
template <class T>
class StatisticAccumulator
{
}
//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// senf::StatisticsBase::OutputEntry
+
+prefix_ void senf::StatisticsBase::OutputEntry::consoleList(std::ostream & os)
+{
+ for (boost::ptr_vector<TargetBase>::iterator i (targets_.begin());
+ i != targets_.end(); ++i)
+ if (! i->label.empty())
+ os << i->label << "\n";
+}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
// senf::Statistics
prefix_ senf::Statistics::Statistics()
return *this;
}
-prefix_ void senf::StatisticsBase::OutputEntry::consoleList(std::ostream & os)
-{
- for (boost::ptr_vector<TargetBase>::iterator i (targets_.begin());
- i != targets_.end(); ++i)
- if (! i->label.empty())
- os << i->label << "\n";
-}
-
//-/////////////////////////////////////////////////////////////////////////////////////////////////
// senf::StatisticsBase