00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00028 #include <coconut_config.h>
00029 #include <search_graph_funcs.h>
00030
00031 namespace coco {
00032
00033 void get_ids(const std::vector<si_ri_pair>& riv,
00034 std::vector<search_node_id>& v)
00035 {
00036 v.reserve(riv.size());
00037 std::vector<si_ri_pair>::const_iterator riv_c, riv_e(riv.end());
00038 for(riv_c = riv.begin(); riv_c != riv_e; ++riv_c)
00039 v.push_back(riv_c->second);
00040 }
00041
00042 void get_leaves_vector(const search_graph& __sgraph,
00043 std::vector<si_ri_pair>& v,
00044 search_inspector* sfoc)
00045 {
00046 search_graph::parents_const_iterator __p;
00047 search_inspector sky = __sgraph.sky();
00048 for(__p = __sgraph.leaf_begin(); __p != __sgraph.leaf_end(); ++__p)
00049 {
00050 search_inspector n(sky << __p);
00051 if(!sfoc || (*n)->get_id() != (*(*sfoc))->get_id())
00052 v.push_back(std::make_pair((*(sky << __p))->get_rowid(),
00053 (*(sky << __p))->get_id()));
00054 }
00055 std::sort(v.begin(), v.end());
00056 }
00057
00058 bool get_children_vector(const search_graph& __sgraph,
00059 const search_node_id& pid,
00060 std::vector<si_ri_pair>& v,
00061 search_inspector* sfoc)
00062 {
00063 bool ret(true);
00064 search_graph::children_const_iterator __c;
00065 search_inspector par = __sgraph.get(pid);
00066 if(par == __sgraph.ground())
00067 ret = false;
00068 else
00069 {
00070 for(__c = par.child_begin(); __c != par.child_end(); ++__c)
00071 {
00072 search_graph::const_walker w(par >> __c);
00073 if(!w.is_sky() && (!sfoc || (*w)->get_id() != (*(*sfoc))->get_id()))
00074 v.push_back(std::make_pair((*w)->get_rowid(),
00075 (*w)->get_id()));
00076 }
00077 std::sort(v.begin(), v.end());
00078 }
00079 return ret;
00080 }
00081
00082 }