00001 // Search Node computation hook implementation -*- C++ -*- 00002 00003 // Copyright (C) 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 <search_node.h> 00028 #include <comp_hook.h> 00029 00030 template <class _CI> 00031 bool work_node_comp_hook::_init_column(vdbl::standard_table& stable, 00032 const std::string& colname, 00033 const _CI& c) 00034 { 00035 bool ret = stable.add_col(colname, vdbl::typed_col<_CI>(c), 00036 vdbl::colflags(true)); 00037 if(ret) 00038 __managed_cols.push_back(colname); 00039 return ret; 00040 } 00041 00042 bool work_node_comp_hook::_drop_columns(vdbl::standard_table& stable) 00043 { 00044 bool ret(true); 00045 for(std::list<std::string>::iterator __x = __managed_cols.begin(); 00046 __x != __managed_cols.end(); ++__x) 00047 ret = stable.drop_col(*__x) || ret; 00048 return ret; 00049 } 00050 00051 search_node_id work_node_comp_hook::node_id(const work_node& wn) const 00052 { return wn.node_id(); } 00053 00054 search_node_relation work_node_comp_hook::parent_relation(const work_node& wn) 00055 const { return wn.parent_relation(); } 00056