clipsmm - C++ CLIPS Interface Library

clipsmm logo
utility.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2006 by Rick L. Vinyard, Jr. *
3 * rvinyard@cs.nmsu.edu *
4 * *
5 * This file is part of the clipsmm library. *
6 * *
7 * The clipsmm library is free software; you can redistribute it and/or *
8 * modify it under the terms of the GNU General Public License *
9 * version 3 as published by the Free Software Foundation. *
10 * *
11 * The clipsmm library is distributed in the hope that it will be *
12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this software. If not see <http://www.gnu.org/licenses/>. *
18 ***************************************************************************/
19#ifndef CLIPSUTILITY_H
20#define CLIPSUTILITY_H
21
22#include <vector>
23#include <string>
24#include <stdexcept>
25
26#include <clipsmm/value.h>
27
28extern "C" {
29 struct dataObject;
30}
31
32namespace CLIPS {
33
35 void init( );
36
37 std::vector<std::string> data_object_to_strings(dataObject* clipsdo);
38 std::vector<std::string> data_object_to_strings(dataObject& clipsdo);
39
40 void get_argument(void* env, int argposition, double& value);
41 void get_argument(void* env, int argposition, float& value);
42 void get_argument(void* env, int argposition, short& value);
43 void get_argument(void* env, int argposition, short unsigned& value);
44 void get_argument(void* env, int argposition, int& value);
45 void get_argument(void* env, int argposition, unsigned& value);
46 void get_argument(void* env, int argposition, long& value);
47 void get_argument(void* env, int argposition, std::string& value);
48 void get_argument(void* env, int argposition, Values& values);
49 void get_argument(void* env, int argposition, Value& value);
50 void get_argument(void* env, int argposition, void*& value);
51
52 template <typename T_return> inline char get_return_code() {
53 throw std::logic_error("clipsmm: Adding function with invalid return type");
54 }
55 template <> inline char get_return_code<void *>() { return 'a'; }
56 template <> inline char get_return_code<bool>() { return 'b'; }
57 template <> inline char get_return_code<char>() { return 'c'; }
58 template <> inline char get_return_code<double>() { return 'd'; }
59 template <> inline char get_return_code<float>() { return 'f'; }
60 template <> inline char get_return_code<int>() { return 'i'; }
61 template <> inline char get_return_code<long>() { return 'l'; }
62 template <> inline char get_return_code<std::string>() { return 's'; }
63 template <> inline char get_return_code<void>() { return 'v'; }
64 template <> inline char get_return_code<Values>() { return 'm'; }
65 template <> inline char get_return_code<Value>() { return 'u'; }
66
67 template <typename T_return> inline char get_argument_code() {
68 throw std::logic_error("clipsmm: Adding function with invalid argument type");
69 }
70 template <> inline char get_argument_code<void *>() { return 'a'; }
71 template <> inline char get_argument_code<double>() { return 'd'; }
72 template <> inline char get_argument_code<float>() { return 'f'; }
73 template <> inline char get_argument_code<int>() { return 'i'; }
74 template <> inline char get_argument_code<long>() { return 'l'; }
75 template <> inline char get_argument_code<std::string>() { return 's'; }
76 template <> inline char get_argument_code<Values>() { return 'm'; }
77 template <> inline char get_argument_code<Value>() { return 'u'; }
78
79}
80
81#endif
Definition: activation.cpp:29
char get_argument_code< float >()
Definition: utility.h:72
char get_argument_code< Value >()
Definition: utility.h:77
char get_return_code< void >()
Definition: utility.h:63
void get_argument(void *env, int argposition, void *&value)
Definition: utility.cpp:71
void init()
The init method should be called before any other clipsmm functions.
Definition: utility.cpp:30
char get_return_code< Values >()
Definition: utility.h:64
char get_return_code()
Definition: utility.h:52
char get_argument_code< std::string >()
Definition: utility.h:75
char get_argument_code< int >()
Definition: utility.h:73
char get_return_code< char >()
Definition: utility.h:57
std::vector< Value > Values
Definition: value.h:278
char get_argument_code< void * >()
Definition: utility.h:70
char get_return_code< double >()
Definition: utility.h:58
char get_return_code< void * >()
Definition: utility.h:55
char get_return_code< std::string >()
Definition: utility.h:62
char get_return_code< Value >()
Definition: utility.h:65
char get_argument_code< double >()
Definition: utility.h:71
char get_argument_code< Values >()
Definition: utility.h:76
char get_return_code< int >()
Definition: utility.h:60
char get_argument_code()
Definition: utility.h:67
char get_return_code< long >()
Definition: utility.h:61
std::vector< std::string > data_object_to_strings(dataObject *clipsdo)
Definition: utility.cpp:34
char get_return_code< float >()
Definition: utility.h:59
char get_argument_code< long >()
Definition: utility.h:74
char get_return_code< bool >()
Definition: utility.h:56

Generated on Wed Jul 20 2022 00:00:00 for clipsmm by doxygen 1.9.5