VMTK
vtkvmtkItems.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: VMTK
4  Module: $RCSfile: vtkvmtkItems.h,v $
5  Language: C++
6 
7  Copyright (c) Luca Antiga, David Steinman. All rights reserved.
8  See LICENSE file for details.
9 
10  Portions of this code are covered under the VTK copyright.
11  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
12  for details.
13 
14  This software is distributed WITHOUT ANY WARRANTY; without even
15  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  PURPOSE. See the above copyright notices for more information.
17 
18 =========================================================================*/
28 #ifndef __vtkvmtkItems_h
29 #define __vtkvmtkItems_h
30 
31 #include "vtkObject.h"
32 #include "vtkvmtkItem.h"
33 #include "vtkDataSet.h"
34 //#include "vtkvmtkDifferentialGeometryWin32Header.h"
35 #include "vtkvmtkWin32Header.h"
36 
37 class VTK_VMTK_DIFFERENTIAL_GEOMETRY_EXPORT vtkvmtkItems : public vtkObject
38 {
39 public:
40 
41  vtkTypeMacro(vtkvmtkItems,vtkObject);
42 
43  vtkSetMacro(ItemType,int);
44  vtkGetMacro(ItemType,int);
45 
48  void Allocate(vtkIdType numItems, vtkIdType ext=1000);
49 
50  vtkvmtkItem* GetItem(vtkIdType id) {return this->Array[id];};
51 
52  void SetNumberOfItems(vtkIdType numberOfItems) { this->MaxId = numberOfItems - 1;};
53  vtkIdType GetNumberOfItems() {return this->MaxId + 1;};
54 
56  void Squeeze();
57 
59  void Reset();
60 
62  void Initialize();
63 
65  void ReleaseArray();
66 
67  void AllocateItem(vtkIdType i, vtkIdType itemType);
68 
70  void DeepCopy(vtkvmtkItems *src);
71 
73  void ShallowCopy(vtkvmtkItems *src);
74 
75 protected:
76  vtkvmtkItems():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
77  ~vtkvmtkItems();
78 
79  virtual vtkvmtkItem* InstantiateNewItem(int itemType) = 0;
80 
81  vtkvmtkItem** Array; // pointer to data
82  vtkIdType Size; // allocated size of data
83  vtkIdType MaxId; // maximum index inserted thus far
84  vtkIdType Extend; // grow array by this point
85  vtkvmtkItem** Resize(vtkIdType sz); // function to resize data
86 
87  int ItemType;
88 
89 private:
90  vtkvmtkItems(const vtkvmtkItems&); // Not implemented.
91  void operator=(const vtkvmtkItems&); // Not implemented.
92 };
93 
94 #endif
95 
vtkvmtkItem * GetItem(vtkIdType id)
Definition: vtkvmtkItems.h:50
vtkIdType MaxId
Definition: vtkvmtkItems.h:83
Control allocation and memory footprint of item instances.
Definition: vtkvmtkItems.h:37
vtkIdType Extend
Definition: vtkvmtkItems.h:84
vtkIdType Size
Definition: vtkvmtkItems.h:82
void SetNumberOfItems(vtkIdType numberOfItems)
Definition: vtkvmtkItems.h:52
vtkvmtkItem ** Array
Definition: vtkvmtkItems.h:81
Base class for the construction of neighborhoods and stencil from a set of points.
Definition: vtkvmtkItem.h:35
vtkIdType GetNumberOfItems()
Definition: vtkvmtkItems.h:53