Salome HOME
CMake: replacing CMAKE_* variables by PROJECT_* variabls
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedIntArrayInternal.h
1 // Copyright (C) 2010-2013  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // .NAME vtkMedIntArrayInternal - dynamic, self-adjusting array of med_int
21 // .SECTION Description
22 // vtkMedIntArray is an array of values of type med_int.
23 // It provides methods for insertion and retrieval of values and will
24 // automatically resize itself to hold new data.
25
26 #ifndef __vtkMedIntArrayInternal_h
27 #define __vtkMedIntArrayInternal_h
28
29 #include "vtkMed.h"
30
31 // Tell the template header how to give our superclass a DLL interface.
32 #if !defined(__vtkMedIntArrayInternal_cxx)
33 # define VTK_DATA_ARRAY_TEMPLATE_TYPE med_int
34 #endif
35
36 #include "vtkDataArray.h"
37 #include "vtkDataArrayTemplate.h" // Real Superclass
38
39 // Fake the superclass for the wrappers.
40 #define vtkDataArray vtkDataArrayTemplate<med_int>
41 class VTK_EXPORT vtkMedIntArrayInternal : public vtkDataArray
42 #undef vtkDataArray
43 {
44 public:
45   static vtkMedIntArrayInternal* New();
46   vtkTypeMacro(vtkMedIntArrayInternal,vtkDataArray);
47   void PrintSelf(ostream& os, vtkIndent indent);
48
49   // Description:
50   // Get the data type.
51   // This returns the
52   int GetDataType()
53     { if(sizeof(med_int) == sizeof(vtkIdType)) return VTK_ID_TYPE;
54       if(sizeof(med_int) == sizeof(int)) return VTK_INT;
55       if(sizeof(med_int) == sizeof(long)) return VTK_LONG;
56       return VTK_VOID;
57      }
58
59   // Description:
60   // Copy the tuple value into a user-provided array.
61   void GetTupleValue(vtkIdType i, med_int* tuple)
62     { this->RealSuperclass::GetTupleValue(i, tuple); }
63
64   // Description:
65   // Set the tuple value at the ith location in the array.
66   void SetTupleValue(vtkIdType i, const med_int* tuple)
67     { this->RealSuperclass::SetTupleValue(i, tuple); }
68
69   // Description:
70   // Insert (memory allocation performed) the tuple into the ith location
71   // in the array.
72   void InsertTupleValue(vtkIdType i, const med_int* tuple)
73     { this->RealSuperclass::InsertTupleValue(i, tuple); }
74
75   // Description:
76   // Insert (memory allocation performed) the tuple onto the end of the array.
77   vtkIdType InsertNextTupleValue(const med_int* tuple)
78     { return this->RealSuperclass::InsertNextTupleValue(tuple); }
79
80   // Description:
81   // Get the data at a particular index.
82   med_int GetValue(vtkIdType id)
83     { return this->RealSuperclass::GetValue(id); }
84
85   // Description:
86   // Set the data at a particular index. Does not do range checking. Make sure
87   // you use the method SetNumberOfValues() before inserting data.
88   void SetValue(vtkIdType id, med_int value)
89     { this->RealSuperclass::SetValue(id, value); }
90
91   // Description:
92   // Specify the number of values for this object to hold. Does an
93   // allocation as well as setting the MaxId ivar. Used in conjunction with
94   // SetValue() method for fast insertion.
95   void SetNumberOfValues(vtkIdType number)
96     { this->RealSuperclass::SetNumberOfValues(number); }
97
98   // Description:
99   // Insert data at a specified position in the array.
100   void InsertValue(vtkIdType id, med_int f)
101     { this->RealSuperclass::InsertValue(id, f); }
102
103   // Description:
104   // Insert data at the end of the array. Return its location in the array.
105   vtkIdType InsertNextValue(med_int f)
106     { return this->RealSuperclass::InsertNextValue(f); }
107
108   // Description:
109   // Get the address of a particular data index. Make sure data is allocated
110   // for the number of items requested. Set MaxId according to the number of
111   // data values requested.
112   med_int* WritePointer(vtkIdType id, vtkIdType number)
113     { return this->RealSuperclass::WritePointer(id, number); }
114
115   // Description:
116   // Get the address of a particular data index. Performs no checks
117   // to verify that the memory has been allocated etc.
118   med_int* GetPointer(vtkIdType id)
119     { return this->RealSuperclass::GetPointer(id); }
120
121   // Description:
122   // This method lets the user specify data to be held by the array.  The
123   // array argument is a pointer to the data.  size is the size of
124   // the array supplied by the user.  Set save to 1 to keep the class
125   // from deleting the array when it cleans up or reallocates memory.
126   // The class uses the actual array provided; it does not copy the data
127   // from the suppled array.
128   void SetArray(med_int* array, vtkIdType size, int save)
129     { this->RealSuperclass::SetArray(array, size, save); }
130   void SetArray(med_int* array, vtkIdType size, int save, int deleteMethod)
131     { this->RealSuperclass::SetArray(array, size, save, deleteMethod); }
132
133 protected:
134   vtkMedIntArrayInternal(vtkIdType numComp=1);
135   ~vtkMedIntArrayInternal();
136
137 private:
138   //BTX
139   typedef vtkDataArrayTemplate<med_int> RealSuperclass;
140   //ETX
141   vtkMedIntArrayInternal(const vtkMedIntArrayInternal&);  // Not implemented.
142   void operator=(const vtkMedIntArrayInternal&);  // Not implemented.
143 };
144
145 #endif