source: trunk/src/cee/RpLibraryCInterface.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: 4.3 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: C Rappture Library Source
4 *
5 * ======================================================================
6 *  AUTHOR:  Derrick Kearney, Purdue University
7 *  Copyright (c) 2005
8 *  Purdue Research Foundation, West Lafayette, IN
9 * ======================================================================
10 */
11
12#include "RpLibrary.h"
13#include "RpLibraryCInterface.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19    RpLibrary*
20    rpLibrary (const char* path)
21    {
22        return new RpLibrary(path);
23    }
24
25    void
26    rpFreeLibrary (RpLibrary* lib)
27    {
28        delete lib;
29        lib = NULL;
30    }
31
32    RpLibrary*
33    rpElement (RpLibrary* lib, const char* path)
34    {
35        return lib->element(path);
36    }
37
38    RpLibrary*
39    rpElementAsObject (RpLibrary* lib, const char* path)
40    {
41        return rpElement(lib,path);
42    }
43
44    const char*
45    rpElementAsType (RpLibrary* lib, const char* path)
46    {
47        static std::string retStr = "";
48        RpLibrary* retLib = lib->element(path);
49
50        if (retLib) {
51            retStr = retLib->nodeType();
52        }
53
54        return retStr.c_str();
55    }
56
57    const char*
58    rpElementAsComp (RpLibrary* lib, const char* path)
59    {
60        static std::string retStr = "";
61        RpLibrary* retLib = lib->element(path);
62
63        if (retLib) {
64            retStr = retLib->nodeComp();
65        }
66
67        return retStr.c_str();
68    }
69
70    const char*
71    rpElementAsId (RpLibrary* lib, const char* path)
72    {
73        static std::string retStr = "";
74        RpLibrary* retLib = lib->element(path);
75
76        if (retLib) {
77            retStr = retLib->nodeId();
78        }
79
80        return retStr.c_str();
81    }
82
83
84    RpLibrary*
85    rpChildren (RpLibrary* lib, const char* path, RpLibrary* childEle   )
86    {
87        return lib->children(path,childEle);
88    }
89
90    RpLibrary*
91    rpChildrenByType( RpLibrary* lib,
92                    const char* path,
93                    RpLibrary* childEle,
94                    const char* type    )
95    {
96        return lib->children(path,childEle,type);
97    }
98
99    RpLibrary*
100    rpGet (RpLibrary* lib, const char* path)
101    {
102        return lib->get(path);
103    }
104
105    const char*
106    rpGetString (RpLibrary* lib, const char* path)
107    {
108        static std::string retStr = "";
109        retStr = lib->getString(path);
110        return retStr.c_str();
111    }
112
113    double
114    rpGetDouble (RpLibrary* lib, const char* path)
115    {
116        return lib->getDouble(path);
117    }
118
119    void
120    rpPut         (RpLibrary* lib,
121                 const char* path,
122                 const char* value,
123                 const char* id,
124                 int append         )
125    {
126        lib->put(path,value,id,append);
127    }
128
129    void
130    rpPutStringId (RpLibrary* lib,
131                 const char* path,
132                 const char* value,
133                 const char* id,
134                 int append          )
135    {
136        lib->put(path,value,id,append);
137    }
138
139    void
140    rpPutString ( RpLibrary* lib,
141                const char* path,
142                const char* value,
143                int append          )
144    {
145        lib->put(path,value,"",append);
146    }
147
148    void
149    rpPutDoubleId (RpLibrary* lib,
150                 const char* path,
151                 double value,
152                 const char* id,
153                 int append         )
154    {
155        lib->put(path,value,id,append);
156    }
157
158    void
159    rpPutDouble   (RpLibrary* lib,
160                 const char* path,
161                 double value,
162                 int append         )
163    {
164        lib->put(path,value,"",append);
165    }
166
167    const char*
168    rpXml (RpLibrary* lib)
169    {
170        static std::string retStr = "";
171        retStr = lib->xml();
172        return retStr.c_str();
173    }
174
175    const char*
176    rpNodeComp (RpLibrary* node)
177    {
178        static std::string retStr = "";
179        retStr = node->nodeComp();
180        return retStr.c_str();
181    }
182
183    const char*
184    rpNodeType (RpLibrary* node)
185    {
186        static std::string retStr = "";
187        retStr = node->nodeType();
188        return retStr.c_str();
189    }
190
191    const char*
192    rpNodeId (RpLibrary* node)
193    {
194        static std::string retStr = "";
195        retStr = node->nodeId();
196        return retStr.c_str();
197    }
198
199    void
200    rpResult (RpLibrary* lib)
201    {
202        lib->result();
203    }
204
205#ifdef __cplusplus
206}
207#endif
Note: See TracBrowser for help on using the repository browser.