source: trunk/src/matlab/rpLib.cc @ 827

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

changed matlab api to call c++ functions instead of rappture's c api
removed following functions because they are outdated and should not be included at matlab/octave's release
src/octave/rpLibPutDoubleId.cc
src/octave/rpLibPutStringId.cc
src/matlab/rpLibPutDoubleId.cc
src/matlab/rpLibPutStringId.cc
cleaned up makefile to reflect the removal of above functions.
matlab bindings need to be retested. they receive a runtime error about undefined symbols

File size: 1.7 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-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/**********************************************************************/
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    if (!path.empty()) {
43        lib = new RpLibrary(path);
44        if (lib) {
45            // store the library and return a dictionary key
46            libIndex = storeObject_Lib(lib);
47            if (libIndex) {
48                err = 0;
49            }
50        }
51    }
52
53    /* Set C-style string output_buf to MATLAB mexFunction output*/
54    plhs[0] = mxCreateDoubleScalar(libIndex);
55    plhs[1] = mxCreateDoubleScalar(err);
56
57    return;
58}
Note: See TracBrowser for help on using the repository browser.