X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FPacketRegistry.ct;h=81e9983d6f1c9d9a5dfcb2f2a76aa2d0ed4ba18f;hb=731487d5f44eaa8c07a21de1dfa00cea2150c80e;hp=6c594b9bcdc481b19cc391d9ae4705cc2f8e452f;hpb=1342c5d49ca8bd523c9fdf7d89b40448cdfd394b;p=senf.git diff --git a/senf/Packets/PacketRegistry.ct b/senf/Packets/PacketRegistry.ct index 6c594b9..81e9983 100644 --- a/senf/Packets/PacketRegistry.ct +++ b/senf/Packets/PacketRegistry.ct @@ -106,7 +106,7 @@ template template prefix_ void senf::detail::PacketRegistryImpl::unregisterPacket() { - registry_.template get().erase(typeid(PacketType)); + registryByType_.erase(typeid(PacketType)); } template @@ -133,10 +133,8 @@ template prefix_ boost::optional::key_t> senf::detail::PacketRegistryImpl::key(senf::TypeIdValue const & type, bool) { - typedef typename Registry::template index::type TypeIndex; - TypeIndex const & typeIndex (registry_.template get()); - typename TypeIndex::const_iterator i (typeIndex.find(type.id())); - if (i == typeIndex.end()) + typename RegistryByType::const_iterator i (registryByType_.find(type.id())); + if (i == registryByType_.end()) return boost::optional(); return (*i)->key; } @@ -144,6 +142,7 @@ senf::detail::PacketRegistryImpl::key(senf::TypeIdValue const & type, b template prefix_ typename senf::detail::PacketRegistryImpl::Entry const & senf::detail::PacketRegistryImpl::lookup(key_t key) + const { Entry const * e (lookup(key, true)); if (!e) @@ -154,11 +153,10 @@ senf::detail::PacketRegistryImpl::lookup(key_t key) template prefix_ typename senf::detail::PacketRegistryImpl::Entry const * senf::detail::PacketRegistryImpl::lookup(key_t key, bool) + const { - typedef typename Registry::template index::type KeyIndex; - KeyIndex const & keyIndex (registry_.template get()); - typename KeyIndex::const_iterator i (keyIndex.lower_bound(key)); - if (i == keyIndex.end() || (*i)->key != key) + typename RegistryByKey::const_iterator i (registryByKey_.lower_bound(key)); + if (i == registryByKey_.end() || (*i)->key != key) return 0; return i->get(); } @@ -174,10 +172,7 @@ template prefix_ void senf::detail::PacketRegistryImpl::v_dump(std::ostream & os) const { - typedef typename Registry::template index::type KeyIndex; - KeyIndex const & keyIndex (registry_.template get()); - for (typename KeyIndex::iterator i (keyIndex.begin()), i_end (keyIndex.end()); - i != i_end; ++i) { + for (typename RegistryByKey::const_iterator i (registryByKey_.begin()), i_end (registryByKey_.end()); i != i_end; ++i) { std::string n ((*i)->name()); senf::detail::DumpKey::dump((*i)->key, os); os << ' ' << std::setw(6) << (*i)->priority << ' ' << n.substr(21,n.size()-22) << '\n';