17 #ifndef HH_SENF_Packets_PacketImpl_ 18 #define HH_SENF_Packets_PacketImpl_ 1 21 #include <boost/noncopyable.hpp> 22 #include <boost/static_assert.hpp> 23 #include <boost/ptr_container/ptr_vector.hpp> 24 #include <boost/type_traits/aligned_storage.hpp> 32 #ifndef HH_SENF_Packets_Packets__decls_ 33 #define HH_SENF_Packets_Packets__decls_ 36 #undef HH_SENF_Packets_Packets__decls_ 113 : boost::noncopyable,
130 template <
class InputIterator>
132 PacketImpl(byte * data, size_type size, size_type chunkSize = 0u,
133 size_type offset = 0u);
140 refcount_t refcount()
const;
150 void * allocateInterpreter();
151 void deallocateInterpreter(
void * address);
153 bool usingExternalMemory()
const;
154 void releaseExternalMemory();
156 void memDebug(std::ostream & os);
167 void clearInterpreters();
175 void insert(
PacketData *
self, iterator pos, byte v);
176 void insert(
PacketData *
self, iterator pos, size_type n, byte v);
177 template <
class ForwardIterator>
178 void insert(
PacketData *
self, iterator pos, ForwardIterator f, ForwardIterator l);
181 void erase(
PacketData *
self, iterator first, iterator last);
182 void truncateDataBackwards(
PacketData *
self, iterator pos);
183 iterator truncateRawDataBackwards(iterator pos);
184 void truncateRawDataForward(iterator pos);
188 template <
class Annotation>
189 Annotation & annotation();
191 void clearAnnotations();
192 void assignAnnotations(
PacketImpl const & other);
209 static size_type maxPreallocHigh();
210 static size_type maxPreallocHeapcount();
214 void updateIterators(
PacketData *
self, difference_type pos, difference_type n);
216 void * annotation(AnnotationRegistry::key_type key);
217 #ifndef SENF_PACKET_NO_COMPLEX_ANNOTATIONS 218 void * complexAnnotation(AnnotationRegistry::key_type key);
219 template <
class Annotation>
220 void * complexAnnotation();
223 #ifndef SENF_PACKET_NO_HEAP_INTERPRETERS 227 refcount_t refcount_;
229 interpreter_list interpreters_;
233 typedef boost::aligned_storage<SENF_PACKET_ANNOTATION_SLOTSIZE>::type SimpleAnnotationSlot;
235 #ifndef SENF_PACKET_NO_COMPLEX_ANNOTATIONS 236 typedef boost::ptr_vector< boost::nullable<AnnotationRegistry::EntryBase> >
238 ComplexAnnotations complexAnnotations_;
241 SimpleAnnotationSlot simpleAnnotations_[SENF_PACKET_ANNOTATION_SLOTS];
246 boost::aligned_storage<
250 #ifndef SENF_PACKET_ALTERNATIVE_PREALLOC 253 PreallocSlot * nextFree_;
257 PreallocSlot prealloc_[SENF_PACKET_PREALLOC_INTERPRETERS];
258 #ifdef SENF_PACKET_ALTERNATIVE_PREALLOC 259 size_type preallocHigh_;
261 PreallocSlot * preallocFree_;
262 #ifndef SENF_PACKET_NO_HEAP_INTERPRETERS 263 size_type preallocHeapcount_;
267 static size_type maxPreallocHigh_;
268 #ifndef SENF_PACKET_NO_HEAP_INTERPRETERS 269 static size_type maxPreallocHeapcount_;
281 #if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_PacketImpl_i_) 282 #define HH_SENF_Packets_PacketImpl_i_ Internal: Keep PacketImpl instance alive.
senf::detail::packet::byte byte
senf::detail::packet::difference_type difference_type
void intrusive_ptr_add_ref(PacketInterpreterBase const *p)
Internal: Concrete packet interpreter.
Internal: Base packet interpreter class.
senf::detail::packet::refcount_t refcount_t
senf::detail::packet::iterator iterator
boost::intrusive::list< PacketInterpreterBase, boost::intrusive::constant_time_size< false >, boost::intrusive::base_hook< interpreter_list_base > > interpreter_list
Marker base-class for complex annotations.
raw_container::const_iterator const_iterator
Packet data STL-sequence view.
raw_container::size_type size_type
PacketInterpreter public header.
Internal: Packet data storage.
raw_container::iterator iterator
senf::detail::packet::size_type size_type
senf::detail::packet::raw_container raw_container
senf::detail::packet::interpreter_list interpreter_list
raw_container::difference_type difference_type
void intrusive_ptr_release(PacketInterpreterBase const *p)
void dumpPacketAnnotationRegistry(std::ostream &os)
Dump annotation registry debug information.
senf::detail::packet::const_iterator const_iterator
::phoenix::function< detail::clear > const clear
PacketType public header.