source: trunk/src/cee/RpUnitsCInterface.cc @ 21

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

created Makefile for compiling rappture libraries.
created README which starts to outline how to compile a rappture library
adjusted #include lines in most .h,.c,.cc files and added Include path

searched to the makefile.

files changed listed below:
M include/core/RpUnits.h
M include/core/RpDict.h
M include/cee/rappture_interface.h
A src/python/PyRpUnits_setup.py
M src/core/RpUnits.cc
M src/fortran/RpUnits_fortran.c
M src/fortran/rappture_fortran.c
M src/cee/rappture_interface.c
M src/cee/RpUnitsCInterface.cc
A src/README
A src/Makefile

File size: 2.1 KB
Line 
1#include "RpUnits.h"
2#include "RpUnitsCInterface.h"
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8    RpUnits* defineUnit(const char* unitSymbol, RpUnits* basis)
9    {
10        return RpUnits::define(unitSymbol, basis);
11    }
12
13    RpUnits* defineConv(    RpUnits* fromUnit,
14                            RpUnits* toUnit,
15                            double (*convForwFxnPtr)(double),
16                            double (*convBackFxnPtr)(double)    )
17    {
18        return RpUnits::define(fromUnit,toUnit,convForwFxnPtr,convBackFxnPtr);
19    }
20
21    RpUnits* find(const char* key)
22    {
23        return RpUnits::find(key);
24    }
25
26    const char* getUnits(RpUnits* unit)
27    {
28        return unit->getUnits().c_str();
29    }
30
31    const char* getUnitsName(RpUnits* unit)
32    {
33        return unit->getUnitsName().c_str();
34    }
35
36    double getExponent(RpUnits* unit)
37    {
38        return unit->getExponent();
39    }
40
41    RpUnits* getBasis(RpUnits* unit)
42    {
43        return unit->getBasis();
44    }
45
46    int makeMetric(RpUnits* basis)
47    {
48        return RpUnits::makeMetric(basis);
49    }
50
51    const char* convert_str(    RpUnits* fromUnits,
52                                RpUnits* toUnits,
53                                double val,
54                                int showUnits   )
55    {
56        return convert_str_result(fromUnits,toUnits,val,showUnits,NULL);
57    }
58   
59    const char* convert_str_result( RpUnits* fromUnits,
60                                    RpUnits* toUnits,
61                                    double val,
62                                    int showUnits,
63                                    int* result )
64    {
65        return fromUnits->convert(toUnits,val,showUnits,result).c_str();
66    }
67
68    double convert_double(RpUnits* fromUnits, RpUnits* toUnits, double val)
69    {
70        return convert_double_result(fromUnits,toUnits,val,NULL);
71    }
72
73    double convert_double_result(   RpUnits* fromUnits,
74                                    RpUnits* toUnits,
75                                    double val,
76                                    int* result )
77    {
78        return fromUnits->convert(toUnits,val,result);
79    }
80
81#ifdef __cplusplus
82}
83#endif
Note: See TracBrowser for help on using the repository browser.