source: trunk/src/matlab/rpLibChildrenByType.cc @ 135

Last change on this file since 135 was 135, checked in by dkearney, 18 years ago

1) fixed children function in c++'s library module so users can now
search for children by type.
2) adjusted bindings dictionary module for storing lib's to allow caller
to set the key of the value being stored.
3) removed old targets for rappture_interface.o and rappture_fortran.o
from makefile
4) renamed matlab and octave binding functions names to match the module
they came from.
5) adjusted matlab/octave example in examples/app_fermi/matlab
6) added matlab and octave search paths environment variables to
gui/apps/rappture

File size: 1.8 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    nodeHandle = rpLibChildrenByType(libHandle,path,prevNodeHandle,type)
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
18void mexFunction(int nlhs, mxArray *plhs[],
19                 int nrhs, const mxArray *prhs[])
20{
21    int         libIndex = 0;
22    int         childIndex = 0;
23    int         retLibIndex = 0;
24    RpLibrary*  lib = NULL;
25    RpLibrary*  child = NULL;
26    RpLibrary*  retLib = NULL;
27    char*       path = NULL;
28    char*       type = NULL;
29
30    /* Check for proper number of arguments. */
31    if (nrhs != 4)
32        mexErrMsgTxt("Four input required.");
33    else if (nlhs > 1)
34        mexErrMsgTxt("Too many output arguments.");
35
36    libIndex = getIntInput(prhs[0]);
37    path = getStringInput(prhs[1]);
38    childIndex = getIntInput(prhs[2]);
39    type = getStringInput(prhs[3]);
40
41    /* Call the C subroutine. */
42    if ( (libIndex > 0) && (path) && (type) ) {
43        lib = getObject_Lib(libIndex);
44
45        if (childIndex > 0) {
46            child = getObject_Lib(childIndex);
47        }
48
49        if (lib) {
50            retLib = rpChildrenByType(lib,path,child,type);
51            retLibIndex = storeObject_Lib(retLib);
52        }
53    }
54
55    /* Set double scalar node handle to MATLAB mexFunction output*/
56    plhs[0] = mxCreateDoubleScalar(retLibIndex);
57
58    return;
59}
Note: See TracBrowser for help on using the repository browser.