|
|
| 158 |
template <typename T> |
158 |
template <typename T> |
| 159 |
uint32_t RemoveTrailer (T &trailer); |
159 |
uint32_t RemoveTrailer (T &trailer); |
| 160 |
/** |
160 |
/** |
|
|
161 |
* \param tag a pointer to the tag to attach to this packet. |
| 162 |
* |
| 161 |
* Attach a tag to this packet. The tag is fully copied |
163 |
* Attach a tag to this packet. The tag is fully copied |
| 162 |
* in a packet-specific internal buffer. This operation |
164 |
* in a packet-specific internal buffer. This operation |
| 163 |
* is expected to be really fast. The copy constructor of the |
165 |
* is expected to be really fast. The copy constructor of the |
| 164 |
* tag is invoked to copy it into the tag buffer. |
166 |
* tag is invoked to copy it into the tag buffer. |
| 165 |
* |
167 |
* |
| 166 |
* \param tag a pointer to the tag to attach to this packet. |
168 |
* Note that adding a tag is a const operation which is pretty |
|
|
169 |
* un-intuitive. The rationale is that the content and behavior of |
| 170 |
* a packet is _not_ changed when a tag is added to a packet: any |
| 171 |
* code which was not aware of the new tag is going to work just |
| 172 |
* the same if the new tag is added. The real reason why adding a |
| 173 |
* tag was made a const operation is to allow a trace sink which gets |
| 174 |
* a packet to tag the packet, even if the packet is const (and most |
| 175 |
* trace sources should use const packets because it would be |
| 176 |
* totally evil to allow a trace sink to modify the content of a |
| 177 |
* packet). |
| 178 |
* |
| 167 |
*/ |
179 |
*/ |
| 168 |
template <typename T> |
180 |
template <typename T> |
| 169 |
void AddTag (T const &tag); |
181 |
void AddTag (T const &tag) const; |
| 170 |
/** |
182 |
/** |
| 171 |
* Remove a tag from this packet. The data stored internally |
183 |
* Remove a tag from this packet. The data stored internally |
| 172 |
* for this tag is copied in the input tag if an instance |
184 |
* for this tag is copied in the input tag if an instance |
|
Lines 450-456
Packet::RemoveTrailer (T &trailer)
|
Link Here
|
|---|
|
| 450 |
|
462 |
|
| 451 |
|
463 |
|
| 452 |
template <typename T> |
464 |
template <typename T> |
| 453 |
void Packet::AddTag (T const& tag) |
465 |
void Packet::AddTag (T const& tag) const |
| 454 |
{ |
466 |
{ |
| 455 |
const Tag *parent; |
467 |
const Tag *parent; |
| 456 |
// if the following assignment fails, it is because the |
468 |
// if the following assignment fails, it is because the |