KiCad PCB EDA Suite
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 <maciej.suminski@cern.ch>
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 
36 namespace KIGFX
37 {
38 class VERTEX_ITEM;
39 class SHADER;
40 
42 {
43 public:
44  NONCACHED_CONTAINER( unsigned int aSize = defaultInitSize );
45  virtual ~NONCACHED_CONTAINER();
46 
48  virtual void SetItem( VERTEX_ITEM* aItem ) override;
49 
51  virtual VERTEX* Allocate( unsigned int aSize ) override;
52 
54  void Delete( VERTEX_ITEM* aItem ) override {}
55 
57  virtual void Clear() override;
58 
60  virtual inline unsigned int GetSize() const override
61  {
62  // As the m_freePtr points to the first free space, we can safely assume
63  // that this is the number of vertices stored inside
64  return m_freePtr;
65  }
66 
67 protected:
69  unsigned int m_freePtr;
70 };
71 } // namespace KIGFX
72 
73 #endif /* NONCACHED_CONTAINER_H_ */
virtual VERTEX * Allocate(unsigned int aSize) override
Function Allocate() returns allocated space (possibly resizing the used memory chunk or allocating a ...
virtual void SetItem(VERTEX_ITEM *aItem) override
Function SetItem() sets the item in order to modify or finishes its current modifications.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
unsigned int m_freePtr
< Index of the free first space where a vertex can be stored
static const unsigned int defaultInitSize
virtual unsigned int GetSize() const override
Function GetSize() returns amount of vertices currently stored in the container.
NONCACHED_CONTAINER(unsigned int aSize=defaultInitSize)
virtual void Clear() override
Function Clear() removes all the data stored in the container and restores its original state...
Class to store vertices and handle transfers between system memory and GPU memory.
void Delete(VERTEX_ITEM *aItem) override
Function Delete() erases the selected item.