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 _GR_ANALYZER_H
00028 #define _GR_ANALYZER_H
00029
00030 #include <iostream>
00031 #include <coconut_config.h>
00032 #include <search_node.h>
00033 #include <termreason.h>
00034 #include <gptr.h>
00035 #include <string>
00036 #include <dbtools.h>
00037 #include <viewdbase>
00038 #include <ie_statistic.h>
00039 #include <control_data.h>
00040 #include <ie_rettype.h>
00041 #include <sgraphctx.h>
00042
00043 using namespace vgtl;
00044
00045 typedef ie_return_type ga_return_type;
00046
00047 class graph_analyzer
00048 {
00049 protected:
00050 std::string __name;
00051 const gptr<search_graph>* __sgraph;
00052 search_focus* __sfoc;
00053 search_graph_context* __sgc;
00054 vdbl::viewdbase __vdb;
00055
00056 public:
00057
00058 graph_analyzer(const gptr<search_graph>& sgraph,
00059 const search_focus& sfoc,
00060 const std::string& __n)
00061 : __name(__n), __sgraph(&sgraph),
00062 __sfoc(&sfoc),
00063 __sgc(new search_graph_context(&sgraph)),
00064 __vdb(*(*sgraph).__dbase->get_local_copy(),
00065 (*sgraph).__dbuser, *__sgc) {}
00066
00067 graph_analyzer(const gptr<search_graph>& sgraph,
00068 const std::string& __n)
00069 : __name(__n), __sgraph(&sgraph),
00070 __sfoc(NULL),
00071 __sgc(new search_graph_context(&sgraph)),
00072 __vdb(*(*sgraph).__dbase->get_local_copy(),
00073 (*sgraph).__dbuser, *__sgc) {}
00074
00075 virtual ~graph_analyzer() { delete __sgc; }
00076
00077 virtual bool update_engine(const gptr<work_node>& sgraph,
00078 const search_focus& sfoc)
00079 {
00080 __sgraph = &sgraph;
00081 __sfoc = &sfoc;
00082 return true;
00083 }
00084
00085 virtual bool update_engine(const gptr<work_node>& sgraph)
00086 {
00087 __sgraph = &sgraph;
00088 __sfoc = NULL;
00089 return true;
00090 }
00091
00092 virtual ga_return_type analyze(const control_data& __c)
00093 { return ga_return_type(termination_reason(0, std::string("SUCCESS"))); }
00094
00095 const std::string& get_name() const { return __name; }
00096 };
00097
00098 #endif