00001 // Inference Engine Return Type implementation -*- C++ -*- 00002 00003 // Copyright (C) 2001-2003 Hermann Schichl 00004 // 00005 // This file is part of the COCONUT API. This library 00006 // is free software; you can redistribute it and/or modify it under the 00007 // terms of the Library GNU General Public License as published by the 00008 // Free Software Foundation; either version 2, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // Library GNU General Public License for more details. 00015 00016 // As a special exception, you may use this file as part of a free software 00017 // library without restriction. Specifically, if other files instantiate 00018 // templates or use macros or inline functions from this file, or you compile 00019 // this file and link it with other files to produce an executable, this 00020 // file does not by itself cause the resulting executable to be covered by 00021 // the Library GNU General Public License. This exception does not however 00022 // invalidate any other reasons why the executable file might be covered by 00023 // the Library GNU General Public License. 00024 00027 #include <ie_rettype.h> 00028 00029 // get all delta ids with weight greater or equal thresh 00030 const std::list<delta_id>& ie_return_type::get(work_node& wn, 00031 double thresh) 00032 { 00033 using namespace vdbl; 00034 std::list<delta>::iterator __b, __e, __rf; 00035 std::list<double>::iterator __w, __wf; 00036 00037 _d.erase(_d.begin(), _d.end()); 00038 __e = deltas.end(); 00039 for(__b = deltas.begin(), __w = weights.begin(); __b != __e;) 00040 { 00041 if(*__w >= thresh) 00042 { // store the entry in the deltas table and add the delta_id 00043 // to the return list, remove the entry from the deltas and weights 00044 _d.push_back((*__b).store(wn)); 00045 __rf = __b; 00046 __wf = __w; 00047 ++__b; 00048 ++__w; 00049 deltas.erase(__rf); 00050 weights.erase(__wf); 00051 } 00052 else 00053 { 00054 ++__b; 00055 ++__w; 00056 } 00057 } 00058 return _d; 00059 } 00060