00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef CLIPSUTILITY_H
00021 #define CLIPSUTILITY_H
00022
00023 #include <vector>
00024 #include <string>
00025 #include <stdexcept>
00026
00027 extern "C" {
00028 struct dataObject;
00029 }
00030
00031 namespace CLIPS {
00032
00034 void init( );
00035
00036 std::vector<std::string> data_object_to_strings(dataObject* clipsdo);
00037 std::vector<std::string> data_object_to_strings(dataObject& clipsdo);
00038
00039 void get_argument(void* env, int argposition, double& value);
00040 void get_argument(void* env, int argposition, float& value);
00041 void get_argument(void* env, int argposition, short& value);
00042 void get_argument(void* env, int argposition, short unsigned& value);
00043 void get_argument(void* env, int argposition, int& value);
00044 void get_argument(void* env, int argposition, unsigned& value);
00045 void get_argument(void* env, int argposition, long& value);
00046 void get_argument(void* env, int argposition, std::string& value);
00047
00048 template <typename T_return> inline char get_return_code() {
00049 throw std::logic_error("clipsmm: Adding function with invalid return type");
00050 }
00051 template <> inline char get_return_code<bool>() { return 'b'; }
00052 template <> inline char get_return_code<char>() { return 'c'; }
00053 template <> inline char get_return_code<double>() { return 'd'; }
00054 template <> inline char get_return_code<float>() { return 'f'; }
00055 template <> inline char get_return_code<int>() { return 'i'; }
00056 template <> inline char get_return_code<long>() { return 'l'; }
00057 template <> inline char get_return_code<std::string>() { return 's'; }
00058 template <> inline char get_return_code<void>() { return 'v'; }
00059
00060 template <typename T_return> inline char get_argument_code() {
00061 throw std::logic_error("clipsmm: Adding function with invalid argument type");
00062 }
00063 template <> inline char get_argument_code<double>() { return 'd'; }
00064 template <> inline char get_argument_code<float>() { return 'f'; }
00065 template <> inline char get_argument_code<int>() { return 'i'; }
00066 template <> inline char get_argument_code<long>() { return 'l'; }
00067 template <> inline char get_argument_code<std::string>() { return 's'; }
00068
00069
00070 }
00071
00072 #endif