X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacketImpl.cti;h=1f2d79a74a8394f8e7e694697a7987e663fea3ad;hb=92f8630b75f3ef50e73c48cde58645dcd1534e27;hp=ca0caee54a98e79a2b5df079fd41a1101a9ca947;hpb=f73fa16ed5abdce272ac77f8b8b9ef2b9922c266;p=senf.git diff --git a/Packets/PacketImpl.cti b/Packets/PacketImpl.cti index ca0caee..1f2d79a 100644 --- a/Packets/PacketImpl.cti +++ b/Packets/PacketImpl.cti @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -31,6 +31,39 @@ ///////////////////////////////cti.p/////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// +// senf::detail::AnnotationIndexer + +template +prefix_ senf::detail::AnnotationIndexer::AnnotationIndexer() + : index_ (maxAnnotations++) +{ + small().push_back(Small); +} + +template +prefix_ unsigned senf::detail::AnnotationIndexer::index() +{ + return AnnotationIndexer::instance().index_; +} + +/////////////////////////////////////////////////////////////////////////// +// senf::detail::GetAnnotation + +template +prefix_ Annotation & senf::detail::GetAnnotation::get(AnnotationEntry & e) +{ + if (!e.p) + e.p = new TAnnotationP(); + return static_cast< TAnnotationP* >(e.p)->annotation; +} + +template +prefix_ Annotation & senf::detail::GetAnnotation::get(AnnotationEntry & e) +{ + return * static_cast(static_cast(& e.i)); +} + +/////////////////////////////////////////////////////////////////////////// // senf::detail::PacketImpl // Data container @@ -46,9 +79,18 @@ prefix_ void senf::detail::PacketImpl::insert(PacketData * self, iterator pos, F template prefix_ senf::detail::PacketImpl::PacketImpl(InputIterator first, InputIterator last) - : refcount_(0), data_(first,last) + : refcount_(0), data_(first,last), annotations_(AnnotationIndexerBase::maxAnnotations) {} +// Annotations + +template +prefix_ Annotation & senf::detail::PacketImpl::annotation() +{ + return GetAnnotation::get( + annotations_[AnnotationIndexer::index()]); +} + ///////////////////////////////cti.e/////////////////////////////////////// #undef prefix_