source: branches/uq/lang/matlab/rpLibChildren.cc @ 6036

Last change on this file since 6036 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: 2.5 KB
RevLine 
[97]1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
[154]5 *    [nodeHandle,err] = rpLibChildren(libHandle,path,prevNodeHandle)
[97]6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
[3177]9 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
[115]10 *
11 *  See the file "license.terms" for information on usage and
12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
[97]13 * ======================================================================
14 */
15
16#include "RpMatlabInterface.h"
17
[154]18/**********************************************************************/
19// METHOD: [nodeHandle,err] = rpLibChildren(libHandle,path,prevNodeHandle)
20/// Retrieve the children of the node described by 'path'
21/**
22 * This method searches the Rappture Library Object 'libHandle' for the
23 * node at the location described by the path 'path' and returns its
24 * children. If 'prevNodeHandle' = 0, then the`
25 * first child is returned, else, the next child is retrieved.
26 * If 'prevNodeHandle' is an invalid child handle, an error will be returned.
27 * Subsequent calls to rpLibChildren() should use previously`
28 * returned 'nodeHandle's for it 'prevNodeHandle' argument.
29 * Error code, err=0 on success, anything else is failure.
30 */
31
32
[97]33void mexFunction(int nlhs, mxArray *plhs[],
34                 int nrhs, const mxArray *prhs[])
35{
36    int         libIndex = 0;
37    int         childIndex = 0;
38    int         retLibIndex = 0;
[154]39    int         err = 1;
[97]40    RpLibrary*  lib = NULL;
41    RpLibrary*  child = NULL;
42    RpLibrary*  retLib = NULL;
[162]43    std::string  path = "";
[97]44
45    /* Check for proper number of arguments. */
[162]46    if (nrhs != 3) {
[118]47        mexErrMsgTxt("Three input required.");
[162]48    }
[97]49
50    libIndex = getIntInput(prhs[0]);
51    path = getStringInput(prhs[1]);
52    childIndex = getIntInput(prhs[2]);
53
[162]54    /* Call the C++ subroutine. */
[155]55    if ( (libIndex > 0)     &&
[162]56         (!path.empty())      &&
[155]57         (childIndex >= 0)      ) {
[162]58
[1085]59        lib = (RpLibrary*) getObject_Void(libIndex);
[97]60
61        if (childIndex > 0) {
[1085]62            child = (RpLibrary*) getObject_Void(childIndex);
[97]63        }
64
65        if (lib) {
[162]66            retLib = lib->children(path,child);
[1085]67            retLibIndex = storeObject_Void((void*)retLib);
[154]68            if (retLibIndex) {
69                err = 0;
70            }
[97]71        }
72    }
73
74    /* Set double scalar node handle to MATLAB mexFunction output*/
75    plhs[0] = mxCreateDoubleScalar(retLibIndex);
[154]76    plhs[1] = mxCreateDoubleScalar(err);
[97]77
78    return;
79}
Note: See TracBrowser for help on using the repository browser.