source: branches/uq/lang/matlab/rpLib.cc @ 5679

Last change on this file since 5679 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.6 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
5 *    [libHandle,err] = rpLib(fileName)
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: [libHandle,err] = rpLib (fileName)
20/// Opens a Rappture Library Object based on the xml file 'fileName'.
21/**
22 * Usually called in the beginning of a program to load an xml file
23 * for future reading.
24 */
25
26void mexFunction(int nlhs, mxArray *plhs[],
27                 int nrhs, const mxArray *prhs[])
28{
29    std::string path;
30    RpLibrary* lib = NULL;
31    int libIndex = 0;
32    int err = 1;
33
34    /* Check for proper number of arguments. */
35    if (nrhs != 1) {
36        mexErrMsgTxt("One input required.");
37    }
38
39    path = getStringInput(prhs[0]);
40
41    /* Call the C++ subroutine. */
42    lib = new RpLibrary(path);
43    if (lib) {
44        // store the library and return a dictionary key
45        libIndex = storeObject_Void((void*)lib);
46        if (libIndex) {
47            err = 0;
48        }
49    }
50
51    /* Set C-style string output_buf to MATLAB mexFunction output*/
52    plhs[0] = mxCreateDoubleScalar(libIndex);
53    plhs[1] = mxCreateDoubleScalar(err);
54
55    return;
56}
Note: See TracBrowser for help on using the repository browser.