VAMatlabHelpers.h 2.85 KB
Newer Older
1
/*
2
 *  --------------------------------------------------------------------------------------------
3
 *
4 5 6 7 8 9
 *    VVV        VVV A           Virtual Acoustics (VA) | http://www.virtualacoustics.org
 *     VVV      VVV AAA          Licensed under the Apache License, Version 2.0
 *      VVV    VVV   AAA
 *       VVV  VVV     AAA        Copyright 2015-2017
 *        VVVVVV       AAA       Institute of Technical Acoustics (ITA)
 *         VVVV         AAA      RWTH Aachen University
10
 *
11
 *  --------------------------------------------------------------------------------------------
12 13
 */

14 15
#ifndef IW_VA_MATLAB_HELPERS
#define IW_VA_MATLAB_HELPERS
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88

#include <VABaseDefinitions.h>
#include <VAStruct.h>

#include <string>
#include <vector>
#include <mex.h>

// Type checking functions
bool matlabIsScalar(const mxArray *A);
bool matlabIsVector(const mxArray *A);
bool matlabIsRowVector(const mxArray *A);
bool matlabIsColumnVector(const mxArray *A);

/*
 * [fwe] Validating getters
 *
 * These: Are provided a argument name and raise
 * a Matlab error themselves, if validation fails.
 */

// Boolean scalar
// No strict types: Can be provided int/float/double/string value as well {0,1}
bool matlabGetBoolScalar(const mxArray* arg, const char* argname);

// Integer scalar
// No strict types: Can be provided int/float/double value as well, if this is an integer number
int matlabGetIntegerScalar(const mxArray* arg, const char* argname);

// Real-valued scalar
double matlabGetRealScalar(const mxArray* arg, const char* argname);

// Real-valued 3-element vector (row|column)
void matlabGetRealVector3(const mxArray* arg, const char* argname, double& x, double& y, double& z);

// Real-valued quaternion values as 1x4 vector
void matlabGetQuaternion( const mxArray* arg, const char* argname, double& w, double& i, double& j, double& k );

// String
std::string matlabGetString(const mxArray* arg, const char* argname);

CVAStruct matlabGetStruct( const mxArray*, const char* );

/*
 *  Return value creation helpers
 */

// 3-Elemente Vektor erzeugen
mxArray* matlabCreateRealVector3(double x, double y, double z);

// Creates an ID in Matlab
mxArray* matlabCreateID(int iID);

// Creates an list (vector) of IDs in Matlab
mxArray* matlabCreateIDList(const std::vector<int>& viID);

// CVADirectivityInfo in Matlab struct konvertieren
mxArray* matlabCreateDirectivityInfo(const CVADirectivityInfo& di);

// CVAHRIRInfo in Matlab struct konvertieren
mxArray* matlabCreateHRIRInfo(const CVAHRIRInfo& hriri);

// CVASoundInfo in Matlab struct konvertieren
mxArray* matlabCreateSoundInfo(const CVASoundInfo& si);

// CVASignalSourceInfo in Matlab struct konvertieren
mxArray* matlabCreateSignalSourceInfo(const CVASignalSourceInfo& ssi);

// CVASceneInfo in Matlab struct konvertieren
mxArray* matlabCreateSceneInfo(const CVASceneInfo& sci);

mxArray* matlabCreateStruct( const CVAStruct& oStruct );

89
#endif // IW_VA_MATLAB_HELPERS