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