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 #ifndef _GRAPH_ANALYZER_H
00029 #define _GRAPH_ANALYZER_H
00030
00031 #include <iostream>
00032 #include <coconut_config.h>
00033 #include <search_graph.h>
00034 #include <termreason.h>
00035 #include <gptr.h>
00036 #include <string>
00037 #include <dbtools.h>
00038 #include <viewdbase>
00039 #include <ie_statistic.h>
00040 #include <control_data.h>
00041 #include <ie_rettype.h>
00042 #include <sgraphctx.h>
00043 #include <api_exception.h>
00044
00045 using namespace vgtl;
00046
00047 namespace coco {
00048
00050
00056 class graph_analyzer_exception : public api_exception
00057 {
00058 public:
00060 graph_analyzer_exception(const std::string& msg) :
00061 api_exception(apiee_graph_analyzer, msg) {}
00063 graph_analyzer_exception(const char* msg) :
00064 api_exception(apiee_graph_analyzer, msg) {}
00065
00067 virtual ~graph_analyzer_exception() throw() {}
00068 };
00069
00071
00074 typedef ie_return_type ga_return_type;
00075
00077
00083 class graph_analyzer
00084 {
00085 protected:
00087 std::string __name;
00089 const gptr<search_graph>* __sgraph;
00091 const search_focus* __sfoc;
00094 const search_graph_context* __sgc;
00096 const vdbl::viewdbase* __vdb;
00097
00098 public:
00102 graph_analyzer(const gptr<search_graph>& sgraph,
00103 const search_focus& sfoc,
00104 const std::string& __n)
00105 : __name(__n), __sgraph(&sgraph),
00106 __sfoc(&sfoc),
00107 __sgc((*sgraph).get_search_graph_context()),
00108 __vdb(&(*sgraph).get_viewdbase()) {}
00109
00113 graph_analyzer(const gptr<search_graph>& sgraph,
00114 const std::string& __n)
00115 : __name(__n), __sgraph(&sgraph),
00116 __sfoc(NULL),
00117 __sgc((*sgraph).get_search_graph_context()),
00118 __vdb(&(*sgraph).get_viewdbase()) {}
00119
00121 virtual ~graph_analyzer() {}
00122
00125 virtual bool update_engine(const gptr<search_graph>& sgraph,
00126 const search_focus& sfoc)
00127 {
00128 __sgc = (*sgraph).get_search_graph_context();
00129 __sgraph = &sgraph;
00130 __sfoc = &sfoc;
00131 __vdb = &(*sgraph).get_viewdbase();
00132 return true;
00133 }
00134
00137 virtual bool update_engine(const gptr<search_graph>& sgraph)
00138 {
00139 __sgc = (*sgraph).get_search_graph_context();
00140 __sgraph = &sgraph;
00141 __sfoc = NULL;
00142 __vdb = &(*sgraph).get_viewdbase();
00143 return true;
00144 }
00145
00151 virtual ga_return_type analyze(const control_data& __c)
00152 { return ga_return_type(termination_reason(0, std::string("SUCCESS"))); }
00153
00155 const std::string& get_name() const { return __name; }
00156 };
00157
00158 }
00159
00160 #endif