source: trunk/src/core/RpBindingsDict.cc @ 93

Last change on this file since 93 was 93, checked in by dkearney, 19 years ago
  1. corrected c interface language binding function names so they are

consistant with previous c interface function names

  1. separated object dictionaries from fortran code, placed them in

the RpBindings.[h,cc] files so matlab bindings can use them too.

  1. adjusted makefile to compile RpBindings code
File size: 1.8 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Common Rappture Dictionary Source
4 *
5 * ======================================================================
6 *  AUTHOR:  Derrick S. Kearney, Purdue University
7 *  Copyright (c) 2005
8 *  Purdue Research Foundation, West Lafayette, IN
9 * ======================================================================
10 */
11
12#include "RpBindingsDict.h"
13
14RpDict DICT_TEMPLATE_L ObjDict_Lib;
15RpDict DICT_TEMPLATE_U ObjDictUnits;
16
17int
18storeObject_Lib(RpLibrary* objectName) {
19
20    int retVal = -1;
21    int dictKey = ObjDict_Lib.size() + 1;
22    int newEntry = 0;
23
24    if (objectName) {
25        // dictionary returns a reference to the inserted value
26        // no error checking to make sure it was successful in entering
27        // the new entry.
28        ObjDict_Lib.set(dictKey,objectName, &newEntry);
29    }
30
31    retVal = dictKey;
32    return retVal;
33}
34
35RpLibrary*
36getObject_Lib(int objKey) {
37
38    RpLibrary* retVal = *(ObjDict_Lib.find(objKey).getValue());
39
40    if (retVal == *(ObjDict_Lib.getNullEntry().getValue())) {
41        retVal = NULL;
42    }
43
44   return retVal;
45
46}
47
48int
49storeObject_UnitsStr(std::string objectName) {
50
51    int retVal = -1;
52    int dictNextKey = ObjDictUnits.size() + 1;
53    int newEntry = 0;
54
55    if (objectName != "") {
56        // dictionary returns a reference to the inserted value
57        // no error checking to make sure it was successful in entering
58        // the new entry.
59        ObjDictUnits.set(dictNextKey,objectName, &newEntry);
60    }
61
62    retVal = dictNextKey;
63    return retVal;
64}
65
66RpUnits*
67getObject_UnitsStr(int objKey) {
68
69    std::string basisName = *(ObjDictUnits.find(objKey).getValue());
70
71    if (basisName == *(ObjDictUnits.getNullEntry().getValue())) {
72        // basisName = "";
73        return NULL;
74    }
75
76   return RpUnits::find(basisName);
77
78}
Note: See TracBrowser for help on using the repository browser.