MexParams Class Reference

Manages input and output parameters for mex programs. More...

#include <MexParams.h>


Public Member Functions

 MexParams (const int minOutput, const int maxOutput, const int numOutput, mxArray *plhs[], const int minInput, const int maxInput, const int numInput, const mxArray *prhs[])
 Constructor.
 ~MexParams ()
 Destructor.
void setOutput (const int number, mxArray *out)
 Sets an output variable to a mxArray.
void setScalarOutput (const int number, const double val)
 Sets an output variable to a scalar value.
mxArray * getOutput (const int number)
 Returns one of the assigned output variables.
double getScalarOutput (const int number)
 Returns one of the assigned output variables as a scalar.
const mxArray * getInput (const int number) const
 Returns one of the input variables.
const double getScalarInput (const int number) const
 Returns one of the input variables as a scalar.
int getNumberOutput () const
 Returns the number of outputs.
int getNumberInput () const
 Returns the number of inputs.

Protected Attributes

const int itsNumOutput
mxArray ** itsOutput
const int itsNumInput
const mxArray ** itsInput

Private Member Functions

 MexParams (const MexParams &)


Detailed Description

Manages input and output parameters for mex programs.

This class keeps track of the input and output parameters. It offers routines for accessing input and output variables as mxArray or as double scalars.

Definition at line 22 of file MexParams.h.


Constructor & Destructor Documentation

MexParams::MexParams ( const int  minOutput,
const int  maxOutput,
const int  numOutput,
mxArray *  plhs[],
const int  minInput,
const int  maxInput,
const int  numInput,
const mxArray *  prhs[] 
)

Constructor.

Parameters:
minOutput the minimum number of outputs that need to be provided
maxOutput the maximum number of outputs
numOutput the actual number of outputs: the same as nlhs in mexFunction. The constructor checks is numOutput is between minOutput and maxOutput.
plhs the mxArray field for the output variables
minInput the minimum number of inputs
maxInput the maximum number of inputs
numInput the actual number of inputs: the same as nrhs in mexFunction. The constructor checks is numInput is between minInput and maxInput.
prhs the mxArray field for the input variables

Definition at line 14 of file MexParams.cpp.

References ASSERT, and K_RightInDd.

MexParams::~MexParams (  ) 

Destructor.

Checks if all requested output variables have been assigned.

Definition at line 31 of file MexParams.cpp.

References itsNumOutput, itsOutput, mexError(), and mexFatal().

Here is the call graph for this function:

MexParams::MexParams ( const MexParams  )  [private]


Member Function Documentation

void MexParams::setOutput ( const int  number,
mxArray *  out 
)

Sets an output variable to a mxArray.

Parameters:
number the index of the output, starting from 0. If number is greater than the number of outputs, the function does nothing.
out the value to set the output to.

Definition at line 46 of file MexParams.cpp.

References ASSERT, itsNumOutput, and itsOutput.

Referenced by mexFunction(), and setScalarOutput().

void MexParams::setScalarOutput ( const int  number,
const double  val 
)

Sets an output variable to a scalar value.

Parameters:
number the index of the output, starting from 0. If number is greater than the number of outputs, the function does nothing.
val a scalar value to set the output paramter to.

Definition at line 53 of file MexParams.cpp.

References setOutput().

Referenced by mexFunction().

Here is the call graph for this function:

mxArray * MexParams::getOutput ( const int  number  ) 

Returns one of the assigned output variables.

Parameters:
number the index of the output, starting from 0.

Definition at line 59 of file MexParams.cpp.

References ASSERT, itsNumOutput, and itsOutput.

Referenced by getScalarOutput().

double MexParams::getScalarOutput ( const int  number  ) 

Returns one of the assigned output variables as a scalar.

Parameters:
number the index of the output, starting from 0.

Definition at line 67 of file MexParams.cpp.

References getOutput().

Here is the call graph for this function:

const mxArray * MexParams::getInput ( const int  number  )  const

Returns one of the input variables.

Parameters:
number the index of the inputs, starting from 0.

Definition at line 73 of file MexParams.cpp.

References ASSERT, itsInput, and itsNumInput.

Referenced by getScalarInput(), and mexFunction().

const double MexParams::getScalarInput ( const int  number  )  const

Returns one of the input variables as a scalar.

Parameters:
number the index of the inputs, starting from 0.

Definition at line 81 of file MexParams.cpp.

References getInput().

Referenced by mexFunction().

Here is the call graph for this function:

int MexParams::getNumberOutput (  )  const

Returns the number of outputs.

Definition at line 87 of file MexParams.cpp.

References itsNumOutput.

int MexParams::getNumberInput (  )  const

Returns the number of inputs.

Definition at line 93 of file MexParams.cpp.

References itsNumInput.


Field Documentation

const int MexParams::itsNumOutput [protected]

Definition at line 87 of file MexParams.h.

Referenced by getNumberOutput(), getOutput(), setOutput(), and ~MexParams().

mxArray** MexParams::itsOutput [protected]

Definition at line 88 of file MexParams.h.

Referenced by getOutput(), setOutput(), and ~MexParams().

const int MexParams::itsNumInput [protected]

Definition at line 89 of file MexParams.h.

Referenced by getInput(), and getNumberInput().

const mxArray** MexParams::itsInput [protected]

Definition at line 90 of file MexParams.h.

Referenced by getInput().


The documentation for this class was generated from the following files:

Generated on Mon Aug 4 21:51:02 2008 for SaliencyToolbox by  doxygen 1.5.6