X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacket.hh;h=ac77eedd960592819d9eaf2ab6af386c53809a19;hb=a4ebeef29f8eb69dc2dad10668d762540002b924;hp=e2e3c3fb19fc31869185e086488f249e3f38935d;hpb=51b10105e78a9ffee631223f50e63aa28bb5d2b4;p=senf.git diff --git a/Packets/Packet.hh b/Packets/Packet.hh index e2e3c3f..ac77eed 100644 --- a/Packets/Packet.hh +++ b/Packets/Packet.hh @@ -339,7 +339,8 @@ namespace senf { If an annotation is \e not a POD type (more specifically, if it's constructor or destructor is not - trivial), the \a Annotation type \e must inherit from + trivial including base classes and members), the \a + Annotation type \e must inherit from senf::ComplexAnnotation. Failing to follow this rule will result in undefined behavior and will probably lead to a program crash. @@ -349,6 +350,9 @@ namespace senf { std::string value; }; \endcode + (This type is not POD since \c std::string is not POD) + + \see \ref packet_usage_annotation \implementation The annotation system is implemented quite efficiently since annotations are stored @@ -358,6 +362,16 @@ namespace senf { used). Additionally, non-complex small annotations require no additional memory management (\c new / \c delete). + + \idea Pool the annotation vectors: In the destructor + swap the vector into a vector graveyard (swapping + two vectors is an O(1) no allocation operation). In + the constructor, if there is a vector in the + graveyard, swap it in from there. Of course, it + would be better to do away with the vector and just + allocate the space together with the packet but + that looks quite complicated to do ... especially + considering that the packetimpl itself uses a pool. */ ///@}