Changeset 154


Ignore:
Timestamp:
Jan 11, 2006, 3:55:15 PM (19 years ago)
Author:
dkearney
Message:

modified matlab bindings and tests.
includes all popular functions available in RpLibrary? and RpUnits
compile and run, but not all tests work as they should
some of these functions will be removed soon because the id field is
no longer a valid argument. path ids should be incorporated in paths from now on.

Location:
trunk
Files:
35 added
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/matlab/rpLib.cc

    r115 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    libHandle = rpLib(fileName)
     5 *    [libHandle,err] = rpLib(fileName)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     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
    1826void mexFunction(int nlhs, mxArray *plhs[],
    1927                 int nrhs, const mxArray *prhs[])
     
    2230    RpLibrary* lib = NULL;
    2331    int libIndex = 0;
     32    int err = 1;
    2433
    2534    /* Check for proper number of arguments. */
     
    3443    if (path) {
    3544        lib = rpLibrary(path);
     45        if (lib) {
     46            err = 0;
     47        }
    3648    }
    3749
     
    3951    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4052    plhs[0] = mxCreateDoubleScalar(libIndex);
     53    plhs[1] = mxCreateDoubleScalar(err);
    4154
    4255    return;
  • trunk/src/matlab/rpLibChildren.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    nodeHandle = rpLibChildren(libHandle,path,prevNodeHandle)
     5 *    [nodeHandle,err] = rpLibChildren(libHandle,path,prevNodeHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [nodeHandle,err] = rpLibChildren(libHandle,path,prevNodeHandle)
     20/// Retrieve the children of the node described by 'path'
     21/**
     22 * This method searches the Rappture Library Object 'libHandle' for the
     23 * node at the location described by the path 'path' and returns its
     24 * children. If 'prevNodeHandle' = 0, then the`
     25 * first child is returned, else, the next child is retrieved.
     26 * If 'prevNodeHandle' is an invalid child handle, an error will be returned.
     27 * Subsequent calls to rpLibChildren() should use previously`
     28 * returned 'nodeHandle's for it 'prevNodeHandle' argument.
     29 * Error code, err=0 on success, anything else is failure.
     30 */
     31
     32
    1833void mexFunction(int nlhs, mxArray *plhs[],
    1934                 int nrhs, const mxArray *prhs[])
     
    2237    int         childIndex = 0;
    2338    int         retLibIndex = 0;
     39    int         err = 1;
    2440    RpLibrary*  lib = NULL;
    2541    RpLibrary*  child = NULL;
     
    3046    if (nrhs != 3)
    3147        mexErrMsgTxt("Three input required.");
    32     else if (nlhs > 1)
     48    else if (nlhs > 2)
    3349        mexErrMsgTxt("Too many output arguments.");
    3450
     
    4864            retLib = rpChildren(lib,path,child);
    4965            retLibIndex = storeObject_Lib(retLib);
     66            if (retLibIndex) {
     67                err = 0;
     68            }
    5069        }
    5170    }
     
    5372    /* Set double scalar node handle to MATLAB mexFunction output*/
    5473    plhs[0] = mxCreateDoubleScalar(retLibIndex);
     74    plhs[1] = mxCreateDoubleScalar(err);
    5575
    5676    return;
  • trunk/src/matlab/rpLibChildrenByType.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    nodeHandle = rpLibChildrenByType(libHandle,path,prevNodeHandle,type)
     5 *    [nodeHandle,err] = rpLibChildrenByType(libHandle,path,prevNodeHandle,type)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [nodeHandle,err] = rpLibChildrenByType(libHandle,path,prevNodeHandle,type)
     20/// Retrieve the children of the node described by 'path' of type 'type'
     21/**
     22 * This method searches the Rappture Library Object 'libHandle' for the
     23 * node at the location described by the path 'path' and returns its
     24 * children that match the type 'type'. If 'prevNodeHandle' = 0, then the`
     25 * first child is returned, else, the next child is retrieved.
     26 * If 'prevNodeHandle' is an invalid child handle, an error will be returned.
     27 * Subsequent calls to rpLibChildrenByType() should use previously`
     28 * returned 'nodeHandle's for it 'prevNodeHandle' argument.
     29 * Error code, err=0 on success, anything else is failure.
     30 */
     31
     32
    1833void mexFunction(int nlhs, mxArray *plhs[],
    1934                 int nrhs, const mxArray *prhs[])
     
    2237    int         childIndex = 0;
    2338    int         retLibIndex = 0;
     39    int         err = 1;
    2440    RpLibrary*  lib = NULL;
    2541    RpLibrary*  child = NULL;
     
    3147    if (nrhs != 4)
    3248        mexErrMsgTxt("Four input required.");
    33     else if (nlhs > 1)
     49    else if (nlhs > 2)
    3450        mexErrMsgTxt("Too many output arguments.");
    3551
     
    5066            retLib = rpChildrenByType(lib,path,child,type);
    5167            retLibIndex = storeObject_Lib(retLib);
     68            if (retLibIndex) {
     69                err = 0;
     70            }
    5271        }
    5372    }
     
    5574    /* Set double scalar node handle to MATLAB mexFunction output*/
    5675    plhs[0] = mxCreateDoubleScalar(retLibIndex);
     76    plhs[1] = mxCreateDoubleScalar(err);
    5777
    5878    return;
  • trunk/src/matlab/rpLibElement.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    nodeHandle = rpLibElement(libHandle,path)
     5 *    [nodeHandle,err] = rpLibElement(libHandle,path)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retVal,err] = rpLibElement(libHandle,path)
     20/// Return a handle to the element at location 'path' in 'libHandle'
     21/**
     22 * This method searches the Rappture Library Object 'libHandle' for the
     23 * node at the location described by the path 'path' and returns
     24 * a handle to it.
     25 *
     26 * If path is an empty string, the root of the node is used. 'libHandle'
     27 * is the handle representing the instance of the RpLibrary object.
     28 * Error code, err=0 on success, anything else is failure.
     29 */
     30
     31
    1832void mexFunction(int nlhs, mxArray *plhs[],
    1933                 int nrhs, const mxArray *prhs[])
     
    2135    int         libIndex = 0;
    2236    int         retLibIndex = 0;
     37    int         err = 1;
    2338    RpLibrary*  lib = NULL;
    2439    RpLibrary*  retLib = NULL;
     
    2843    if (nrhs != 2)
    2944        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     45    else if (nlhs > 2)
    3146        mexErrMsgTxt("Too many output arguments.");
    3247
     
    4055            retLib = rpElement(lib,path);
    4156            retLibIndex = storeObject_Lib(retLib);
     57            if (retLibIndex) {
     58                err = 0;
     59            }
    4260        }
    4361    }
     
    4563    /* Set double scalar node handle to MATLAB mexFunction output*/
    4664    plhs[0] = mxCreateDoubleScalar(retLibIndex);
     65    plhs[1] = mxCreateDoubleScalar(err);
    4766
    4867    return;
  • trunk/src/matlab/rpLibElementAsComp.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibElementAsComp(lib,path)
     5 *    [retStr,err] = rpLibElementAsComp(lib,path)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibElementAsComp(libHandle,path)
     20/// Return the component name of the element at location 'path' in 'libHandle'
     21/**
     22 * This method searches the Rappture Library Object 'libHandle' for the
     23 * node at the location described by the path 'path' and returns its
     24 * component name, a concatination of the type, id, and index.
     25 * If path is an empty string, the root of the node is used. 'libHandle'
     26 * is the handle representing the instance of the RpLibrary object.
     27 * Error code, err=0 on success, anything else is failure.
     28 */
     29
    1830void mexFunction(int nlhs, mxArray *plhs[],
    1931                 int nrhs, const mxArray *prhs[])
     
    2133    int         libIndex = 0;
    2234    int         retLibIndex = 0;
     35    int         err = 0;
    2336    RpLibrary*  lib = NULL;
    2437    char*       path = NULL;
     
    2841    if (nrhs != 2)
    2942        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     43    else if (nlhs > 2)
    3144        mexErrMsgTxt("Too many output arguments.");
    3245
     
    3952        if (lib) {
    4053            retStr = rpElementAsComp(lib,path);
     54            if (retStr) {
     55                err = 0;
     56            }
    4157        }
    4258    }
     
    4460    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4561    plhs[0] = mxCreateString(retStr);
     62    plhs[1] = mxCreateDoubleScalar(err);
    4663
    4764    return;
  • trunk/src/matlab/rpLibElementAsId.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibElementAsId(lib,path)
     5 *    [retStr,err] = rpLibElementAsId(lib,path)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibElementAsId(libHandle,path)
     20/// Return the id attribute of the element at location 'path' in 'libHandle'
     21/**
     22 * This method searches the Rappture Library Object 'libHandle' for the
     23 * node at the location described by the path 'path' and returns its
     24 * id attribute.
     25 *
     26 * If path is an empty string, the root of the node is used. 'libHandle'
     27 * is the handle representing the instance of the RpLibrary object.
     28 * Error code, err=0 on success, anything else is failure.
     29 */
     30
    1831void mexFunction(int nlhs, mxArray *plhs[],
    1932                 int nrhs, const mxArray *prhs[])
     
    2134    int         libIndex = 0;
    2235    int         retLibIndex = 0;
     36    int         err = 1;
    2337    RpLibrary*  lib = NULL;
    2438    char*       path = NULL;
     
    2842    if (nrhs != 2)
    2943        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     44    else if (nlhs > 2)
    3145        mexErrMsgTxt("Too many output arguments.");
    3246
     
    3953        if (lib) {
    4054            retStr = rpElementAsId(lib,path);
     55            if (retStr) {
     56                err = 0;
     57            }
    4158        }
    4259    }
     
    4461    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4562    plhs[0] = mxCreateString(retStr);
     63    plhs[1] = mxCreateDoubleScalar(err);
    4664
    4765    return;
  • trunk/src/matlab/rpLibElementAsObject.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    nodeHandle = rpLibElementAsObject(libHandle,path)
     5 *    [nodeHandle,err] = rpLibElementAsObject(libHandle,path)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibElementAsObject(libHandle,path)
     20/// Return a handle to the element at location 'path' in 'libHandle'
     21/**
     22 * This method searches the Rappture Library Object 'libHandle' for the
     23 * node at the location described by the path 'path' and returns
     24 * a handle to it.
     25 *
     26 * If path is an empty string, the root of the node is used. 'libHandle'
     27 * is the handle representing the instance of the RpLibrary object.
     28 * Error code, err=0 on success, anything else is failure.
     29 */
     30
    1831void mexFunction(int nlhs, mxArray *plhs[],
    1932                 int nrhs, const mxArray *prhs[])
     
    2134    int         libIndex = 0;
    2235    int         retLibIndex = 0;
     36    int         err = 1;
    2337    RpLibrary*  lib = NULL;
    2438    RpLibrary*  retLib = NULL;
     
    2842    if (nrhs != 2)
    2943        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     44    else if (nlhs > 2)
    3145        mexErrMsgTxt("Too many output arguments.");
    3246
     
    4054            retLib = rpElement(lib,path);
    4155            retLibIndex = storeObject_Lib(retLib);
     56            if (retLibIndex) {
     57                err = 0;
     58            }
    4259        }
    4360    }
     
    4562    /* Set double scalar node handle to MATLAB mexFunction output*/
    4663    plhs[0] = mxCreateDoubleScalar(retLibIndex);
     64    plhs[1] = mxCreateDoubleScalar(err);
    4765
    4866    return;
  • trunk/src/matlab/rpLibElementAsType.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibElementAsType(lib,path)
     5 *    [retStr,err] = rpLibElementAsType(lib,path)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibElementAsType(libHandle,path)
     20/// Return the type name of the element at location 'path' in 'libHandle'
     21/**
     22 * This method searches the Rappture Library Object 'libHandle' for the
     23 * node at the location described by the path 'path' and returns its
     24 * type name.
     25 *
     26 * If path is an empty string, the root of the node is used. 'libHandle'
     27 * is the handle representing the instance of the RpLibrary object.
     28 * Error code, err=0 on success, anything else is failure.
     29 */
     30
    1831void mexFunction(int nlhs, mxArray *plhs[],
    1932                 int nrhs, const mxArray *prhs[])
     
    2134    int         libIndex = 0;
    2235    int         retLibIndex = 0;
     36    int         err = 1;
    2337    RpLibrary*  lib = NULL;
    2438    char*       path = NULL;
     
    2842    if (nrhs != 2)
    2943        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     44    else if (nlhs > 2)
    3145        mexErrMsgTxt("Too many output arguments.");
    3246
     
    3953        if (lib) {
    4054            retStr = rpElementAsType(lib,path);
     55            if (retStr) {
     56                err = 0;
     57            }
    4158        }
    4259    }
     
    4461    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4562    plhs[0] = mxCreateString(retStr);
     63    plhs[1] = mxCreateDoubleScalar(err);
    4664
    4765    return;
  • trunk/src/matlab/rpLibGet.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibGet(libHandle,path)
     5 *    [retStr,err] = rpLibGet(libHandle,path)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibGet(libHandle,path)
     20/// Query the value of a node.
     21/**
     22 * Clients use this to query the value of a node.  If the path
     23 * is not specified, it returns the value associated with the
     24 * root node.  Otherwise, it returns the value for the element
     25 * specified by the path. Values are returned as strings.
     26 *
     27 * Error code, err=0 on success, anything else is failure.
     28 */
     29
    1830void mexFunction(int nlhs, mxArray *plhs[],
    1931                 int nrhs, const mxArray *prhs[])
     
    2133    int         libIndex    = 0;
    2234    int         retLibIndex = 0;
     35    int         err         = 1;
    2336    RpLibrary*  lib         = NULL;
    2437    char*       path        = NULL;
     
    2841    if (nrhs != 2)
    2942        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     43    else if (nlhs > 2)
    3144        mexErrMsgTxt("Too many output arguments.");
    3245
     
    4053        if (lib) {
    4154            retString = rpGet(lib,path);
     55            if (retString) {
     56                err = 0;
     57            }
    4258        }
    4359    }
     
    4561    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4662    plhs[0] = mxCreateString(retString);
     63    plhs[1] = mxCreateDoubleScalar(err);
    4764
    4865    return;
  • trunk/src/matlab/rpLibGetDouble.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    nodeHandle = rpLibGetDouble(libHandle,path)
     5 *    [nodeHandle,err] = rpLibGetDouble(libHandle,path)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibGetDouble(libHandle,path)
     20/// Query the value of a node.
     21/**
     22 * Clients use this to query the value of a node.  If the path
     23 * is not specified, it returns the value associated with the
     24 * root node.  Otherwise, it returns the value for the element
     25 * specified by the path. The return value is returned as a double.
     26 *
     27 * Error code, err=0 on success, anything else is failure.
     28 */
     29
    1830void mexFunction(int nlhs, mxArray *plhs[],
    1931                 int nrhs, const mxArray *prhs[])
     
    2133    int         libIndex    = 0;
    2234    int         retLibIndex = 0;
     35    int         err         = 1;
    2336    RpLibrary*  lib         = NULL;
    2437    char*       path        = NULL;
     
    2841    if (nrhs != 2)
    2942        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     43    else if (nlhs > 2)
    3144        mexErrMsgTxt("Too many output arguments.");
    3245
     
    4053        if (lib) {
    4154            retVal = rpGetDouble(lib,path);
     55            err = 0;
    4256        }
    4357    }
     
    4559    /* Set double scalar to MATLAB mexFunction output*/
    4660    plhs[0] = mxCreateDoubleScalar(retVal);
     61    plhs[1] = mxCreateDoubleScalar(err);
    4762
    4863    return;
  • trunk/src/matlab/rpLibGetString.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibGetString(libHandle,path)
     5 *    [retStr,err] = rpLibGetString(libHandle,path)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibGetString(libHandle,path)
     20/// Query the value of a node.
     21/**
     22 * Clients use this to query the value of a node.  If the path
     23 * is not specified, it returns the value associated with the
     24 * root node.  Otherwise, it returns the value for the element
     25 * specified by the path. Values are returned as strings.
     26 *
     27 * Error code, err=0 on success, anything else is failure.
     28 */
     29
    1830void mexFunction(int nlhs, mxArray *plhs[],
    1931                 int nrhs, const mxArray *prhs[])
     
    2133    int         libIndex    = 0;
    2234    int         retLibIndex = 0;
     35    int         err         = 1;
    2336    RpLibrary*  lib         = NULL;
    2437    char*       path        = NULL;
     
    2841    if (nrhs != 2)
    2942        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     43    else if (nlhs > 2)
    3144        mexErrMsgTxt("Too many output arguments.");
    3245
     
    4053        if (lib) {
    4154            retString = rpGetString(lib,path);
     55            if (retString) {
     56                err = 0;
     57            }
    4258        }
    4359    }
     
    4561    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4662    plhs[0] = mxCreateString(retString);
     63    plhs[1] = mxCreateDoubleScalar(err);
    4764
    4865    return;
  • trunk/src/matlab/rpLibNodeComp.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibNodeComp(nodeHandle)
     5 *    [retStr,err] = rpLibNodeComp(nodeHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibNodeComp(nodeHandle)
     20/// Return the component name of the node represented by 'nodeHandle'
     21/**
     22 * This method returns the component name of the node represented`
     23 * by 'nodeHandle'. The component name is a concatination of the``
     24 * type, id, and index.
     25 * Error code, err=0 on success, anything else is failure.
     26 */
     27
    1828void mexFunction(int nlhs, mxArray *plhs[],
    1929                 int nrhs, const mxArray *prhs[])
     
    2131    const char *output_buf;
    2232    int libIndex = 0;
     33    int err = 1;
    2334    RpLibrary* lib = NULL;
    2435
     
    2637    if (nrhs != 1)
    2738        mexErrMsgTxt("One input required.");
    28     else if (nlhs > 1)
     39    else if (nlhs > 2)
    2940        mexErrMsgTxt("Too many output arguments.");
    3041
     
    3748        if (lib) {
    3849            output_buf = rpNodeComp(lib);
     50            if (output_buf) {
     51                err = 0;
     52            }
    3953        }
    4054    }
     
    4256    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4357    plhs[0] = mxCreateString(output_buf);
     58    plhs[1] = mxCreateDoubleScalar(err);
    4459
    4560    return;
  • trunk/src/matlab/rpLibNodeId.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibNodeId(lib)
     5 *    [retStr,err] = rpLibNodeId(lib)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibNodeId(nodeHandle)
     20/// Return the id name of the node represented by 'nodeHandle'
     21/**
     22 * This method returns the id name of the node represented`
     23 * by 'nodeHandle'.
     24 * Error code, err=0 on success, anything else is failure.
     25 */
     26
    1827void mexFunction(int nlhs, mxArray *plhs[],
    1928                 int nrhs, const mxArray *prhs[])
     
    2130    const char *output_buf;
    2231    int libIndex = 0;
     32    int err = 1;
    2333    RpLibrary* lib = NULL;
    2434
     
    2636    if (nrhs != 1)
    2737        mexErrMsgTxt("One input required.");
    28     else if (nlhs > 1)
     38    else if (nlhs > 2)
    2939        mexErrMsgTxt("Too many output arguments.");
    3040
     
    3747        if (lib) {
    3848            output_buf = rpNodeId(lib);
     49            if (output_buf) {
     50                err = 0;
     51            }
    3952        }
    4053    }
     
    4255    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4356    plhs[0] = mxCreateString(output_buf);
     57    plhs[1] = mxCreateDoubleScalar(err);
    4458
    4559    return;
  • trunk/src/matlab/rpLibNodeType.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibNodeType(lib)
     5 *    [retStr,err] = rpLibNodeType(lib)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibNodeType(nodeHandle)
     20/// Return the type name of the node represented by 'nodeHandle'
     21/**
     22 * This method returns the type name of the node represented`
     23 * by 'nodeHandle'.
     24 * Error code, err=0 on success, anything else is failure.
     25 */
     26
     27
    1828void mexFunction(int nlhs, mxArray *plhs[],
    1929                 int nrhs, const mxArray *prhs[])
     
    2131    const char *output_buf;
    2232    int libIndex = 0;
     33    int err = 1;
    2334    RpLibrary* lib = NULL;
    2435
     
    2637    if (nrhs != 1)
    2738        mexErrMsgTxt("One input required.");
    28     else if (nlhs > 1)
     39    else if (nlhs > 2)
    2940        mexErrMsgTxt("Too many output arguments.");
    3041
     
    3748        if (lib) {
    3849            output_buf = rpNodeType(lib);
     50            if (output_buf) {
     51                err = 0;
     52            }
    3953        }
    4054    }
     
    4256    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4357    plhs[0] = mxCreateString(output_buf);
     58    plhs[1] = mxCreateDoubleScalar(err);
    4459
    4560    return;
  • trunk/src/matlab/rpLibPut.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    rpLibPut(libHandle,path,value,id,append)
     5 *    [err] = rpLibPut(libHandle,path,value,id,append)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [err] = rpLibPut (libHandle,path,value,id,append)
     20/// Set the value of a node.
     21/**
     22 * Clients use this to set the value of a node.  If the path
     23 * is not specified, it sets the value for the root node.
     24 * Otherwise, it sets the value for the element specified
     25 * by the path.  The value is treated as the text within the`
     26 * tag at the tail of the path.
     27 *
     28 * 'id' is used to set the identifier field for the tag at the`
     29 * tail of the path.  If the append flag is set to 1, then the`
     30 * value is appended to the current value.  Otherwise, the`
     31 * value specified in the function call replaces the current value.
     32 *
     33 */
     34
    1835void mexFunction(int nlhs, mxArray *plhs[],
    1936                 int nrhs, const mxArray *prhs[])
     
    2138    int         libIndex = 0;
    2239    int         append = 0;
     40    int         err    = 1;
    2341    RpLibrary*  lib = NULL;
    2442    RpLibrary*  retLib = NULL;
     
    3048    if (nrhs != 5)
    3149        mexErrMsgTxt("Two input required.");
    32     else if (nlhs > 0)
     50    else if (nlhs > 1)
    3351        mexErrMsgTxt("Too many output arguments.");
    3452
     
    4563        if (lib) {
    4664            rpPut(lib,path,value,id,append);
     65            err = 0;
    4766        }
    4867    }
    4968
     69    plhs[0] = mxCreateDoubleScalar(err);
     70
    5071    return;
    5172}
  • trunk/src/matlab/rpLibPutDouble.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    rpLibPutDouble(libHandle,path,value,append)
     5 *    [err] = rpLibPutDouble(libHandle,path,value,append)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [err] = rpLibPutDouble (libHandle,path,value,append)
     20/// Set the value of a node.
     21/**
     22 * Clients use this to set the value of a node.  If the path
     23 * is not specified, it sets the value for the root node.
     24 * Otherwise, it sets the value for the element specified
     25 * by the path.  The value is treated as the text within the`
     26 * tag at the tail of the path.
     27 *
     28 * If the append flag is set to 1, then the`
     29 * value is appended to the current value.  Otherwise, the`
     30 * value specified in the function call replaces the current value.
     31 *
     32 */
     33
     34
    1835void mexFunction(int nlhs, mxArray *plhs[],
    1936                 int nrhs, const mxArray *prhs[])
     
    2138    int         libIndex = 0;
    2239    int         append = 0;
     40    int         err = 1;
    2341    RpLibrary*  lib = NULL;
    2442    RpLibrary*  retLib = NULL;
     
    2947    if (nrhs != 4)
    3048        mexErrMsgTxt("Two input required.");
    31     else if (nlhs > 0)
     49    else if (nlhs > 1)
    3250        mexErrMsgTxt("Too many output arguments.");
    3351
     
    3553    path = getStringInput(prhs[1]);
    3654    value = getDoubleInput(prhs[2]);
    37     append = getIntInput(prhs[4]);
     55    append = getIntInput(prhs[3]);
    3856
    3957    /* Call the C subroutine. */
     
    4260        if (lib) {
    4361            rpPutDouble(lib,path,value,append);
     62            err = 0;
    4463        }
    4564    }
    4665
     66    plhs[0] = mxCreateDoubleScalar(err);
     67
    4768    return;
    4869}
  • trunk/src/matlab/rpLibPutDoubleId.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    rpLibPutDoubleId(libHandle,path,value,id,append)
     5 *    [err] = rpLibPutDoubleId(libHandle,path,value,id,append)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [err] = rpLibPutDoubleId (libHandle,path,value,id,append)
     20/// Set the value of a node.
     21/**
     22 * Clients use this to set the value of a node.  If the path
     23 * is not specified, it sets the value for the root node.
     24 * Otherwise, it sets the value for the element specified
     25 * by the path.  The value is treated as the text within the`
     26 * tag at the tail of the path.
     27 *
     28 * 'id' is used to set the identifier field for the tag at the`
     29 * tail of the path.  If the append flag is set to 1, then the`
     30 * value is appended to the current value.  Otherwise, the`
     31 * value specified in the function call replaces the current value.
     32 *
     33 */
     34
    1835void mexFunction(int nlhs, mxArray *plhs[],
    1936                 int nrhs, const mxArray *prhs[])
     
    2138    int         libIndex = 0;
    2239    int         append = 0;
     40    int         err = 1;
    2341    RpLibrary*  lib = NULL;
    2442    RpLibrary*  retLib = NULL;
     
    3048    if (nrhs != 5)
    3149        mexErrMsgTxt("Two input required.");
    32     else if (nlhs > 0)
     50    else if (nlhs > 1)
    3351        mexErrMsgTxt("Too many output arguments.");
    3452
     
    4563        if (lib) {
    4664            rpPutDoubleId(lib,path,value,id,append);
     65            err = 0;
    4766        }
    4867    }
    4968
     69    plhs[0] = mxCreateDoubleScalar(err);
     70
    5071    return;
    5172}
  • trunk/src/matlab/rpLibPutString.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    rpLibPutString(libHandle,path,value,append)
     5 *    [err] = rpLibPutString(libHandle,path,value,append)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [err] = rpLibPutString (libHandle,path,value,append)
     20/// Set the value of a node.
     21/**
     22 * Clients use this to set the value of a node.  If the path
     23 * is not specified, it sets the value for the root node.
     24 * Otherwise, it sets the value for the element specified
     25 * by the path.  The value is treated as the text within the`
     26 * tag at the tail of the path.
     27 *
     28 * If the append flag is set to 1, then the`
     29 * value is appended to the current value.  Otherwise, the`
     30 * value specified in the function call replaces the current value.
     31 *
     32 */
     33
    1834void mexFunction(int nlhs, mxArray *plhs[],
    1935                 int nrhs, const mxArray *prhs[])
     
    2137    int         libIndex = 0;
    2238    int         append = 0;
     39    int         err = 1;
    2340    RpLibrary*  lib = NULL;
    2441    RpLibrary*  retLib = NULL;
     
    2946    if (nrhs != 4)
    3047        mexErrMsgTxt("Two input required.");
    31     else if (nlhs > 0)
     48    else if (nlhs > 1)
    3249        mexErrMsgTxt("Too many output arguments.");
    3350
     
    4360        if (lib) {
    4461            rpPutString(lib,path,value,append);
     62            err = 0;
    4563        }
    4664    }
    4765
     66    plhs[0] = mxCreateDoubleScalar(err);
     67
    4868    return;
    4969}
  • trunk/src/matlab/rpLibPutStringId.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    rpLibPutStringId(libHandle,path,value,id,append)
     5 *    [err] = rpLibPutStringId(libHandle,path,value,id,append)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [err] = rpLibPutStringId (libHandle,path,value,id,append)
     20/// Set the value of a node.
     21/**
     22 * Clients use this to set the value of a node.  If the path
     23 * is not specified, it sets the value for the root node.
     24 * Otherwise, it sets the value for the element specified
     25 * by the path.  The value is treated as the text within the`
     26 * tag at the tail of the path.
     27 *
     28 * 'id' is used to set the identifier field for the tag at the`
     29 * tail of the path.  If the append flag is set to 1, then the`
     30 * value is appended to the current value.  Otherwise, the`
     31 * value specified in the function call replaces the current value.
     32 *
     33 */
     34
     35
    1836void mexFunction(int nlhs, mxArray *plhs[],
    1937                 int nrhs, const mxArray *prhs[])
     
    2139    int         libIndex = 0;
    2240    int         append = 0;
     41    int         err = 0;
    2342    RpLibrary*  lib = NULL;
    2443    RpLibrary*  retLib = NULL;
     
    3049    if (nrhs != 5)
    3150        mexErrMsgTxt("Two input required.");
    32     else if (nlhs > 0)
     51    else if (nlhs > 1)
    3352        mexErrMsgTxt("Too many output arguments.");
    3453
     
    4564        if (lib) {
    4665            rpPutStringId(lib,path,value,id,append);
     66            err = 0;
    4767        }
    4868    }
    4969
     70    plhs[0] = mxCreateDoubleScalar(err);
     71
    5072    return;
    5173}
  • trunk/src/matlab/rpLibResult.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    rpLibResult(lib)
     5 *    [err] = rpLibResult(lib)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [err] = rpLibResult (libHandle)
     20/// Write Rappture Library to run.xml and signal end of processing.
     21/**
     22 * Usually the last call of the program, this function signals to the gui
     23 * that processing has completed and the output is ready to be
     24 * displayed
     25 */
     26
    1827void mexFunction(int nlhs, mxArray *plhs[],
    1928                 int nrhs, const mxArray *prhs[])
    2029{
    21     const char *output_buf;
    2230    int libIndex = 0;
     31    int err = 1;
    2332    RpLibrary* lib = NULL;
    2433
     
    2635    if (nrhs != 1)
    2736        mexErrMsgTxt("One input required.");
    28     else if (nlhs > 0)
     37    else if (nlhs > 1)
    2938        mexErrMsgTxt("Too many output arguments.");
    3039
     
    3746        if (lib) {
    3847            rpResult(lib);
     48            err = 0;
    3949            // cleanLibDict();
    4050        }
    4151    }
    4252
    43     /* Set C-style string output_buf to MATLAB mexFunction output*/
    44     plhs[0] = mxCreateString(output_buf);
     53    plhs[0] = mxCreateDoubleScalar(err);
    4554
    4655    return;
  • trunk/src/matlab/rpLibXml.cc

    r135 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    retStr = rpLibXml(lib)
     5 *    [retStr,err] = rpLibXml(lib)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpLibXml (libHandle)
     20/// Returns the xml from the Rappture Object represented by 'libHandle'.
     21/**
     22 * Usually called by user when they need to retrieve the character`
     23 * representation of the xml being stored in the Rappture Library Object
     24 * Error code, err=0 on success, anything else is failure.
     25 */
     26
    1827void mexFunction(int nlhs, mxArray *plhs[],
    1928                 int nrhs, const mxArray *prhs[])
     
    2130    const char* output_buf = NULL;
    2231    int libIndex = 0;
     32    int err = 1;
    2333    RpLibrary* lib = NULL;
    2434
     
    2636    if (nrhs != 1)
    2737        mexErrMsgTxt("One input required.");
    28     else if (nlhs > 1)
     38    else if (nlhs > 2)
    2939        mexErrMsgTxt("Too many output arguments.");
    3040
     
    3747        if (lib) {
    3848            output_buf = rpXml(lib);
     49            if (output_buf) {
     50                err = 0;
     51            }
    3952        }
    4053    }
     
    4255    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4356    plhs[0] = mxCreateString(output_buf);
     57    plhs[1] = mxCreateDoubleScalar(err);
    4458
    4559    return;
  • trunk/src/matlab/rpUnitsConvert.cc

    r135 r154  
    1515
    1616#include "RpMatlabInterface.h"
     17
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpUnitsConvert(fromVal,toUnitsName,showUnits)
     20/// Convert between RpUnits return a string value with or without units
     21/**
     22 * Convert the value and units in the string @var{fromVal} to units specified
     23 * in string @var{toUnitsName}. If @var{showUnits} is set to 1, then show the
     24 * units in the returned string @var{retStr}, else leave the units off.
     25 * The second return value @var{err} specifies whether there was an error
     26 * during conversion.
     27 * Error code, err=0 on success, anything else is failure.
     28 */
    1729
    1830void mexFunction(int nlhs, mxArray *plhs[],
  • trunk/src/matlab/rpUnitsConvertDbl.cc

    r135 r154  
    1515
    1616#include "RpMatlabInterface.h"
     17
     18/**********************************************************************/
     19// METHOD: [retVal,err] = rpUnitsConvertDbl(fromVal,toUnitsName)
     20/// Convert between RpUnits return a double value without units
     21/**
     22 * Convert the value and units in the string @var{fromVal} to units specified
     23 * in string @var{toUnitsName}. Units will not be shown in @var{retVal}.
     24 * The second return value @var{err} specifies whether there was an error
     25 * during conversion.
     26 * Error code, err=0 on success, anything else is failure.
     27 */
    1728
    1829void mexFunction(int nlhs, mxArray *plhs[],
  • trunk/src/matlab/rpUnitsConvertObjDbl.cc

    r141 r154  
    1515
    1616#include "RpMatlabInterface.h"
     17
     18/**********************************************************************/
     19// METHOD: [retVal,err] = rpUnitsConvertObjDbl(fromObjHandle,toObjHandle,value)
     20/// Convert between RpUnits return a double value without units
     21/**
     22 * Convert @var{value} from the units represented by the RpUnits object
     23 * @var{fromObjHandle} to the units represented by the RpUnits object
     24 * @var{toObjHandle}. On success, the converted value is returned through
     25 * @var{retVal}. The second return value, @var{err}, specifies whether`
     26 * there was an error during conversion.
     27 * Error code, err=0 on success, anything else is failure.
     28 */
    1729
    1830void mexFunction(int nlhs, mxArray *plhs[],
  • trunk/src/matlab/rpUnitsConvertObjStr.cc

    r141 r154  
    1616
    1717#include "RpMatlabInterface.h"
     18
     19/**********************************************************************/
     20// METHOD: [retStr,err] = rpUnitsConvertObjStr(fromObjHandle,toObjHandle,value,showUnits)
     21/// Convert between RpUnits return a string value with or without units
     22/**
     23 * Convert @var{value} from the units represented by the RpUnits object
     24 * @var{fromObjHandle} to the units represented by the RpUnits object
     25 * @var{toObjHandle}. If @var{showUnits} is set to 0, no units will be
     26 * displayed in @var{retStr}, else units are displayed.`
     27 * On success, the converted value is returned through
     28 * @var{retStr}. The second return value, @var{err}, specifies whether`
     29 * there was an error during conversion.
     30 * Error code, err=0 on success, anything else is failure.
     31 */
    1832
    1933void mexFunction(int nlhs, mxArray *plhs[],
  • trunk/src/matlab/rpUnitsConvertStr.cc

    r135 r154  
    1515
    1616#include "RpMatlabInterface.h"
     17
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpUnitsConvertStr(fromVal,toUnitsName,showUnits)
     20/// Convert between RpUnits return a string value with or without units
     21/**
     22 * Convert the value and units in the string @var{fromVal} to units specified
     23 * in string @var{toUnitsName}. If @var{showUnits} is set to 1, then show the
     24 * units in the returned string @var{retStr}, else leave the units off.
     25 * The second return value @var{err} specifies whether there was an error
     26 * during conversion.
     27 * Error code, err=0 on success, anything else is failure.
     28 */
    1729
    1830void mexFunction(int nlhs, mxArray *plhs[],
  • trunk/src/matlab/rpUnitsDefineUnit.cc

    r141 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [unitsHandle] = rpUnitsDefineUnit(unitSymbol, basisHandle)
     5 *    [unitsHandle,err] = rpUnitsDefineUnit(unitSymbol, basisHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [unitsHandle,err] = rpUnitsDefineUnit(unitSymbol, basisHandle)
     20/// Define a new Rappture Units type.
     21/**
     22 * Define a new Rappture Units type which can be searched for using
     23 * @var{unitSymbol} and has a basis of @var{basisHandle}. Because of
     24 * the way the Rappture Units module parses unit names, complex units must
     25 * be defined as multiple basic units. See the RpUnits Howto for more
     26 * information on this topic. A @var{basisHandle} equal to 0 means that
     27 * the unit being defined should be considered as a basis. Unit names must
     28 * not be empty strings.
     29 *
     30 * The first return value, @var{unitsHandle} represents the handle of the
     31 * instance of the RpUnits object inside the internal dictionary. On
     32 * success this value will be greater than zero (0), any other value is
     33 * represents failure within the function. The second return value
     34 * @var{err} represents the error code returned from the function.
     35 *
     36 * Error code, err=0 on success, anything else is failure.
     37 */
     38
    1839void mexFunction(int nlhs, mxArray *plhs[],
    1940                 int nrhs, const mxArray *prhs[])
     
    2546    int basisHandle = 0;
    2647    int retIndex = 0;
     48    int err = 1;
    2749
    2850    /* Check for proper number of arguments. */
    2951    if (nrhs != 2)
    3052        mexErrMsgTxt("Two input required.");
    31     else if (nlhs > 1)
     53    else if (nlhs > 2)
    3254        mexErrMsgTxt("Too many output arguments.");
    3355
     
    4567        if (myUnit) {
    4668            retHandle = storeObject_UnitsStr(myUnit->getUnitsName());
     69            if (retHandle) {
     70                err = 0;
     71            }
    4772        }
    4873    }
     
    5075    /* Set C-style string output_buf to MATLAB mexFunction output*/
    5176    plhs[0] = mxCreateDoubleScalar(retHandle);
     77    plhs[1] = mxCreateDoubleScalar(err);
    5278
    5379    return;
  • trunk/src/matlab/rpUnitsFind.cc

    r141 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [unitsHandle] = rpUnitsFind(unitSymbol)
     5 *    [unitsHandle,err] = rpUnitsFind(unitSymbol)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [unitHandle,err] = rpUnitsFind(unitSymbol)
     20/// Search the dictionary of Rappture Units for an instance named 'unitSymbol'
     21/**
     22 * This method searches the Rappture Units Dictionary for the
     23 * RpUnit named 'unitSymbol'. If it is found, its handle is`
     24 * returned, as a non-negative integer, to the caller for further use,
     25 * else a negative integer is returned signifying no unit of that`
     26 * name was found.
     27 * If unitSymbol is an empty string, unitHandle will be set to zero and err
     28 * will be set to a positive value.
     29 * Error code, err=0 on success, anything else is failure.
     30 */
     31
    1832void mexFunction(int nlhs, mxArray *plhs[],
    1933                 int nrhs, const mxArray *prhs[])
     
    2236    const RpUnits* myUnit = NULL;
    2337    int retHandle = 0;
     38    int err = 1;
    2439
    2540    /* Check for proper number of arguments. */
    2641    if (nrhs != 1)
    2742        mexErrMsgTxt("Two input required.");
    28     else if (nlhs > 1)
     43    else if (nlhs > 2)
    2944        mexErrMsgTxt("Too many output arguments.");
    3045
     
    3752        if (myUnit) {
    3853            retHandle = storeObject_UnitsStr(myUnit->getUnitsName());
     54            if (retHandle) {
     55                err = 0;
     56            }
    3957        }
    4058    }
     
    4260    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4361    plhs[0] = mxCreateDoubleScalar(retHandle);
     62    plhs[1] = mxCreateDoubleScalar(err);
    4463
    4564    return;
  • trunk/src/matlab/rpUnitsGetBasis.cc

    r141 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [unitsHandle] = rpUnitsGetBasis(unitsHandle)
     5 *    [unitsHandle,err] = rpUnitsGetBasis(unitsHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [basisHandle,err] = rpUnitsGetBasis(unitHandle)
     20/// Return a handle to the basis of the provided instance of a Rappture Unit.
     21/**
     22 * Retrieve the basis of the Rappture Units object with the handle`
     23 * 'unitHandle'. Return the handle of the basis if it exists. If there`
     24 * is no basis, then return a negative integer.
     25 * Error code, err=0 on success, anything else is failure.
     26 */
     27
    1828void mexFunction(int nlhs, mxArray *plhs[],
    1929                 int nrhs, const mxArray *prhs[])
     
    2434    int retHandle = 0;
    2535    int unitsHandle = 0;
     36    int err = 1;
    2637
    2738    /* Check for proper number of arguments. */
    2839    if (nrhs != 1)
    2940        mexErrMsgTxt("Two input required.");
    30     else if (nlhs > 1)
     41    else if (nlhs > 2)
    3142        mexErrMsgTxt("Too many output arguments.");
    3243
    33     unitsHandle = getIntInput(prhs[1]);
     44    unitsHandle = getIntInput(prhs[0]);
    3445
    3546    /* Call the C subroutine. */
     
    4253            if (myBasis) {
    4354                retHandle = storeObject_UnitsStr(myBasis->getUnitsName());
     55                if (retHandle) {
     56                    err = 0;
     57                }
    4458            }
    4559        }
     
    4862    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4963    plhs[0] = mxCreateDoubleScalar(retHandle);
     64    plhs[1] = mxCreateDoubleScalar(err);
    5065    return;
    5166}
  • trunk/src/matlab/rpUnitsGetExponent.cc

    r141 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [retStr] = rpUnitsGetExponent(unitsHandle)
     5 *    [retVal,err] = rpUnitsGetExponent(unitsHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retVal,err] = rpUnitsGetExponent(unitHandle)
     20/// Return the exponent of the Rappture Unit represented by unitHandle.
     21/**
     22 * Retrieve the exponent of the Rappture Units object with the handle`
     23 * 'unitHandle'. Return the exponent as a double.
     24 * Error code, err=0 on success, anything else is failure.
     25 */
     26
    1827void mexFunction(int nlhs, mxArray *plhs[],
    1928                 int nrhs, const mxArray *prhs[])
     
    2332    const char*    retString   = NULL;
    2433    double         retVal      = 0.0;
     34    int            err         = 1;
    2535
    2636    /* Check for proper number of arguments. */
    2737    if (nrhs != 1)
    2838        mexErrMsgTxt("Two input required.");
    29     else if (nlhs > 1)
     39    else if (nlhs > 2)
    3040        mexErrMsgTxt("Too many output arguments.");
    3141
     
    3747        if (unitsObj) {
    3848            retVal = unitsObj->getExponent();
     49            err = 0;
    3950        }
    4051    }
     
    4253    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4354    plhs[0] = mxCreateDoubleScalar(retVal);
     55    plhs[1] = mxCreateDoubleScalar(err);
    4456
    4557    return;
  • trunk/src/matlab/rpUnitsGetUnits.cc

    r141 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [retStr] = rpUnitsGetUnits(unitsHandle)
     5 *    [retStr,err] = rpUnitsGetUnits(unitsHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpUnitsGetUnits(unitHandle)
     20/// Return the units of the Rappture Unit represented by unitHandle.
     21/**
     22 * Retrieve the units of the Rappture Units object with the handle`
     23 * 'unitHandle'. Note this does not include the exponent.
     24 * For units and exponent in one string see rpUnitsGetUnitsName().
     25 * Return the units as a string.
     26 * Error code, err=0 on success, anything else is failure.
     27 */
     28
    1829void mexFunction(int nlhs, mxArray *plhs[],
    1930                 int nrhs, const mxArray *prhs[])
    2031{
    2132    int            unitsHandle = 0;
     33    int            err         = 1;
    2234    const RpUnits* unitsObj    = NULL;
    2335    const char*    retString   = NULL;
     
    2638    if (nrhs != 1)
    2739        mexErrMsgTxt("Two input required.");
    28     else if (nlhs > 1)
     40    else if (nlhs > 2)
    2941        mexErrMsgTxt("Too many output arguments.");
    3042
     
    3648        if (unitsObj) {
    3749            retString = unitsObj->getUnits().c_str();
     50            if (retString) {
     51                err = 0;
     52            }
    3853        }
    3954    }
     
    4156    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4257    plhs[0] = mxCreateString(retString);
     58    plhs[1] = mxCreateDoubleScalar(err);
    4359
    4460    return;
  • trunk/src/matlab/rpUnitsGetUnitsName.cc

    r141 r154  
    33 *  INTERFACE: Matlab Rappture Library Source
    44 *
    5  *    [retStr] = rpUnitsGetUnitsName(unitsHandle)
     5 *    [retStr,err] = rpUnitsGetUnitsName(unitsHandle)
    66 *
    77 * ======================================================================
     
    1616#include "RpMatlabInterface.h"
    1717
     18/**********************************************************************/
     19// METHOD: [retStr,err] = rpUnitsGetUnitsName(unitHandle)
     20/// Return the unit and exponent of the Rappture Unit represented by unitHandle.
     21/**
     22 * Retrieve the unit and exponent of the Rappture Units object with`
     23 * the handle 'unitHandle'.
     24 * Return the unit and exponent as one concatinated string.
     25 * Error code, err=0 on success, anything else is failure.
     26 */
     27
    1828void mexFunction(int nlhs, mxArray *plhs[],
    1929                 int nrhs, const mxArray *prhs[])
    2030{
    2131    int            unitsHandle = 0;
     32    int            err         = 1;
    2233    const RpUnits* unitsObj    = NULL;
    2334    const char*    retString   = NULL;
     
    2637    if (nrhs != 1)
    2738        mexErrMsgTxt("Two input required.");
    28     else if (nlhs > 1)
     39    else if (nlhs > 2)
    2940        mexErrMsgTxt("Too many output arguments.");
    3041
     
    3647        if (unitsObj) {
    3748            retString = unitsObj->getUnitsName().c_str();
     49            if (retString) {
     50                err = 0;
     51            }
    3852        }
    3953    }
     
    4155    /* Set C-style string output_buf to MATLAB mexFunction output*/
    4256    plhs[0] = mxCreateString(retString);
     57    plhs[1] = mxCreateDoubleScalar(err);
    4358
    4459    return;
  • trunk/src/matlab/rpUnitsMakeMetric.cc

    r141 r154  
    1515
    1616#include "RpMatlabInterface.h"
     17
     18/**********************************************************************/
     19// METHOD: [err] = rpUnitsMakeMetric(basisHandle)
     20/// Create metric extensions for the Rappture Unit referenced by basisHandle
     21/**
     22 * Create the metric extensions for the Rappture Unit, referenced`
     23 * by basisHandle, within Rappture's internal units dictionary.
     24 * Return an error code, err, to specify success or failure.
     25 * Error code, err=0 on success, anything else is failure.
     26 */
    1727
    1828void mexFunction(int nlhs, mxArray *plhs[],
Note: See TracChangeset for help on using the changeset viewer.