X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacketImpl.cti;h=1f2d79a74a8394f8e7e694697a7987e663fea3ad;hb=c45c112ae88196ea8da9c5a9efb0e167196744d2;hp=9c431f59e3351f17e86616d9c9963ce1b46b9c79;hpb=6116cb96ea7bdcb42b7d12165a05fcbe0687226d;p=senf.git diff --git a/Packets/PacketImpl.cti b/Packets/PacketImpl.cti index 9c431f5..1f2d79a 100644 --- a/Packets/PacketImpl.cti +++ b/Packets/PacketImpl.cti @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// 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_