VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Filters/Matlab/vtkMatlabMexAdapter.h
Go to the documentation of this file.
00001 
00002 /*=========================================================================
00003 
00004   Program:   Visualization Toolkit
00005   Module:    vtkMatlabMexAdapter.h
00006 
00007   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00016 /*-------------------------------------------------------------------------
00017   Copyright 2009 Sandia Corporation.
00018   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00019   the U.S. Government retains certain rights in this software.
00020 -------------------------------------------------------------------------*/
00021 
00051 #ifndef vtkMatlabMexAdapter_h
00052 #define vtkMatlabMexAdapter_h
00053 
00054 #include "mex.h" // Needed for Matlab mex.h mxArray
00055 #include "matrix.h" // Needed for Matlab matrix.h mxArray
00056 #include "vtkObject.h"
00057 #include "vtkFiltersMatlabModule.h"
00058 
00059 class vtkInformation;
00060 class vtkInformationVector;
00061 class vtkDataArray;
00062 class vtkArray;
00063 class vtkGraph;
00064 class vtkDataArrayCollection;
00065 class vtkArrayData;
00066 class vtkDataObjectCollection;
00067 
00068 class VTKFILTERSMATLAB_EXPORT vtkMatlabMexAdapter : public vtkObject
00069 {
00070 
00071 public:
00072 
00073   vtkTypeMacro(vtkMatlabMexAdapter, vtkObject);
00074 
00075   void PrintSelf(ostream& os, vtkIndent indent);
00076 
00077   static vtkMatlabMexAdapter *New();
00078 
00079 //BTX
00081   mxArray* vtkDataArrayToMxArray(vtkDataArray* aa, bool ShallowCopy = false);
00082 
00085   vtkDataArray* mxArrayTovtkDataArray(const mxArray* mxa, bool ShallowCopy = false);
00086 
00088   mxArray* vtkArrayToMxArray(vtkArray* va);
00089 
00091   vtkArray* mxArrayTovtkArray(mxArray* mxa);
00092 
00096   mxArray* vtkGraphToMxArray(vtkGraph* ga);
00097 
00101   vtkGraph* mxArrayTovtkGraph(mxArray* mxa);
00102 
00104   static mxClassID GetMatlabDataType(vtkDataArray* da);
00105 
00107   static vtkDataArray* GetVTKDataType(mxClassID cid);
00108 
00109 //ETX
00110 
00111 protected:
00112 
00113   vtkMatlabMexAdapter();
00114   ~vtkMatlabMexAdapter();
00115 
00116 private:
00117 
00118   vtkMatlabMexAdapter(const vtkMatlabMexAdapter&); // Not implemented
00119   void operator=(const vtkMatlabMexAdapter&); // Not implemented
00120 
00121   template<typename T> vtkArray* CopymxArrayToVTKArray(mxArray* mxa, int ValueType);
00122 
00123   vtkDataArrayCollection* vdac;  // Collection of vtkDataArrays that have been converted from R.
00124   vtkArrayData* vad;  // Collection of vtkArrays that have been converted from R.
00125   vtkDataObjectCollection* vdoc; // Collection of vtkTables that have been converted from R.
00126 
00127 };
00128 
00129 #endif