Back to index

salome-paravis  6.5.0
vtkMedIntArrayInternal.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // .NAME vtkMedIntArrayInternal - dynamic, self-adjusting array of med_int
00021 // .SECTION Description
00022 // vtkMedIntArray is an array of values of type med_int.
00023 // It provides methods for insertion and retrieval of values and will
00024 // automatically resize itself to hold new data.
00025 
00026 #ifndef __vtkMedIntArrayInternal_h
00027 #define __vtkMedIntArrayInternal_h
00028 
00029 #include "vtkMed.h"
00030 
00031 // Tell the template header how to give our superclass a DLL interface.
00032 #if !defined(__vtkMedIntArrayInternal_cxx)
00033 # define VTK_DATA_ARRAY_TEMPLATE_TYPE med_int
00034 #endif
00035 
00036 #include "vtkDataArray.h"
00037 #include "vtkDataArrayTemplate.h" // Real Superclass
00038 
00039 // Fake the superclass for the wrappers.
00040 #define vtkDataArray vtkDataArrayTemplate<med_int>
00041 class VTK_EXPORT vtkMedIntArrayInternal : public vtkDataArray
00042 #undef vtkDataArray
00043 {
00044 public:
00045   static vtkMedIntArrayInternal* New();
00046   vtkTypeRevisionMacro(vtkMedIntArrayInternal,vtkDataArray);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00049   // Description:
00050   // Get the data type.
00051   // This returns the
00052   int GetDataType()
00053     { if(sizeof(med_int) == sizeof(vtkIdType)) return VTK_ID_TYPE;
00054       if(sizeof(med_int) == sizeof(int)) return VTK_INT;
00055       if(sizeof(med_int) == sizeof(long)) return VTK_LONG;
00056       return VTK_VOID;
00057      }
00058 
00059   // Description:
00060   // Copy the tuple value into a user-provided array.
00061   void GetTupleValue(vtkIdType i, med_int* tuple)
00062     { this->RealSuperclass::GetTupleValue(i, tuple); }
00063 
00064   // Description:
00065   // Set the tuple value at the ith location in the array.
00066   void SetTupleValue(vtkIdType i, const med_int* tuple)
00067     { this->RealSuperclass::SetTupleValue(i, tuple); }
00068 
00069   // Description:
00070   // Insert (memory allocation performed) the tuple into the ith location
00071   // in the array.
00072   void InsertTupleValue(vtkIdType i, const med_int* tuple)
00073     { this->RealSuperclass::InsertTupleValue(i, tuple); }
00074 
00075   // Description:
00076   // Insert (memory allocation performed) the tuple onto the end of the array.
00077   vtkIdType InsertNextTupleValue(const med_int* tuple)
00078     { return this->RealSuperclass::InsertNextTupleValue(tuple); }
00079 
00080   // Description:
00081   // Get the data at a particular index.
00082   med_int GetValue(vtkIdType id)
00083     { return this->RealSuperclass::GetValue(id); }
00084 
00085   // Description:
00086   // Set the data at a particular index. Does not do range checking. Make sure
00087   // you use the method SetNumberOfValues() before inserting data.
00088   void SetValue(vtkIdType id, med_int value)
00089     { this->RealSuperclass::SetValue(id, value); }
00090 
00091   // Description:
00092   // Specify the number of values for this object to hold. Does an
00093   // allocation as well as setting the MaxId ivar. Used in conjunction with
00094   // SetValue() method for fast insertion.
00095   void SetNumberOfValues(vtkIdType number)
00096     { this->RealSuperclass::SetNumberOfValues(number); }
00097 
00098   // Description:
00099   // Insert data at a specified position in the array.
00100   void InsertValue(vtkIdType id, med_int f)
00101     { this->RealSuperclass::InsertValue(id, f); }
00102 
00103   // Description:
00104   // Insert data at the end of the array. Return its location in the array.
00105   vtkIdType InsertNextValue(med_int f)
00106     { return this->RealSuperclass::InsertNextValue(f); }
00107 
00108   // Description:
00109   // Get the address of a particular data index. Make sure data is allocated
00110   // for the number of items requested. Set MaxId according to the number of
00111   // data values requested.
00112   med_int* WritePointer(vtkIdType id, vtkIdType number)
00113     { return this->RealSuperclass::WritePointer(id, number); }
00114 
00115   // Description:
00116   // Get the address of a particular data index. Performs no checks
00117   // to verify that the memory has been allocated etc.
00118   med_int* GetPointer(vtkIdType id)
00119     { return this->RealSuperclass::GetPointer(id); }
00120 
00121   // Description:
00122   // This method lets the user specify data to be held by the array.  The
00123   // array argument is a pointer to the data.  size is the size of
00124   // the array supplied by the user.  Set save to 1 to keep the class
00125   // from deleting the array when it cleans up or reallocates memory.
00126   // The class uses the actual array provided; it does not copy the data
00127   // from the suppled array.
00128   void SetArray(med_int* array, vtkIdType size, int save)
00129     { this->RealSuperclass::SetArray(array, size, save); }
00130   void SetArray(med_int* array, vtkIdType size, int save, int deleteMethod)
00131     { this->RealSuperclass::SetArray(array, size, save, deleteMethod); }
00132 
00133 protected:
00134   vtkMedIntArrayInternal(vtkIdType numComp=1);
00135   ~vtkMedIntArrayInternal();
00136 
00137 private:
00138   //BTX
00139   typedef vtkDataArrayTemplate<med_int> RealSuperclass;
00140   //ETX
00141   vtkMedIntArrayInternal(const vtkMedIntArrayInternal&);  // Not implemented.
00142   void operator=(const vtkMedIntArrayInternal&);  // Not implemented.
00143 };
00144 
00145 #endif