5 #ifndef MERCATOR_BUFFER_H 6 #define MERCATOR_BUFFER_H 11 template<
typename DataType>
26 explicit Buffer(
unsigned int size,
unsigned int channels);
34 DataType &
operator()(
unsigned int x,
unsigned int y,
unsigned int channel) {
35 return m_data[(y * m_size + x) * m_channels + channel];
45 unsigned int channel)
const {
46 return m_data[(y * m_size + x) * m_channels + channel];
75 m_data =
new DataType[m_size * m_size *
m_channels];
82 return (m_data !=
nullptr);
97 #endif // MERCATOR_BUFFER_H const DataType & operator()(unsigned int x, unsigned int y, unsigned int channel) const
Retrieve the data value at a given point.
Definition: Buffer.h:43
DataType * m_data
Pointer to buffer containing data values.
Definition: Buffer.h:19
DataType * getData()
Accessor for a pointer to buffer containing data values.
Definition: Buffer.h:61
void invalidate()
De-allocate the storage for this buffer.
Definition: Buffer.h:88
Template for managing buffers of data for a segment.
Definition: Buffer.h:12
const unsigned int m_size
The size of segment, m_res + 1.
Definition: Buffer.h:17
const unsigned int m_channels
The number of data values per height point.
Definition: Buffer.h:15
void allocate()
Allocate the storage required by the buffer.
Definition: Buffer.h:74
bool isValid() const
Determine if this buffer has valid allocated storage.
Definition: Buffer.h:81
unsigned int getSize() const
Accessor for the size of segment, m_res + 1.
Definition: Buffer.h:51
const DataType * getData() const
Accessor for a pointer to buffer containing data values.
Definition: Buffer.h:66
DataType & operator()(unsigned int x, unsigned int y, unsigned int channel)
Retrieve the data value at a given point.
Definition: Buffer.h:34
Buffer(unsigned int size, unsigned int channels)
Constructor.
Definition: Buffer_impl.h:10
unsigned int getChannels() const
Accessor for the number of data values per height point.
Definition: Buffer.h:56