FastUIDraw
data_buffer_base.hpp
Go to the documentation of this file.
1 /*!
2  * \file data_buffer_base.hpp
3  * \brief file data_buffer_base.hpp
4  *
5  * Copyright 2016 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 #ifndef FASTUIDRAW_DATA_BUFFER_BASE_HPP
20 #define FASTUIDRAW_DATA_BUFFER_BASE_HPP
21 
22 #include <stdint.h>
25 
26 namespace fastuidraw
27 {
28 /*!\addtogroup Utility
29  * @{
30  */
31  /*!
32  * \brief
33  * Base class for passing around buffers of data; derived
34  * classes have the responsibility of maintaining storage
35  * cleanup at destruction.
36  */
37  class DataBufferBase:public reference_counted<DataBufferBase>::concurrent
38  {
39  public:
40  /*!
41  * Ctor.
42  * \param pdata_ro value which data_ro() will return
43  * \param pdata_rw value which data_rw() will return
44  */
46  c_array<uint8_t> pdata_rw):
47  m_data_ro(pdata_ro),
48  m_data_rw(pdata_rw)
49  {}
50 
51  /*!
52  * Return the memory as read-only
53  */
55  data_ro(void) const
56  {
57  return m_data_ro;
58  }
59 
60  /*!
61  * Return the memory as read-write
62  */
64  data_rw(void)
65  {
66  return m_data_rw;
67  }
68 
69  private:
70  c_array<const uint8_t> m_data_ro;
71  c_array<uint8_t> m_data_rw;
72  };
73 
74 /*! @} */
75 } //namespace fastuidraw
76 
77 #endif
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
DataBufferBase(c_array< const uint8_t > pdata_ro, c_array< uint8_t > pdata_rw)
file c_array.hpp
Defines default reference counting base classes.
c_array< uint8_t > data_rw(void)
c_array< const uint8_t > data_ro(void) const
Base class for passing around buffers of data; derived classes have the responsibility of maintaining...
file reference_counted.hpp