| 165 | typename DF10 |
| 166 | > |
| 167 | void serialize( |
| 168 | const one_vs_one_decision_function<T,DF1,DF2,DF3,DF4,DF5,DF6,DF7,DF8,DF9,DF10>& item, |
| 169 | std::ostream& out |
| 170 | ) |
| 171 | { |
| 172 | try |
| 173 | { |
| 174 | type_safe_union<DF1,DF2,DF3,DF4,DF5,DF6,DF7,DF8,DF9,DF10> temp; |
| 175 | typedef typename T::label_type result_type; |
| 176 | typedef typename T::sample_type sample_type; |
| 177 | typedef typename T::scalar_type scalar_type; |
| 178 | typedef std::map<unordered_pair<result_type>, any_decision_function<sample_type, scalar_type> > binary_function_table; |
| 179 | |
| 180 | const unsigned long version = 1; |
| 181 | serialize(version, out); |
| 182 | |
| 183 | const unsigned long size = item.get_binary_decision_functions().size(); |
| 184 | serialize(size, out); |
| 185 | |
| 186 | for(typename binary_function_table::const_iterator i = item.get_binary_decision_functions().begin(); |
| 187 | i != item.get_binary_decision_functions().end(); ++i) |
| 188 | { |
| 189 | serialize(i->first, out); |
| 190 | |
| 191 | if (i->second.template contains<DF1>()) temp.template get<DF1>() = any_cast<DF1>(i->second); |
| 192 | else if (i->second.template contains<DF2>()) temp.template get<DF2>() = any_cast<DF2>(i->second); |
| 193 | else if (i->second.template contains<DF3>()) temp.template get<DF3>() = any_cast<DF3>(i->second); |
| 194 | else if (i->second.template contains<DF4>()) temp.template get<DF4>() = any_cast<DF4>(i->second); |
| 195 | else if (i->second.template contains<DF5>()) temp.template get<DF5>() = any_cast<DF5>(i->second); |
| 196 | else if (i->second.template contains<DF6>()) temp.template get<DF6>() = any_cast<DF6>(i->second); |
| 197 | else if (i->second.template contains<DF7>()) temp.template get<DF7>() = any_cast<DF7>(i->second); |
| 198 | else if (i->second.template contains<DF8>()) temp.template get<DF8>() = any_cast<DF8>(i->second); |
| 199 | else if (i->second.template contains<DF9>()) temp.template get<DF9>() = any_cast<DF9>(i->second); |
| 200 | else if (i->second.template contains<DF10>()) temp.template get<DF10>() = any_cast<DF10>(i->second); |
| 201 | else throw serialization_error("Can't serialize one_vs_one_decision_function. Not all decision functions defined."); |
| 202 | |
| 203 | serialize(temp,out); |
| 204 | } |
| 205 | } |
| 206 | catch (serialization_error& e) |
| 207 | { |
| 208 | throw serialization_error(e.info + "\n while serializing an object of type one_vs_one_decision_function"); |
| 209 | } |
| 210 | |
| 211 | } |
| 212 | |
| 213 | // ---------------------------------------------------------------------------------------- |
| 214 |
nothing calls this directly
no test coverage detected