source: trunk/src/matlab/rpLibNodeType.cc @ 154

Last change on this file since 154 was 154, checked in by dkearney, 16 years ago

modified matlab bindings and tests.
includes all popular functions available in RpLibrary? and RpUnits
compile and run, but not all tests work as they should
some of these functions will be removed soon because the id field is
no longer a valid argument. path ids should be incorporated in paths from now on.

File size: 1.8 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    [retStr,err] = rpLibNodeType(lib)
6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
9 *  Copyright (c) 2004-2005  Purdue Research Foundation
10 *
11 *  See the file "license.terms" for information on usage and
12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * ======================================================================
14 */
15
16#include "RpMatlabInterface.h"
17
18/**********************************************************************/
19// METHOD: [retStr,err] = rpLibNodeType(nodeHandle)
20/// Return the type name of the node represented by 'nodeHandle'
21/**
22 * This method returns the type name of the node represented`
23 * by 'nodeHandle'.
24 * Error code, err=0 on success, anything else is failure.
25 */
26
27
28void mexFunction(int nlhs, mxArray *plhs[],
29                 int nrhs, const mxArray *prhs[])
30{
31    const char *output_buf;
32    int libIndex = 0;
33    int err = 1;
34    RpLibrary* lib = NULL;
35
36    /* Check for proper number of arguments. */
37    if (nrhs != 1)
38        mexErrMsgTxt("One input required.");
39    else if (nlhs > 2)
40        mexErrMsgTxt("Too many output arguments.");
41
42    // grab the integer value of the library handle
43    libIndex = getIntInput(prhs[0]);
44
45    /* Call the C subroutine. */
46    if (libIndex > 0) {
47        lib = getObject_Lib(libIndex);
48        if (lib) {
49            output_buf = rpNodeType(lib);
50            if (output_buf) {
51                err = 0;
52            }
53        }
54    }
55
56    /* Set C-style string output_buf to MATLAB mexFunction output*/
57    plhs[0] = mxCreateString(output_buf);
58    plhs[1] = mxCreateDoubleScalar(err);
59
60    return;
61}
Note: See TracBrowser for help on using the repository browser.