Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

gr_analyzer.h

Go to the documentation of this file.
00001 // Graph Analyzer Basics 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 #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   // the constructor for a basic graph analyzer
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 /* _GR_ANALYZER_H */

Generated on Tue Nov 4 01:57:57 2003 for COCONUT API by doxygen1.2.18