source: trunk/lang/octave/rpLibNodeComp.cc @ 1025

Last change on this file since 1025 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: 2.4 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Octave Rappture Library Source
4 *
5 *    [retStr,err] = rpLibNodeComp(nodeHandle)
6 *
7 * ======================================================================
8 *  AUTHOR:  Derrick Kearney, Purdue University
9 *  Copyright (c) 2005
10 *  Purdue Research Foundation, West Lafayette, IN
11 * ======================================================================
12 */
13
14#include "RpOctaveInterface.h"
15
16/**********************************************************************/
17// METHOD: [retStr,err] = rpLibNodeComp(nodeHandle)
18/// Return the component name of the node represented by 'nodeHandle'
19/**
20 * This method returns the component name of the node represented
21 * by 'nodeHandle'. The component name is a concatination of the 
22 * type, id, and index.
23 * Error code, err=0 on success, anything else is failure.
24 */
25
26DEFUN_DLD (rpLibNodeComp, args, ,
27"-*- texinfo -*-\n\
28[retStr,err] = rpLibNodeComp(@var{nodeHandle})\n\
29\n\
30This method returns the component name of the node represented \n\
31by @var{nodeHandle}. The component name is a concatination of the \n\
32type, id, and index.\n\
33Error code, err=0 on success, anything else is failure.")
34{
35    static std::string who = "rpLibNodeComp";
36
37    // The list of values to return.
38    octave_value_list retval;
39    int err = 1;
40    int nargin = args.length ();
41    int libHandle = 0;
42    RpLibrary* lib = NULL;
43    std::string retStr = "";
44
45    if (nargin == 1) {
46
47        if ( args(0).is_real_scalar() ) {
48
49            libHandle = args(0).int_value ();
50
51            /* Call the C subroutine. */
52            if ( (libHandle >= 0) ) {
53
54                lib = getObject_Lib(libHandle);
55                if (lib) {
56                    retStr = lib->nodeComp();
57                    if (!retStr.empty()) {
58                        err = 0;
59                    }
60                }
61                else {
62                    // lib is NULL, not found in dictionary
63                    // std::cout << "lib was NULL" << std::endl;
64                }
65            }
66            else {
67                // libHandle is negative
68                print_usage (who.c_str());
69            }
70        }
71        else {
72            // wrong argument types
73            print_usage (who.c_str());
74        }
75    }
76    else {
77        // wrong number of arguments
78        print_usage (who.c_str());
79    }
80
81    retval(0) = retStr;
82    retval(1) = err;
83    return retval;
84}
Note: See TracBrowser for help on using the repository browser.