00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00027 #ifndef _IE_RETTYPE_H
00028 #define _IE_RETTYPE_H
00029
00030 #include <addinfo.h>
00031 #include <termreason.h>
00032 #include <info_contents.h>
00033 #include <search_node.h>
00034 #include <delta.h>
00035
00036 class ie_return_type
00037 {
00038 private:
00039 termination_reason termr;
00040 info_contents info;
00041
00042 std::list<delta> deltas;
00043 std::list<double> weights;
00044 std::list<delta_id> _d;
00045
00046 public:
00047 ie_return_type() : termr(), info(), deltas(), weights(), _d() {}
00048 ie_return_type(const termination_reason& __t) : termr(__t), info(), deltas(),
00049 weights(), _d() {}
00050 ie_return_type(const delta_base* __d, double __w)
00051 : termr(), info(), deltas(), weights(1,__w), _d()
00052 { deltas.push_back(__d->new_copy()); }
00053 ie_return_type(const std::pair<delta_base*,double>& __d)
00054 : termr(), info(), deltas(), weights(1,__d.second), _d()
00055 { deltas.push_back(__d.first->new_copy()); }
00056 ie_return_type(delta __d, double __w) : termr(), info(), deltas(1,__d),
00057 weights(1,__w), _d() {}
00058 ie_return_type(const std::pair<delta,double>& __d) : termr(), info(),
00059 deltas(1,__d.first), weights(1,__d.second), _d() {}
00060 ie_return_type(const std::list<delta>& __d, const std::list<double>& __w) :
00061 termr(), info(), deltas(__d), weights(__w), _d()
00062 {
00063 if(deltas.size() != weights.size())
00064 throw "ie_return_type: number of deltas different from number of weights!";
00065 }
00066 ie_return_type(const delta_base* __d, double __w,
00067 const termination_reason& __t)
00068 : termr(__t), info(), deltas(), weights(1,__w), _d()
00069 { deltas.push_back(__d->new_copy()); }
00070 ie_return_type(const std::pair<delta_base*,double>& __d,
00071 const termination_reason& __t)
00072 : termr(__t), info(), deltas(), weights(1,__d.second), _d()
00073 { deltas.push_back(__d.first->new_copy()); }
00074 ie_return_type(delta __d, double __w, const termination_reason& __t)
00075 : termr(__t), info(), deltas(1,__d), weights(1,__w), _d()
00076 {}
00077 ie_return_type(const std::pair<delta,double>& __d,
00078 const termination_reason& __t) : termr(__t), info(),
00079 deltas(1,__d.first), weights(1,__d.second), _d() {}
00080 ie_return_type(const std::list<delta>& __d, const std::list<double>& __w,
00081 const termination_reason& __t) :
00082 termr(__t), info(), deltas(__d), weights(__w), _d()
00083 {
00084 if(deltas.size() != weights.size())
00085 throw "ie_return_type: number of deltas different from number of weights!";
00086 }
00087 ie_return_type(const ie_return_type& __r)
00088 : termr(__r.termr), info(__r.info), deltas(__r.deltas),
00089 weights(__r.weights), _d() {}
00090
00091 virtual ~ie_return_type() {}
00092
00093 public:
00094 void set_termination_reason(const termination_reason& __t);
00095
00096 const termination_reason& term_reason() const;
00097
00098 bool set_information(const std::string& iname, const additional_info_u& a,
00099 bool force = false);
00100 bool set_information_i(const std::string& iname, int i,
00101 const additional_info_u& a, bool force = false);
00102
00103 const additional_info_u& information(const std::string& iname) const;
00104 const additional_info_u& information(const char* iname) const;
00105 const additional_info_u& information(const std::string& iname, int i) const;
00106 const additional_info_u& information(const char* iname, int i) const;
00107
00108 bool has_information(const std::string& __s) const;
00109 bool has_information(const char* __cp) const;
00110 bool has_information(const std::string& __s, int i) const;
00111 bool has_information(const char* __cp, int i) const;
00112
00113 bool information_indices_set(const std::string& __s,
00114 std::vector<int>& __idx) const;
00115 bool information_indices_set(const char* __cp,
00116 std::vector<int>& __idx) const;
00117
00118 void unset_information(const std::string& __s);
00119 void unset_information(const char* __cp);
00120 void unset_information(const std::string& __s, int i);
00121 void unset_information(const char* __cp, int i);
00122
00123 template <class _S>
00124 bool retrieve_from_info(const std::string& __s,
00125 const std::vector<_S>*& __b) const;
00126
00127 template <class _S>
00128 bool retrieve_from_info(const std::string& __s, const matrix<_S>*& __b) const;
00129
00130 template <class _S>
00131 bool retrieve_from_info(const std::string& __s, _S& __b) const;
00132
00133 template <class _S>
00134 bool retrieve_from_info(const std::string& __s, const std::vector<_S>*& __b,
00135 const std::vector<_S>* __def) const;
00136
00137 template <class _S>
00138 bool retrieve_from_info(const std::string& __s, const matrix<_S>*& __b,
00139 const matrix<_S>* __def) const;
00140
00141 template <class _S>
00142 bool retrieve_from_info(const std::string& __s, _S& __b,
00143 const _S& __def) const;
00144
00145 template <class _S>
00146 bool retrieve_from_info(const char* __s, const std::vector<_S>*& __b) const;
00147
00148 template <class _S>
00149 bool retrieve_from_info(const char* __s, const matrix<_S>*& __b) const;
00150
00151 template <class _S>
00152 bool retrieve_from_info(const char* __s, _S& __b) const;
00153
00154 template <class _S>
00155 bool retrieve_from_info(const char* __s, const std::vector<_S>*& __b,
00156 const std::vector<_S>* __def) const;
00157
00158 template <class _S>
00159 bool retrieve_from_info(const char* __s, const matrix<_S>*& __b,
00160 const matrix<_S>* __def) const;
00161
00162 template <class _S>
00163 bool retrieve_from_info(const char* __s, _S& __b, const _S& __def) const;
00164
00165 template <class _S>
00166 bool retrieve_from_info_i(const std::string& __s, int i,
00167 const std::vector<_S>*& __b) const;
00168
00169 template <class _S>
00170 bool retrieve_from_info_i(const std::string& __s, int i,
00171 const matrix<_S>*& __b) const;
00172
00173 template <class _S>
00174 bool retrieve_from_info_i(const std::string& __s, int i, _S& __b) const;
00175
00176 template <class _S>
00177 bool retrieve_from_info_i(const std::string& __s, int i,
00178 const std::vector<_S>*& __b,
00179 const std::vector<_S>* __def) const;
00180
00181 template <class _S>
00182 bool retrieve_from_info_i(const std::string& __s, int i,
00183 const matrix<_S>*& __b,
00184 const matrix<_S>* __def) const;
00185
00186 template <class _S>
00187 bool retrieve_from_info_i(const std::string& __s, int i, _S& __b,
00188 const _S& __def) const;
00189
00190 template <class _S>
00191 bool retrieve_from_info_i(const char* __s, int i,
00192 const std::vector<_S>*& __b) const;
00193
00194 template <class _S>
00195 bool retrieve_from_info_i(const char* __s, int i,
00196 const matrix<_S>*& __b) const;
00197
00198 template <class _S>
00199 bool retrieve_from_info_i(const char* __s, int i, _S& __b) const;
00200
00201 template <class _S>
00202 bool retrieve_from_info_i(const char* __s, int i, const std::vector<_S>*& __b,
00203 const std::vector<_S>* __def) const;
00204
00205 template <class _S>
00206 bool retrieve_from_info_i(const char* __s, int i, const matrix<_S>*& __b,
00207 const matrix<_S>* __def) const;
00208
00209 template <class _S>
00210 bool retrieve_from_info_i(const char* __s, int i, _S& __b,
00211 const _S& __def) const;
00212
00213 ie_return_type operator+(const std::pair<delta_base*,double>& __d);
00214 ie_return_type& operator+=(const std::pair<delta_base*,double>& __d);
00215 #if 0
00216 ie_return_type operator+(const std::pair<delta,double>& __d);
00217 ie_return_type& operator+=(const std::pair<delta,double>& __d);
00218 #endif
00219 ie_return_type& operator=(const ie_return_type& __d);
00220
00221 unsigned int n_deltas() const { return deltas.size(); }
00222
00223
00224
00225
00226
00227 const std::list<delta_id>& get(work_node& wn, double thresh=-INFINITY);
00228 };
00229
00230 #include <ieret-inline.h>
00231
00232 #endif