From: tho Date: Wed, 26 Oct 2011 07:35:15 +0000 (+0000) Subject: some minor optimizations X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=3bc817b121719fcb77f7d5adbd680a1190328ed6;p=senf.git some minor optimizations git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1819 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/PPI/Connectors.cc b/senf/PPI/Connectors.cc index 7290e01..9fbddeb 100644 --- a/senf/PPI/Connectors.cc +++ b/senf/PPI/Connectors.cc @@ -72,13 +72,13 @@ prefix_ void senf::ppi::connector::Connector::connect(Connector & target) "senf::ppi::connector::Connector::connect(): (target) " "duplicate connection" ); - if (! (packetTypeID() == typeid(void) || - target.packetTypeID() == typeid(void) || - packetTypeID() == target.packetTypeID()) ) + if (! (v_packetTypeId() == typeid(void) || + target.v_packetTypeId() == typeid(void) || + v_packetTypeId() == target.v_packetTypeId()) ) throw IncompatibleConnectorsException() - << ": " << prettyName(packetTypeID()) + << ": " << prettyName(v_packetTypeId()) << " [in module " << prettyName(typeid(*module_)) << "] " - << ", " << prettyName(target.packetTypeID()) + << ", " << prettyName(target.v_packetTypeId()) << " [in module " << prettyName(typeid(*target.module_)) << "]"; peer_ = & target; @@ -204,7 +204,7 @@ prefix_ void senf::ppi::connector::Connector::disconnect() peer.v_disconnected(); } -prefix_ std::type_info const & senf::ppi::connector::Connector::packetTypeID() +prefix_ std::type_info const & senf::ppi::connector::Connector::v_packetTypeId() { return typeid(void); } diff --git a/senf/PPI/Connectors.hh b/senf/PPI/Connectors.hh index bbe8eb5..37a563a 100644 --- a/senf/PPI/Connectors.hh +++ b/senf/PPI/Connectors.hh @@ -196,7 +196,7 @@ namespace connector { virtual void v_connected(); private: - virtual std::type_info const & packetTypeID(); + virtual std::type_info const & v_packetTypeId(); void setModule(module::Module & module); @@ -593,7 +593,7 @@ namespace connector { using mixin::operator(); \ using mixin::TypedConnector_ ## dir ; \ private: \ - virtual std::type_info const & packetTypeID() \ + virtual std::type_info const & v_packetTypeId() \ { return typeid(typename PacketType::type); } \ friend class detail::Typed ## dir ## Mixin, PacketType>; \ }; \ diff --git a/senf/Packets/PacketInterpreter.cc b/senf/Packets/PacketInterpreter.cc index 3466177..1841b46 100644 --- a/senf/Packets/PacketInterpreter.cc +++ b/senf/Packets/PacketInterpreter.cc @@ -42,9 +42,6 @@ // structors and default members -prefix_ senf::PacketInterpreterBase::~PacketInterpreterBase() -{} - prefix_ senf::PacketInterpreterBase::ptr senf::PacketInterpreterBase::clone() { detail::PacketImpl::Guard p (new detail::PacketImpl(begin(),end())); diff --git a/senf/Packets/PacketInterpreter.cci b/senf/Packets/PacketInterpreter.cci index b398ec8..60f27e7 100644 --- a/senf/Packets/PacketInterpreter.cci +++ b/senf/Packets/PacketInterpreter.cci @@ -30,7 +30,6 @@ // Custom includes #include -#include #define prefix_ inline //-///////////////////////////////////////////////////////////////////////////////////////////////// @@ -40,6 +39,9 @@ // Structors and default members +prefix_ senf::PacketInterpreterBase::~PacketInterpreterBase() +{} + prefix_ senf::PacketInterpreterBase::factory_t senf::PacketInterpreterBase::no_factory() { return 0; diff --git a/senf/Packets/PacketParser.ct b/senf/Packets/PacketParser.ct index 72c6e18..b038b79 100644 --- a/senf/Packets/PacketParser.ct +++ b/senf/Packets/PacketParser.ct @@ -62,7 +62,7 @@ prefix_ Parser senf::operator<<(Parser target, Parser source) // Why is this function reported as not inlineable ? template -prefix_ senf::PacketParserBase::size_type senf::detail::packetParserSize(Parser p, ...) +prefix_ senf::PacketParserBase::size_type senf::detail::packetParserSize(Parser const & p, ...) { return Parser::fixed_bytes; } diff --git a/senf/Packets/PacketParser.cti b/senf/Packets/PacketParser.cti index 4788e55..c1a27bd 100644 --- a/senf/Packets/PacketParser.cti +++ b/senf/Packets/PacketParser.cti @@ -70,7 +70,7 @@ prefix_ Parser senf::PacketParserBase::parse(Arg const & arg, size_type n) // namespace members template -prefix_ senf::PacketParserBase::size_type senf::bytes(Parser p) +prefix_ senf::PacketParserBase::size_type senf::bytes(Parser const & p) { return detail::packetParserSize(p,0); } @@ -111,7 +111,7 @@ prefix_ Parser senf::operator<<(Parser target, Value const & value) template prefix_ senf::PacketParserBase::size_type -senf::detail::packetParserSize(Parser p, int, senf::mpl::take_uint *) +senf::detail::packetParserSize(Parser const & p, int, senf::mpl::take_uint *) { return p.bytes(); } diff --git a/senf/Packets/PacketParser.hh b/senf/Packets/PacketParser.hh index a242574..fb41642 100644 --- a/senf/Packets/PacketParser.hh +++ b/senf/Packets/PacketParser.hh @@ -406,7 +406,7 @@ namespace senf { \ingroup packetparser */ template - PacketParserBase::size_type bytes(Parser p); + PacketParserBase::size_type bytes(Parser const & p); namespace detail { template class ParserInitBytes; } namespace detail { template class ParserIsFixed; } diff --git a/senf/Packets/PacketParser.ih b/senf/Packets/PacketParser.ih index 6b18c24..0f98f2e 100644 --- a/senf/Packets/PacketParser.ih +++ b/senf/Packets/PacketParser.ih @@ -48,12 +48,12 @@ namespace detail { // set. template PacketParserBase::size_type packetParserSize( - Parser p, int, senf::mpl::take_uint * = 0); + Parser const & p, int, senf::mpl::take_uint * = 0); // An ellipsis is always the worst match. A call 'packetParserSize(p,0) will prefer above // overload if that is not disabled by SFINAE. template - PacketParserBase::size_type packetParserSize(Parser p, ...); + PacketParserBase::size_type packetParserSize(Parser const & p, ...); // Same as above: This overload is only enabled, if Parser has an integer values 'init_bytes' // member. diff --git a/senf/Utils/intrusive_refcount.cc b/senf/Utils/intrusive_refcount.cc deleted file mode 100644 index 9788ba7..0000000 --- a/senf/Utils/intrusive_refcount.cc +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ -// -// Copyright (C) 2008 -// Fraunhofer Institute for Open Communication Systems (FOKUS) -// -// 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 -// -// 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. -// -// 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 - -/** \file - \brief intrusive_refcount non-inline non-template implementation */ - -#include "intrusive_refcount.hh" -//#include "intrusive_refcount.ih" - -// Custom includes - -//#include "intrusive_refcount.mpp" -#define prefix_ -//-///////////////////////////////////////////////////////////////////////////////////////////////// - -prefix_ senf::intrusive_refcount_base::~intrusive_refcount_base() -{} - -//-///////////////////////////////////////////////////////////////////////////////////////////////// -#undef prefix_ -//#include "intrusive_refcount.mpp" - - -// 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: diff --git a/senf/Utils/intrusive_refcount.cci b/senf/Utils/intrusive_refcount.cci index 722a38e..575f163 100644 --- a/senf/Utils/intrusive_refcount.cci +++ b/senf/Utils/intrusive_refcount.cci @@ -36,6 +36,9 @@ #define prefix_ inline //-///////////////////////////////////////////////////////////////////////////////////////////////// +prefix_ senf::intrusive_refcount_base::~intrusive_refcount_base() +{} + prefix_ senf::intrusive_refcount_base::refcount_t senf::intrusive_refcount_base::refcount() const {