From: tho Date: Thu, 13 Jan 2011 12:20:09 +0000 (+0000) Subject: made some members non-inline to decrease size X-Git-Url: http://g0dil.de/git?p=senf.git;a=commitdiff_plain;h=92d091c2e5b387ca0c9930c7bc88d9b45630a845 made some members non-inline to decrease size Packets/80221Bundle: revised validate function once again git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1762 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/PPI/Module.cc b/senf/PPI/Module.cc index 1376290..6638cb9 100644 --- a/senf/PPI/Module.cc +++ b/senf/PPI/Module.cc @@ -33,6 +33,47 @@ //-///////////////////////////////////////////////////////////////////////////////////////////////// //-///////////////////////////////////////////////////////////////////////////////////////////////// +// 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 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" diff --git a/senf/PPI/Module.cci b/senf/PPI/Module.cci index e967b4c..4157922 100644 --- a/senf/PPI/Module.cci +++ b/senf/PPI/Module.cci @@ -56,37 +56,11 @@ prefix_ senf::ppi::ModuleManager & senf::ppi::module::Module::moduleManager() 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 route) -{ - routes_.push_back(route.release()); - return routes_.back(); -} - //-///////////////////////////////////////////////////////////////////////////////////////////////// // public members @@ -120,12 +94,6 @@ prefix_ senf::ppi::module::Module::Module() 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); diff --git a/senf/PPI/PassiveQueue.cc b/senf/PPI/PassiveQueue.cc index f26f0ad..03f460c 100644 --- a/senf/PPI/PassiveQueue.cc +++ b/senf/PPI/PassiveQueue.cc @@ -35,6 +35,13 @@ //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::ppi::module::PassiveQueue +prefix_ senf::ppi::module::PassiveQueue::PassiveQueue() +{ + route(input,output); + input.onRequest(&PassiveQueue::onInput); + output.onRequest(&PassiveQueue::onOutput); +} + //-///////////////////////////////////////////////////////////////////////////////////////////////// // private members diff --git a/senf/PPI/PassiveQueue.cci b/senf/PPI/PassiveQueue.cci index ad72bb5..ec4a308 100644 --- a/senf/PPI/PassiveQueue.cci +++ b/senf/PPI/PassiveQueue.cci @@ -28,15 +28,7 @@ #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_ diff --git a/senf/Packets/80221Bundle/TLVParser.cc b/senf/Packets/80221Bundle/TLVParser.cc index 5f35f25..373478b 100644 --- a/senf/Packets/80221Bundle/TLVParser.cc +++ b/senf/Packets/80221Bundle/TLVParser.cc @@ -42,13 +42,19 @@ SENF_PACKET_TLV_REGISTRY_REGISTER( senf::MIHValidTimeIntervalTLVParser ); //-///////////////////////////////////////////////////////////////////////////////////////////////// // 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()); } @@ -63,7 +69,6 @@ prefix_ void senf::MIHBaseListTLVParser::maxListSize(MIHTLVLengthParser::value_t maxLength( maxl + senf::bytes(listSize_())); } - //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::MIHFIdTLVParser @@ -247,7 +252,7 @@ prefix_ void senf::MIHStatusTLVParser::dump(std::ostream & os) prefix_ void senf::MIHStatusTLVParser::validate() const { - validateTL( typeId, 1); + validateTypeLength( typeId, 1); if (value() >= 4) throw InvalidMIHPacketException("invalid value in MIHStatusTLV ") << senf::str(value()); } @@ -278,7 +283,7 @@ prefix_ void senf::MIHRegisterReqCodeTLVParser::dump(std::ostream & os) prefix_ void senf::MIHRegisterReqCodeTLVParser::validate() const { - validateTL( typeId, 1); + validateTypeLength( typeId, 1); if (value() >= 2) throw InvalidMIHPacketException("invalid value in MIHRegisterReqCodeTLV ") << senf::str(value()); } @@ -301,7 +306,7 @@ prefix_ void senf::MIHValidTimeIntervalTLVParser::dump(std::ostream & os) prefix_ void senf::MIHValidTimeIntervalTLVParser::validate() const { - validateTL( typeId, 4); + validateTypeLength( typeId, 4); } //-///////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/senf/Packets/80221Bundle/TLVParser.hh b/senf/Packets/80221Bundle/TLVParser.hh index ce40481..2940400 100644 --- a/senf/Packets/80221Bundle/TLVParser.hh +++ b/senf/Packets/80221Bundle/TLVParser.hh @@ -133,7 +133,8 @@ namespace senf { */ 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; }; diff --git a/senf/Packets/Packet.cc b/senf/Packets/Packet.cc index df321df..049e6f5 100644 --- a/senf/Packets/Packet.cc +++ b/senf/Packets/Packet.cc @@ -54,6 +54,13 @@ prefix_ senf::Packet senf::Packet::getLast() 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" diff --git a/senf/Packets/Packet.cci b/senf/Packets/Packet.cci index 150bc62..3bd0522 100644 --- a/senf/Packets/Packet.cci +++ b/senf/Packets/Packet.cci @@ -153,13 +153,6 @@ prefix_ void senf::Packet::finalizeAll() 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 { diff --git a/senf/Utils/StatisticAccumulator.hh b/senf/Utils/StatisticAccumulator.hh index 8bd2b32..08ba344 100644 --- a/senf/Utils/StatisticAccumulator.hh +++ b/senf/Utils/StatisticAccumulator.hh @@ -31,29 +31,30 @@ #include ///////////////////////////////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 StatisticAccumulator { diff --git a/senf/Utils/Statistics.cc b/senf/Utils/Statistics.cc index faf80f7..f2b9c9d 100644 --- a/senf/Utils/Statistics.cc +++ b/senf/Utils/Statistics.cc @@ -150,6 +150,17 @@ prefix_ void senf::StatisticsBase::generateOutput() } //-///////////////////////////////////////////////////////////////////////////////////////////////// +// senf::StatisticsBase::OutputEntry + +prefix_ void senf::StatisticsBase::OutputEntry::consoleList(std::ostream & os) +{ + for (boost::ptr_vector::iterator i (targets_.begin()); + i != targets_.end(); ++i) + if (! i->label.empty()) + os << i->label << "\n"; +} + +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::Statistics prefix_ senf::Statistics::Statistics() diff --git a/senf/Utils/Statistics.cci b/senf/Utils/Statistics.cci index a9e51eb..762aa0d 100644 --- a/senf/Utils/Statistics.cci +++ b/senf/Utils/Statistics.cci @@ -82,14 +82,6 @@ senf::StatisticsBase::OutputEntry::operator=(const OutputEntry& other) return *this; } -prefix_ void senf::StatisticsBase::OutputEntry::consoleList(std::ostream & os) -{ - for (boost::ptr_vector::iterator i (targets_.begin()); - i != targets_.end(); ++i) - if (! i->label.empty()) - os << i->label << "\n"; -} - //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::StatisticsBase