1 |
#include <stdexcept> |
2 |
using namespace std; |
3 |
|
4 |
#include "extmethod.h" |
5 |
|
6 |
/*--- WARNING --- |
7 |
In the C++ interface I'm trying to make the nomenclature |
8 |
a bit more systematic. 'ExternalFunc' as listed end up |
9 |
being things that you can call like 'asc_free_all_vars' -- |
10 |
they are effectively externally-defined methods on ASCEND |
11 |
models, so I'll call then 'external methods'. |
12 |
|
13 |
Meanwhile, external relations I will call 'ExtRelation'. |
14 |
|
15 |
External functions, if ever implemented, will be for |
16 |
functions like 'sin', 'exp', etc. |
17 |
*/ |
18 |
|
19 |
ExtMethod::ExtMethod(const struct ExternalFunc *e) : e(e) { |
20 |
// nothing else |
21 |
} |
22 |
|
23 |
ExtMethod::ExtMethod(const ExtMethod &old) : e(old.e) { |
24 |
// nothing else |
25 |
} |
26 |
|
27 |
ExtMethod::ExtMethod(){ |
28 |
throw runtime_error("Can't create empty ExtMethod"); |
29 |
} |
30 |
|
31 |
const char * |
32 |
ExtMethod::getName() const{ |
33 |
return ExternalFuncName(e); |
34 |
} |
35 |
|
36 |
const char * |
37 |
ExtMethod::getHelp() const{ |
38 |
return e->help; |
39 |
} |
40 |
|
41 |
const unsigned long |
42 |
ExtMethod::getNumInputs() const{ |
43 |
return NumberInputArgs(e); |
44 |
} |
45 |
|
46 |
const unsigned long |
47 |
ExtMethod::getNumOutputs() const{ |
48 |
return NumberOutputArgs(e); |
49 |
} |