X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacketImpl.hh;h=1d1373f0cfe148d8484a069a647e782330b5514e;hb=9348e1098d66ac2684c8e280abf8d7143c887982;hp=871b9ec5948f9b377595a8e54be21b78a523f215;hpb=23ef68f7c443f0993b2b46cd912666c040fdccba;p=senf.git diff --git a/Packets/PacketImpl.hh b/Packets/PacketImpl.hh index 871b9ec..1d1373f 100644 --- a/Packets/PacketImpl.hh +++ b/Packets/PacketImpl.hh @@ -28,9 +28,11 @@ // Custom includes #include +#include #include #include "../Utils/pool_alloc_mixin.hh" #include "PacketTypes.hh" +#include "../Utils/singleton.hh" //#include "PacketImpl.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -38,6 +40,49 @@ namespace senf { namespace detail { + struct AnnotationIndexerBase + { + static unsigned maxAnnotations; + static std::vector & small(); + }; + + template + struct AnnotationIndexer + : public senf::singleton< AnnotationIndexer >, + public AnnotationIndexerBase + { + AnnotationIndexer(); + unsigned index_; + static unsigned index(); + static bool const Small = (sizeof(Annotation) <= sizeof(void*)); + }; + + struct AnnotationP + { + virtual ~AnnotationP(); + }; + + template + struct TAnnotationP + : public AnnotationP + { + Annotation annotation; + }; + + template ::Small> + struct GetAnnotation + { + static Annotation & get(AnnotationP * & p); + }; + +/* + template + struct GetAnnotation + { + static Annotation & get(AnnotationP * & p); + }; +*/ + /** \brief Internal: Packet data storage \internal @@ -103,6 +148,10 @@ namespace detail { void erase(PacketData * self, iterator first, iterator last); void clear(PacketData * self); + // Annotations + template + Annotation & annotation(); + /** \brief Internal: Keep PacketImpl instance alive \internal @@ -121,6 +170,9 @@ namespace detail { refcount_t refcount_; raw_container data_; interpreter_list interpreters_; + + typedef std::vector Annotations; + Annotations annotations_; void eraseInterpreters(interpreter_list::iterator b, interpreter_list::iterator e); void updateIterators(PacketData * self, difference_type pos, difference_type n);