Kstars

MeshBuffer.h
1/*
2 SPDX-FileCopyrightText: 2007 James B. Bowlin <bowlin@mindspring.com>
3 SPDX-License-Identifier: BSD-3-Clause AND GPL-2.0-or-later
4*/
5
6#ifndef MESH_BUFFER_H
7#define MESH_BUFFER_H
8
9#include "typedef.h"
10
11class HTMesh;
12
13/** @class MeshBuffer
14 * The sole purpose of a MeshBuffer is to hold storage space
15 * for the results of an HTM inetersection and then allow multiple
16 * MeshIterator's to walk through the result set. The buffer space is allocated
17 * when the MeshBuffer is created. Mesh buffers will usually hang around for
18 * the life of an HTMesh. Each mesh buffer is re-usable. Simply reset() it and
19 * then fill it by append()'ing trixels. A MeshIterator grabs the size() and
20 * the buffer() so it can iterate over the results.
21 */
22
24{
25 public:
26 MeshBuffer(HTMesh *mesh);
27
29
30 /** @short prepare the buffer for a new result set
31 */
32 void reset() { m_size = m_error = 0; }
33
34 /** @short add trixels to the buffer
35 */
36 int append(Trixel trixel);
37
38 /** @short the location of the buffer for reading
39 */
40 const Trixel *buffer() const { return m_buffer; }
41
42 /** @short the number of trixels in the result set
43 */
44 int size() const { return m_size; }
45
46 /** @short returns the number of trixels that would have overflowed the
47 * buffer.
48 */
49 int error() const { return m_error; }
50
51 /** @short fills the buffer with consecutive integers
52 */
53 void fill();
54
55 private:
56 Trixel *m_buffer;
57 int m_size;
58 int maxSize;
59 int m_error;
60};
61
62#endif
HTMesh was originally intended to be a simple interface to the HTM library for the KStars project tha...
Definition HTMesh.h:57
The sole purpose of a MeshBuffer is to hold storage space for the results of an HTM inetersection and...
Definition MeshBuffer.h:24
int error() const
returns the number of trixels that would have overflowed the buffer.
Definition MeshBuffer.h:49
const Trixel * buffer() const
the location of the buffer for reading
Definition MeshBuffer.h:40
int size() const
the number of trixels in the result set
Definition MeshBuffer.h:44
void reset()
prepare the buffer for a new result set
Definition MeshBuffer.h:32
void fill()
fills the buffer with consecutive integers
int append(Trixel trixel)
add trixels to the buffer
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.