Functions

matlab_gs_probe.c File Reference

#include <stdio.h>
#include <string.h>
#include <matrix.h>
#include <mex.h>
#include "grpc.h"
#include "matlab_gs.h"
Include dependency graph for matlab_gs_probe.c:

Go to the source code of this file.

Functions

void matlab_gs_probe (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])

Detailed Description

Matlab client call

Definition in file matlab_gs_probe.c.


Function Documentation

void matlab_gs_probe ( int  nlhs,
mxArray *  plhs[],
int  nrhs,
const mxArray *  prhs[] 
)

Return the status of a previous asynchronous request in the prhs array using grpc_probe.

Parameters:
nlhs - Number of left hand side arguments from Matlab
plhs - Pointer to left hand side arguments from Matlab
rlhs - Number of right hand side arguments from Matlab
plhs - Pointer to right hand side arguments from Matlab

Definition at line 30 of file matlab_gs_probe.c.

{
  int i;
  grpc_sessionid_t sessionId;
  grpc_error_t retval;

  if (nrhs != 2 || nlhs != 1) {
    mexErrMsgTxt("Usage: status = gs_probe(sessionId)\n");
    for (i=0;i<nlhs;i++) plhs[i] = mxCreateDoubleMatrix(0,0,mxREAL); 
    return;
  }

  /* reset global error setting */
  matlab_gs_error_num = 0;  
  matlab_gs_minor_errno = 256;   

  /* Init GRPC */
  retval = grpc_initialize(NULL);
  if ((retval != GRPC_NO_ERROR) && (retval != GRPC_ALREADY_INITIALIZED)) 
    DO_ERROR_MACRO(retval);


  /* Get sessionid from rhs */
  sessionId = (int)mxGetPr(prhs[1])[0];
  if (sessionId < 0) DO_ERROR_MACRO(GRPC_OTHER_ERROR_CODE);

  retval = grpc_probe_ft(sessionId);
  if ((retval != GRPC_NO_ERROR) & (retval != GRPC_NOT_COMPLETED)) 
    DO_ERROR_MACRO(retval);

  plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
  mxGetPr(plhs[0])[0] = (double)retval;

  return; 


 error:
  plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
  mxGetPr(plhs[0])[0] = (double)-1;
  mexPrintf("Warning: GridSolve call failed: %d:%d: %s; %s\n", grpc_errno, grpc_minor_errno, grpc_error_string(grpc_errno), grpc_minor_error_string(grpc_minor_errno));  
  return;

}

Here is the call graph for this function:

Here is the caller graph for this function: