LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005,2006,2007 INRIA | 3 * Copyright (c) 2005,2006,2007 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 476 |
477 Buffer CreateFullCopy (void) const; | 477 Buffer CreateFullCopy (void) const; |
478 | 478 |
479 /** | 479 /** |
480 * \return the number of bytes required for serialization· | 480 * \return the number of bytes required for serialization· |
481 */ | 481 */ |
482 uint32_t GetSerializedSize (void) const; | 482 uint32_t GetSerializedSize (void) const; |
483 | 483 |
484 /** | 484 /** |
485 * \return zero if buffer not large enough | 485 * \return zero if buffer not large enough |
486 * | |
487 * \param buffer points to serialization buffer | 486 * \param buffer points to serialization buffer |
488 * | |
489 * \param maxSize max number of bytes to write | 487 * \param maxSize max number of bytes to write |
| 488 * |
| 489 * This buffer's contents are serialized into the raw· |
| 490 * character buffer parameter. Note: The zero length· |
| 491 * data is not copied entirely. Only the length of· |
| 492 * zero byte data is serialized. |
490 */ | 493 */ |
491 uint32_t Serialize (uint8_t* buffer, uint32_t maxSize) const; | 494 uint32_t Serialize (uint8_t* buffer, uint32_t maxSize) const; |
492 | 495 |
493 /** | 496 /** |
494 * \return zero if a complete buffer is not deserialized | 497 * \return zero if a complete buffer is not deserialized |
495 * | |
496 * \param buffer points to buffer for deserialization | 498 * \param buffer points to buffer for deserialization |
497 * | |
498 * \param size number of bytes to deserialize | 499 * \param size number of bytes to deserialize |
| 500 * |
| 501 * The raw character buffer is deserialized and all the· |
| 502 * data is placed into this buffer. |
499 */ | 503 */ |
500 uint32_t Deserialize (uint8_t* buffer, uint32_t size); | 504 uint32_t Deserialize (uint8_t* buffer, uint32_t size); |
501 ·· | 505 ·· |
502 int32_t GetCurrentStartOffset (void) const; | 506 int32_t GetCurrentStartOffset (void) const; |
503 int32_t GetCurrentEndOffset (void) const; | 507 int32_t GetCurrentEndOffset (void) const; |
504 | 508 |
505 /**· | 509 /**· |
506 * Copy the specified amount of data from the buffer to the given output strea
m. | 510 * Copy the specified amount of data from the buffer to the given output strea
m. |
507 *· | 511 *· |
508 * @param os the output stream | 512 * @param os the output stream |
509 * @param size the maximum amount of bytes to copy. If zero, nothing is copied
. | 513 * @param size the maximum amount of bytes to copy. If zero, nothing is copied
. |
510 */ | 514 */ |
511 void CopyData (std::ostream *os, uint32_t size) const; | 515 void CopyData (std::ostream *os, uint32_t size) const; |
512 | 516 |
| 517 uint32_t CopyData (uint8_t *buffer, uint32_t size) const; |
| 518 |
513 Buffer (Buffer const &o); | 519 Buffer (Buffer const &o); |
514 Buffer &operator = (Buffer const &o); | 520 Buffer &operator = (Buffer const &o); |
515 Buffer (); | 521 Buffer (); |
516 Buffer (uint32_t dataSize); | 522 Buffer (uint32_t dataSize); |
| 523 Buffer (uint32_t dataSize, bool initialize); |
517 ~Buffer (); | 524 ~Buffer (); |
518 private: | 525 private: |
519 | 526 |
520 void TransformIntoRealBuffer (void) const; | 527 void TransformIntoRealBuffer (void) const; |
521 bool CheckInternalState (void) const; | 528 bool CheckInternalState (void) const; |
522 void Initialize (uint32_t zeroSize); | 529 void Initialize (uint32_t zeroSize); |
523 uint32_t GetInternalSize (void) const; | 530 uint32_t GetInternalSize (void) const; |
524 uint32_t GetInternalEnd (void) const; | 531 uint32_t GetInternalEnd (void) const; |
525 static void Recycle (struct BufferData *data); | 532 static void Recycle (struct BufferData *data); |
526 static struct BufferData *Create (uint32_t size); | 533 static struct BufferData *Create (uint32_t size); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)]; | 630 uint8_t data = m_data[m_current - (m_zeroEnd-m_zeroStart)]; |
624 m_current++; | 631 m_current++; |
625 return data; | 632 return data; |
626 } | 633 } |
627 } | 634 } |
628 | 635 |
629 | 636 |
630 } // namespace ns3 | 637 } // namespace ns3 |
631 | 638 |
632 #endif /* BUFFER_H */ | 639 #endif /* BUFFER_H */ |
LEFT | RIGHT |