KiCad PCB EDA Suite
Loading...
Searching...
No Matches
noncached_container.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2013 CERN
5 * @author Maciej Suminski <[email protected]>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
31#ifndef NONCACHED_CONTAINER_H_
32#define NONCACHED_CONTAINER_H_
33
35
36namespace KIGFX
37{
38class VERTEX_ITEM;
39class SHADER;
40
42{
43public:
50 NONCACHED_CONTAINER( unsigned int aSize = DEFAULT_SIZE );
51 virtual ~NONCACHED_CONTAINER();
52
53 bool IsCached() const override
54 {
55 return false;
56 }
57
59 virtual void SetItem( VERTEX_ITEM* aItem ) override;
60
62 virtual VERTEX* Allocate( unsigned int aSize ) override;
63
65 void Delete( VERTEX_ITEM* aItem ) override {}
66
68 virtual void Clear() override;
69
71 virtual unsigned int GetSize() const override
72 {
73 // As the m_freePtr points to the first free space, we can safely assume
74 // that this is the number of vertices stored inside
75 return m_freePtr;
76 }
77
78protected:
80 unsigned int m_freePtr;
81};
82} // namespace KIGFX
83
84#endif /* NONCACHED_CONTAINER_H_ */
bool IsCached() const override
Return true if the container caches vertex data in RAM or video memory.
void Delete(VERTEX_ITEM *aItem) override
Erase the data related to an item.
virtual unsigned int GetSize() const override
Return amount of vertices currently stored in the container.
virtual void SetItem(VERTEX_ITEM *aItem) override
Set the item for the further actions.
virtual VERTEX * Allocate(unsigned int aSize) override
Return allocated space for the requested number of vertices associated with the current item (set wit...
virtual void Clear() override
Remove all data stored in the container and restores its original state.
unsigned int m_freePtr
< Index of the free first space where a vertex can be stored
static constexpr unsigned int DEFAULT_SIZE
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247
Class to store vertices and handle transfers between system memory and GPU memory.