source: trunk/lang/matlab/rpLib.cc @ 2701

Last change on this file since 2701 was 1085, checked in by dkearney, 16 years ago

adjusting matlab and octave bindings to use the void* bindings dictionary instead of the lib* dictionary in hopes that we can phase out the lib* dictionary.

File size: 1.6 KB
RevLine 
[97]1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Matlab Rappture Library Source
4 *
[154]5 *    [libHandle,err] = rpLib(fileName)
[97]6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
[115]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.
[97]13 * ======================================================================
14 */
15
16#include "RpMatlabInterface.h"
17
[154]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
[97]26void mexFunction(int nlhs, mxArray *plhs[],
27                 int nrhs, const mxArray *prhs[])
28{
[162]29    std::string path;
[97]30    RpLibrary* lib = NULL;
31    int libIndex = 0;
[154]32    int err = 1;
[97]33
34    /* Check for proper number of arguments. */
[162]35    if (nrhs != 1) {
[97]36        mexErrMsgTxt("One input required.");
[162]37    }
[97]38
39    path = getStringInput(prhs[0]);
40
[162]41    /* Call the C++ subroutine. */
[962]42    lib = new RpLibrary(path);
43    if (lib) {
44        // store the library and return a dictionary key
[1085]45        libIndex = storeObject_Void((void*)lib);
[962]46        if (libIndex) {
47            err = 0;
[154]48        }
[97]49    }
50
51    /* Set C-style string output_buf to MATLAB mexFunction output*/
52    plhs[0] = mxCreateDoubleScalar(libIndex);
[154]53    plhs[1] = mxCreateDoubleScalar(err);
[97]54
55    return;
56}
Note: See TracBrowser for help on using the repository browser.