Particle Identification and Tracking
matlab_apps/include/wrapper_i_matlab.h
Go to the documentation of this file.
00001 //Copyright 2008,2009 Thomas A Caswell
00002 //tcaswell@uchicago.edu
00003 //http://jfi.uchicago.edu/~tcaswell
00004 //
00005 //This program is free software; you can redistribute it and/or modify
00006 //it under the terms of the GNU General Public License as published by
00007 //the Free Software Foundation; either version 3 of the License, or (at
00008 //your option) any later version.
00009 //
00010 //This program is distributed in the hope that it will be useful, but
00011 //WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013 //General Public License for more details.
00014 //
00015 //You should have received a copy of the GNU General Public License
00016 //along with this program; if not, see <http://www.gnu.org/licenses>.
00017 //
00018 //Additional permission under GNU GPL version 3 section 7
00019 //
00020 //If you modify this Program, or any covered work, by linking or
00021 //combining it with MATLAB (or a modified version of that library),
00022 //containing parts covered by the terms of MATLAB User License, the
00023 //licensors of this Program grant you additional permission to convey
00024 //the resulting work.
00025 
00026 
00027 
00028 #ifndef WRAPPER_I_MATLAB
00029 #define WRAPPER_I_MATLAB
00030 
00031 #include <complex>
00032 #include <vector>
00033 
00034 #include "wrapper_i.h"
00035 #include "mex.h"
00036 #include "data_map.h"
00037 
00038 namespace tracking
00039 {
00040 class particle_track;
00041 }
00042 
00043 namespace utilities{
00044 
00045 
00050 class Wrapper_i_matlab:public Wrapper_in{
00051 private:
00053   const mxArray ** mex_array_;
00057   int rows_;
00061   int cols_;
00063   const double * first_;
00064 
00068   int frames_;
00069 
00075   std::vector<unsigned int> frame_offsets_;
00076   
00077   
00078 
00086   std::map<utilities::D_TYPE, int> data_types_;
00090   Data_map data_map_;
00094   void init();
00095 
00099   float get_value(int ind,  utilities::D_TYPE type,int junk)const;
00100   
00104   Tuplef dims_;
00105   
00106 public:
00107   int get_num_entries() const;
00108   
00109 
00110   //  void print(int ind);
00111   void print()const;
00112   
00113   int                 get_value(int& out,
00114                                 int ind,D_TYPE type, int frame) const ;
00115   float               get_value(float& out,
00116                                 int ind,D_TYPE type, int frame) const ;
00117   std::complex<float> get_value(std::complex<float>& out,
00118                                 int ind,D_TYPE type, int frame) const ;
00119   
00120   
00121   int get_num_entries(unsigned int frame) const ;
00122 
00123   int get_num_frames() const ;
00124 
00125   bool contains_type(D_TYPE type) const ;
00126 
00127   Tuplef get_dims() const;
00128 
00129 
00130 
00131   
00132   ~Wrapper_i_matlab();
00133 
00134   Wrapper_i_matlab(const mxArray ** mex_array,std::map<utilities::D_TYPE,int> contents,Tuplef dims);
00135   
00136   //void fill_master_box(tracking::Master_box<tracking::particle_track>& test) const{};
00137   std::set<utilities::D_TYPE> get_data_types() const;
00138   void get_data_types(std::set<utilities::D_TYPE>&) const;
00139 
00140 
00141   
00142   
00143 };
00144 
00145 }
00146 
00147 #endif