source: branches/1.6/lang/matlab/rpLibNodeComp.cc @ 6221

Last change on this file since 6221 was 5679, checked in by ldelgass, 9 years ago

Full merge 1.3 branch to uq branch to sync. Fixed partial subdirectory merge
by removing mergeinfo from lang/python/Rappture directory.

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    [retStr,err] = rpLibNodeComp(nodeHandle)
6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
9 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
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] = rpLibNodeComp(nodeHandle)
20/// Return the component name of the node represented by 'nodeHandle'
21/**
22 * This method returns the component name of the node represented`
23 * by 'nodeHandle'. The component name is a concatination of the``
24 * type, id, and index.
25 * Error code, err=0 on success, anything else is failure.
26 */
27
28void mexFunction(int nlhs, mxArray *plhs[],
29                 int nrhs, const mxArray *prhs[])
30{
31    int libIndex = 0;
32    int err = 1;
33    RpLibrary* lib = NULL;
34    std::string retStr = "";
35
36    /* Check for proper number of arguments. */
37    if (nrhs != 1) {
38        mexErrMsgTxt("One input required.");
39    }
40
41    // grab the integer value of the library handle
42    libIndex = getIntInput(prhs[0]);
43
44    /* Call the C subroutine. */
45    if (libIndex > 0) {
46        lib = (RpLibrary*) getObject_Void(libIndex);
47        if (lib) {
48            retStr = lib->nodeComp();
49            if (!retStr.empty()) {
50                err = 0;
51            }
52        }
53    }
54
55    /* Set C-style string output_buf to MATLAB mexFunction output*/
56    plhs[0] = mxCreateString(retStr.c_str());
57    plhs[1] = mxCreateDoubleScalar(err);
58
59    return;
60}
Note: See TracBrowser for help on using the repository browser.