4 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5 * See included license file for license details.
13 * \brief Manages a binary object of arbitrary length.
15 * The data block is allocated with malloc() instead of the new
16 * operator so that we can use realloc() to resize it.
21 //! \brief Default constructor.
24 //! \brief Constructor.
25 Blob(const uint8_t * data, unsigned length);
27 //! \brief Copy constructor.
28 Blob(const Blob & other);
30 //! \brief Destructor.
35 //! \brief Replaces the blob's data.
36 void setData(const uint8_t * data, unsigned length);
38 //! \brief Change the size of the blob's data.
39 void setLength(unsigned length);
41 //! \brief Adds data to the end of the blob.
42 void append(const uint8_t * newData, unsigned newDataLength);
44 //! \brief Disposes of the data.
47 //! \brief Tell the blob that it no longer owns its data.
53 uint8_t * getData() { return m_data; }
54 const uint8_t * getData() const { return m_data; }
55 unsigned getLength() const { return m_length; }
60 operator uint8_t * () { return m_data; }
61 operator const uint8_t * () const { return m_data; }
65 uint8_t * m_data; //!< The binary data held by this object.
66 unsigned m_length; //!< Number of bytes pointed to by #m_data.