SM_ADC  1.0
Приём данных АЦП через разделяемую память
Static Public Member Functions | Static Public Attributes | List of all members
BaseFunction Class Reference

#include <basefunction.h>

Inheritance diagram for BaseFunction:
Function

Static Public Member Functions

static void initializeInputPortSizes ()
 
static void initializeOutputPortSizes ()
 
static void outputs ()
 
static double getInputDouble (int port)
 
static double getInputInt (int port)
 
static Array getInputArray (int port)
 
static string getInputString (int port)
 
static int getInputWidth (int port)
 
static int getInputNRows (int port)
 
static int getInputNCols (int port)
 
static void setOutputDouble (int port, double value)
 
static void setOutputArray (int port, Array &array)
 
static Array getOutputArray (int port)
 
static int getOutputWidth (int port)
 
static int getOutputNRows (int port)
 
static int getOutputNCols (int port)
 
static void setOutputPortDimensions (int port, int nrows, int ncols)
 

Static Public Attributes

static int nrhs =0
 
static const mxArray ** prhs =NULL
 
static int nlhs =0
 
static vector< mxArray * > plhs
 

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 MEX function.

Definition at line 39 of file basefunction.h.

Member Function Documentation

◆ getInputArray()

static Array BaseFunction::getInputArray ( int  port)
inlinestatic

Returns the input port Array.

Definition at line 152 of file basefunction.h.

References prhs, and toString().

Referenced by Function::outputs().

◆ getInputDouble()

static double BaseFunction::getInputDouble ( int  port)
inlinestatic

Returns the scalar value of an input port.

Definition at line 136 of file basefunction.h.

References prhs.

Referenced by getInputInt(), and Function::outputs().

◆ getInputInt()

static double BaseFunction::getInputInt ( int  port)
inlinestatic

Returns the integer value of an input port

Definition at line 144 of file basefunction.h.

References getInputDouble().

◆ getInputNCols()

static int BaseFunction::getInputNCols ( int  port)
inlinestatic

Returns the input port number of cols.

Definition at line 188 of file basefunction.h.

References prhs.

Referenced by getInputWidth(), and Function::outputs().

◆ getInputNRows()

static int BaseFunction::getInputNRows ( int  port)
inlinestatic

Returns the input port number of rows.

Definition at line 180 of file basefunction.h.

References prhs.

Referenced by getInputWidth().

◆ getInputString()

static string BaseFunction::getInputString ( int  port)
inlinestatic

Returns the string value of an input port.

Definition at line 160 of file basefunction.h.

References prhs.

Referenced by initializeInputPortSizes().

◆ getInputWidth()

static int BaseFunction::getInputWidth ( int  port)
inlinestatic

Returns the input port number of elements. 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 172 of file basefunction.h.

References getInputNCols(), and getInputNRows().

◆ getOutputArray()

static Array BaseFunction::getOutputArray ( int  port)
inlinestatic

Returns the output port Array.

Definition at line 220 of file basefunction.h.

References plhs, and toString().

Referenced by Function::outputs().

◆ getOutputNCols()

static int BaseFunction::getOutputNCols ( int  port)
inlinestatic

Returns the output port number of cols.

Definition at line 246 of file basefunction.h.

References plhs.

Referenced by getOutputWidth(), and setOutputArray().

◆ getOutputNRows()

static int BaseFunction::getOutputNRows ( int  port)
inlinestatic

Returns the output port number of rows.

Definition at line 238 of file basefunction.h.

References plhs.

Referenced by getOutputWidth(), and setOutputArray().

◆ getOutputWidth()

static int BaseFunction::getOutputWidth ( int  port)
inlinestatic

Returns the output port number of elements. 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 230 of file basefunction.h.

References getOutputNCols(), and getOutputNRows().

◆ initializeInputPortSizes()

static void BaseFunction::initializeInputPortSizes ( )
inlinestatic

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

This method checks the number of input ports, their types dimensions.

The possible types of the inputs are:

  • 1 for real inputs (scalar or array, use -1 as size to specify a dynamically dimensioned array)
  • 2 for literal string inputs
  • 3 for literal identifiers of MATLAB variables

Definition at line 61 of file basefunction.h.

References getInputString(), INPUT_PORT_NUMBER, inputPortCols, inputPortRows, inputPortType, isIdentifier(), nrhs, prhs, and toString().

Referenced by mexFunction().

◆ initializeOutputPortSizes()

static void BaseFunction::initializeOutputPortSizes ( )
inlinestatic

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

This method specifies the number of output ports and their dimensions.

Use -1 to specify dynamically dimensioned output signals.

Definition at line 109 of file basefunction.h.

References nlhs, OUTPUT_PORT_NUMBER, outputPortCols, outputPortRows, plhs, setOutputPortDimensions(), and toString().

Referenced by mexFunction().

◆ 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 outputArray or using writeOutput.

Definition at line 128 of file basefunction.h.

◆ setOutputArray()

static void BaseFunction::setOutputArray ( int  port,
Array array 
)
inlinestatic

Writes an Array to an output port. Dimensions must agree.

Definition at line 206 of file basefunction.h.

References Array::getData(), Array::getName(), Array::getNCols(), Array::getNRows(), getOutputNCols(), getOutputNRows(), Array::getWidth(), plhs, and toString().

◆ setOutputDouble()

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

Writes a double or int value to an output port.

Definition at line 197 of file basefunction.h.

References plhs.

◆ setOutputPortDimensions()

static void BaseFunction::setOutputPortDimensions ( int  port,
int  nrows,
int  ncols 
)
inlinestatic

Sets the output port dimensions. Must be used only in initializeOutputPortSizes

Definition at line 255 of file basefunction.h.

References plhs.

Referenced by initializeOutputPortSizes(), and Function::outputs().

Member Data Documentation

◆ nlhs

int BaseFunction::nlhs =0
static

Definition at line 47 of file basefunction.h.

Referenced by initializeOutputPortSizes(), and mexFunction().

◆ nrhs

int BaseFunction::nrhs =0
static

Definition at line 45 of file basefunction.h.

Referenced by initializeInputPortSizes(), and mexFunction().

◆ plhs

vector< mxArray * > BaseFunction::plhs
static

◆ prhs

const mxArray ** BaseFunction::prhs =NULL
static

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