X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FPacketImpl.cci;h=70ac0038b73aa1e0daf71b75fbb1b058ef784991;hb=720400ed1b874ea96481a29f0812145bb2785d40;hp=8c863d1e1972645003375e5e34c809b6f86df11c;hpb=943a6b0973f66bc699c6e7b404da256145e93acf;p=senf.git diff --git a/senf/Packets/PacketImpl.cci b/senf/Packets/PacketImpl.cci index 8c863d1..70ac003 100644 --- a/senf/Packets/PacketImpl.cci +++ b/senf/Packets/PacketImpl.cci @@ -33,7 +33,7 @@ /////////////////////////////////////////////////////////////////////////// // senf::detail::AnnotationRegistry -prefix_ void senf::detail::AnnotationRegistry::dump(key_t key, std::ostream & os, +prefix_ void senf::detail::AnnotationRegistry::dump(key_type key, std::ostream & os, void * annotation) const { @@ -45,27 +45,41 @@ prefix_ void senf::detail::AnnotationRegistry::dump(key_t key, std::ostream & os } } -prefix_ std::string senf::detail::AnnotationRegistry::name(key_t key) +prefix_ std::string senf::detail::AnnotationRegistry::name(key_type key) const { Registry::const_iterator i (registry_.find(key)); return i == registry_.end() ? "" : i->second->v_name(); } -prefix_ bool senf::detail::AnnotationRegistry::isComplex(key_t key) +prefix_ bool senf::detail::AnnotationRegistry::isComplex(key_type key) const { Registry::const_iterator i (registry_.find(key)); return i != registry_.end() && i->second->v_isComplex(); } -prefix_ unsigned senf::detail::AnnotationRegistry::size(key_t key) +prefix_ unsigned senf::detail::AnnotationRegistry::size(key_type key) const { Registry::const_iterator i (registry_.find(key)); return i == registry_.end() ? 0 : i->second->v_size(); } +prefix_ senf::detail::AnnotationRegistry::iterator senf::detail::AnnotationRegistry::begin() + const +{ + return boost::make_transform_iterator(index_.begin(), + __gnu_cxx::select2nd()); +} + +prefix_ senf::detail::AnnotationRegistry::iterator senf::detail::AnnotationRegistry::end() + const +{ + return boost::make_transform_iterator(index_.end(), + __gnu_cxx::select2nd()); +} + prefix_ senf::detail::AnnotationRegistry::AnnotationRegistry() : simpleAnnotationCount_ (0), complexAnnotationCount_ (0) {} @@ -112,9 +126,9 @@ prefix_ senf::detail::PacketImpl::PacketImpl(size_type size, byte initValue) // reference/memory management -prefix_ void senf::detail::PacketImpl::add_ref(refcount_t n) +prefix_ void senf::detail::PacketImpl::add_ref() { - refcount_ += n; + ++ refcount_; } prefix_ senf::detail::PacketImpl::refcount_t senf::detail::PacketImpl::refcount() @@ -217,24 +231,9 @@ prefix_ senf::detail::PacketImpl::size_type senf::detail::PacketImpl::capacity() return data_.capacity(); } -// This function has a problem being inlined. Somehow, often when calling this, the size of the -// resulting inlined code would be huge? - -prefix_ void senf::detail::PacketImpl::release(refcount_t n) -{ - SENF_ASSERT(refcount_ >= n, "Internal failure: Releasing dead PacketImpl ??"); - // uah ... we need to be extremely careful here. If refcount_ is n, we want to commit suicide, - // however the destructor will remove all PacketInterpreters from the list and will thereby - // decrement refcount -> only decrement refcount_ when *not* calling delete - if (refcount_ == n) - delete this; - else - refcount_ -= n; -} - // Annotations -prefix_ void * senf::detail::PacketImpl::annotation(AnnotationRegistry::key_t key) +prefix_ void * senf::detail::PacketImpl::annotation(AnnotationRegistry::key_type key) { return key >= 0 ? & simpleAnnotations_[key] : complexAnnotation(key); }