1 | /* |
---|
2 | * ---------------------------------------------------------------------- |
---|
3 | * INTERFACE: Matlab Rappture Library Source |
---|
4 | * |
---|
5 | * nodeHandle = rpLibChildren(libHandle,path,prevNodeHandle) |
---|
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 | void 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 | |
---|
29 | /* Check for proper number of arguments. */ |
---|
30 | if (nrhs != 3) |
---|
31 | mexErrMsgTxt("Three input required."); |
---|
32 | else if (nlhs > 1) |
---|
33 | mexErrMsgTxt("Too many output arguments."); |
---|
34 | |
---|
35 | libIndex = getIntInput(prhs[0]); |
---|
36 | path = getStringInput(prhs[1]); |
---|
37 | childIndex = getIntInput(prhs[2]); |
---|
38 | |
---|
39 | /* Call the C subroutine. */ |
---|
40 | if ( (libIndex > 0) && (path) ) { |
---|
41 | lib = getObject_Lib(libIndex); |
---|
42 | |
---|
43 | if (childIndex > 0) { |
---|
44 | child = getObject_Lib(childIndex); |
---|
45 | } |
---|
46 | |
---|
47 | if (lib) { |
---|
48 | retLib = rpChildren(lib,path,child); |
---|
49 | retLibIndex = storeObject_Lib(retLib); |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | /* Set double scalar node handle to MATLAB mexFunction output*/ |
---|
54 | plhs[0] = mxCreateDoubleScalar(retLibIndex); |
---|
55 | |
---|
56 | return; |
---|
57 | } |
---|