00001 /*************************************************************************** 00002 * Copyright (C) 2010 by Matthias Ihrke * 00003 * ihrke@nld.ds.mpg.de 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 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * aint with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef MEX_UTILS_H 00022 #define MEX_UTILS_H 00023 00024 #include "mex.h" 00025 #include "matrix.h" 00026 #include "array.h" 00027 00028 /* convenience stuff */ 00029 mxArray *create_mex_double( double val ); 00030 mxArray *create_mex_string( const char *str ); 00031 char *get_mex_string( const mxArray *arg ); 00032 double get_mex_double( const mxArray *arg ); 00033 float get_mex_float( const mxArray *arg ); 00034 bool is_mex_scalar( const mxArray *arg ); 00035 bool is_mex_fid( const mxArray *arg ); 00036 int set_mex_field( mxArray *arg, const char *field_name, mxArray *value ); 00037 bool is_mex_matrix( mxArray *arg ); 00038 00039 /* array conversion */ 00040 Array* mex_mxarray_to_array( mxArray * mxa ); 00041 mxArray* mex_array_to_mxarray( Array * a ); 00042 mxArray* mex_int_array_to_mxarray( Array * a ); 00043 00044 #endif