utility.h
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 void get_argument(void* env, int argposition, Value& value);
00050 void get_argument(void* env, int argposition, void*& value);
00051
00052 template <typename T_return> inline char get_return_code() {
00053 throw std::logic_error("clipsmm: Adding function with invalid return type");
00054 }
00055 template <> inline char get_return_code<void *>() { return 'a'; }
00056 template <> inline char get_return_code<bool>() { return 'b'; }
00057 template <> inline char get_return_code<char>() { return 'c'; }
00058 template <> inline char get_return_code<double>() { return 'd'; }
00059 template <> inline char get_return_code<float>() { return 'f'; }
00060 template <> inline char get_return_code<int>() { return 'i'; }
00061 template <> inline char get_return_code<long>() { return 'l'; }
00062 template <> inline char get_return_code<std::string>() { return 's'; }
00063 template <> inline char get_return_code<void>() { return 'v'; }
00064 template <> inline char get_return_code<Values>() { return 'm'; }
00065 template <> inline char get_return_code<Value>() { return 'u'; }
00066
00067 template <typename T_return> inline char get_argument_code() {
00068 throw std::logic_error("clipsmm: Adding function with invalid argument type");
00069 }
00070 template <> inline char get_argument_code<void *>() { return 'a'; }
00071 template <> inline char get_argument_code<double>() { return 'd'; }
00072 template <> inline char get_argument_code<float>() { return 'f'; }
00073 template <> inline char get_argument_code<int>() { return 'i'; }
00074 template <> inline char get_argument_code<long>() { return 'l'; }
00075 template <> inline char get_argument_code<std::string>() { return 's'; }
00076 template <> inline char get_argument_code<Values>() { return 'm'; }
00077 template <> inline char get_argument_code<Value>() { return 'u'; }
00078
00079 }
00080
00081 #endif