EasyLink
EasyLink is a C++ software development kit for developing blocks for SIMULINK (S-functions)
Static Public Member Functions | List of all members
BaseFunction Class Reference

#include <BaseFunction.h>

Inherited by Function, and Function.

Static Public Member Functions

static void setInputPortsCount (int portsCount)
 
static void setInputPort (int port, int nRows, int nCols, mxClassID type=mxDOUBLE_CLASS, mxComplexity complexFlag=mxREAL)
 
static void initializeInputPortSizes ()
 
static void setOutputPortsCount (int portsCount)
 
static void setOutputPort (int port, int nRows, int nCols, mxClassID type=mxDOUBLE_CLASS, mxComplexity complexFlag=mxREAL)
 
static void initializeOutputPortSizes ()
 
static void outputs ()
 
static double getInputDouble (int port)
 
template<typename _Scalar >
static _Scalar getInputScalar (int port)
 
template<typename _Scalar >
static Array< _Scalar > getInputArray (int port)
 
static std::string getInputString (int port)
 
static void * getInputData (int port)
 
static int getInputWidth (int port)
 
static int getInputNRows (int port)
 
static int getInputNCols (int port)
 
static void setOutputDouble (int port, double value)
 
template<typename _Scalar >
static void setOutputScalar (int port, _Scalar value)
 
template<typename _Scalar >
static Array< _Scalar > getOutputArray (int port)
 
static void * getOutputData (int port)
 
static int getOutputWidth (int port)
 
static int getOutputNRows (int port)
 
static int getOutputNCols (int port)
 

Detailed Description

BaseFunction is the basis class for designing new C++ MEX functions.

Use the file mex_array_product.cpp as a template to write a new function.

Definition at line 21 of file BaseFunction.h.

Member Function Documentation

◆ getInputArray()

template<typename _Scalar >
static Array<_Scalar> BaseFunction::getInputArray ( int  port)
inlinestatic

Returns an array mapping an input port (right-side argument).

Definition at line 143 of file BaseFunction.h.

◆ getInputData()

static void* BaseFunction::getInputData ( int  port)
inlinestatic

Returns a pointer to the first element of the input port data (right-side argument).

Definition at line 164 of file BaseFunction.h.

◆ getInputDouble()

static double BaseFunction::getInputDouble ( int  port)
inlinestatic

Returns the double scalar value of an input port (right-side argument).

Definition at line 123 of file BaseFunction.h.

◆ getInputNCols()

static int BaseFunction::getInputNCols ( int  port)
inlinestatic

Returns the number of cols of an input port (right-side argument).

Definition at line 192 of file BaseFunction.h.

◆ getInputNRows()

static int BaseFunction::getInputNRows ( int  port)
inlinestatic

Returns the number of rows of an input port (right-side argument).

Definition at line 185 of file BaseFunction.h.

◆ getInputScalar()

template<typename _Scalar >
static _Scalar BaseFunction::getInputScalar ( int  port)
inlinestatic

Returns the scalar value of an input port (right-side argument).

Definition at line 133 of file BaseFunction.h.

◆ getInputString()

static std::string BaseFunction::getInputString ( int  port)
inlinestatic

Returns the string value of an input port (right-side argument).

Definition at line 152 of file BaseFunction.h.

◆ getInputWidth()

static int BaseFunction::getInputWidth ( int  port)
inlinestatic

Returns the number of elements of an input port (right-side argument).

If the input port is a 1-D array with w elements, this function returns w.

If the input port is an M-by-N array, this function returns m*n.

Definition at line 178 of file BaseFunction.h.

◆ getOutputArray()

template<typename _Scalar >
static Array<_Scalar> BaseFunction::getOutputArray ( int  port)
inlinestatic

Returns an array mapping an output port (left-side argument).

Definition at line 221 of file BaseFunction.h.

◆ getOutputData()

static void* BaseFunction::getOutputData ( int  port)
inlinestatic

Returns a pointer to the first element of the output port data (left-side argument).

Definition at line 231 of file BaseFunction.h.

◆ getOutputNCols()

static int BaseFunction::getOutputNCols ( int  port)
inlinestatic

Returns the number of cols of an output port (left-side argument).

Definition at line 259 of file BaseFunction.h.

◆ getOutputNRows()

static int BaseFunction::getOutputNRows ( int  port)
inlinestatic

Returns the number of rows of an output port (left-side argument).

Definition at line 252 of file BaseFunction.h.

◆ getOutputWidth()

static int BaseFunction::getOutputWidth ( int  port)
inlinestatic

Returns the number of elements of an output port (left-side argument).

If the output port is a 1-D array with w elements, this function returns w.

If the output port is an M-by-N array, this function returns m*n.

Definition at line 245 of file BaseFunction.h.

◆ initializeInputPortSizes()

static void BaseFunction::initializeInputPortSizes ( )
inlinestatic

This is the first static method that is called within the MEX-Function.

This method must: 1) specify the number of input ports (right-side arguments) 2) specify the dimensions and the type of each intput port

This method must be overridded in your custom function.

Definition at line 72 of file BaseFunction.h.

◆ initializeOutputPortSizes()

static void BaseFunction::initializeOutputPortSizes ( )
inlinestatic

This is the second static method that is called within the MEX-Function.

This method must: 1) specify the number of output ports (left-side arguments) 2) specify the dimensions and the type of each output port

This method must be overridded in your custom function.

Definition at line 106 of file BaseFunction.h.

◆ outputs()

static void BaseFunction::outputs ( )
inlinestatic

This is the third static method that is called within the MEX-Function.

The method have to compute the function's outputs for given inputs and to store the results using getOutput or using writeOutput.

This method must be overridded in your custom function.

Definition at line 117 of file BaseFunction.h.

◆ setInputPort()

static void BaseFunction::setInputPort ( int  port,
int  nRows,
int  nCols,
mxClassID  type = mxDOUBLE_CLASS,
mxComplexity  complexFlag = mxREAL 
)
inlinestatic

This method allows to set the dimensions and the type of an input port (right-side argument).

Use -1 to specify dynamically dimensioned intput arrays.

Definition at line 44 of file BaseFunction.h.

◆ setInputPortsCount()

static void BaseFunction::setInputPortsCount ( int  portsCount)
inlinestatic

This method allows to set the number of input ports (right-side

arguments).

Definition at line 33 of file BaseFunction.h.

◆ setOutputDouble()

static void BaseFunction::setOutputDouble ( int  port,
double  value 
)
inlinestatic

Writes a double value to an output port (left-side argument).

Definition at line 199 of file BaseFunction.h.

◆ setOutputPort()

static void BaseFunction::setOutputPort ( int  port,
int  nRows,
int  nCols,
mxClassID  type = mxDOUBLE_CLASS,
mxComplexity  complexFlag = mxREAL 
)
inlinestatic

This method allows to set the dimensions and the type of an output port (left-side argument).

Definition at line 88 of file BaseFunction.h.

◆ setOutputPortsCount()

static void BaseFunction::setOutputPortsCount ( int  portsCount)
inlinestatic

This method allows to set the number of output ports (left-side arguments).

Definition at line 79 of file BaseFunction.h.

◆ setOutputScalar()

template<typename _Scalar >
static void BaseFunction::setOutputScalar ( int  port,
_Scalar  value 
)
inlinestatic

Writes a scalar value to an output port (left-side argument).

Definition at line 210 of file BaseFunction.h.


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

Copyright (c) 2014 FEMTO-ST / ENSMM / UFC / UTBM, Besançon, France. Generated by Doxygen.