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 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Maciej Suminski <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
32#ifndef NONCACHED_CONTAINER_H_
33#define NONCACHED_CONTAINER_H_
34
36
37namespace KIGFX
38{
39class VERTEX_ITEM;
40class SHADER;
41
43{
44public:
51 NONCACHED_CONTAINER( unsigned int aSize = DEFAULT_SIZE );
52 virtual ~NONCACHED_CONTAINER();
53
54 bool IsCached() const override
55 {
56 return false;
57 }
58
60 virtual void SetItem( VERTEX_ITEM* aItem ) override;
61
63 virtual VERTEX* Allocate( unsigned int aSize ) override;
64
66 void Delete( VERTEX_ITEM* aItem ) override {}
67
69 virtual void Clear() override;
70
72 virtual unsigned int GetSize() const override
73 {
74 // As the m_freePtr points to the first free space, we can safely assume
75 // that this is the number of vertices stored inside
76 return m_freePtr;
77 }
78
79protected:
81 unsigned int m_freePtr;
82};
83} // namespace KIGFX
84
85#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.