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
00029 #ifndef _INITIALIZER_H
00030 #define _INITIALIZER_H
00031
00032 #include <iostream>
00033 #include <coconut_config.h>
00034 #include <search_graph.h>
00035 #include <gptr.h>
00036 #include <string>
00037 #include <dbtools.h>
00038 #include <viewdbase>
00039 #include <control_data.h>
00040 #include <ie_rettype.h>
00041 #include <api_exception.h>
00042
00043 using namespace vgtl;
00044
00045 namespace coco {
00046
00048
00054 class initializer_exception : public api_exception
00055 {
00056 public:
00058 initializer_exception(const std::string& msg) :
00059 api_exception(apiee_initializer, msg) {}
00061 initializer_exception(const char* msg) :
00062 api_exception(apiee_initializer, msg) {}
00063
00065 virtual ~initializer_exception() throw() {}
00066 };
00067
00069
00074 class initializer
00075 {
00076 protected:
00078 std::string __name;
00080 gptr<work_node>** __wnode;
00082 search_focus** __sfocus;
00085 gptr<vdbl::database>** __dbase;
00087 gptr<search_graph>** __sgraph;
00088
00089 public:
00094 initializer(const std::string& __n,
00095 gptr<work_node>*& wnode,
00096 search_focus*& sfoc,
00097 gptr<search_graph>*& sgraph,
00098 gptr<vdbl::database>*& dbase)
00099 : __name(__n), __wnode(&wnode), __sfocus(&sfoc),
00100 __dbase(&dbase), __sgraph(&sgraph)
00101 {}
00102
00107 initializer(const std::string& __n,
00108 gptr<work_node>*& wnode,
00109 search_focus*& sfoc,
00110 gptr<search_graph>*& sgraph)
00111 : __name(__n), __wnode(&wnode), __sfocus(&sfoc),
00112 __dbase(NULL), __sgraph(&sgraph)
00113 {}
00114
00119 initializer(const std::string& __n,
00120 gptr<work_node>*& wnode,
00121 search_focus*& sfoc,
00122 gptr<vdbl::database>*& dbase)
00123 : __name(__n), __wnode(&wnode), __sfocus(&sfoc),
00124 __dbase(&dbase), __sgraph(NULL)
00125 {}
00126
00131 initializer(const std::string& __n,
00132 gptr<work_node>*& wnode,
00133 gptr<search_graph>*& sgraph,
00134 gptr<vdbl::database>*& dbase)
00135 : __name(__n), __wnode(&wnode), __sfocus(NULL),
00136 __dbase(&dbase), __sgraph(&sgraph)
00137 {}
00138
00143 initializer(const std::string& __n,
00144 search_focus*& sfoc,
00145 gptr<search_graph>*& sgraph,
00146 gptr<vdbl::database>*& dbase)
00147 : __name(__n), __wnode(NULL), __sfocus(&sfoc),
00148 __dbase(&dbase), __sgraph(&sgraph)
00149 {}
00150
00154 initializer(const std::string& __n,
00155 gptr<work_node>*& wnode,
00156 search_focus*& sfoc)
00157 : __name(__n), __wnode(&wnode), __sfocus(&sfoc),
00158 __dbase(NULL), __sgraph(NULL)
00159 {}
00160
00164 initializer(const std::string& __n,
00165 gptr<work_node>*& wnode,
00166 gptr<vdbl::database>*& dbase)
00167 : __name(__n), __wnode(&wnode), __sfocus(NULL),
00168 __dbase(&dbase), __sgraph(NULL)
00169 {}
00170
00174 initializer(const std::string& __n,
00175 gptr<work_node>*& wnode,
00176 gptr<search_graph>*& sgraph)
00177 : __name(__n), __wnode(&wnode), __sfocus(NULL),
00178 __dbase(NULL), __sgraph(&sgraph)
00179 {}
00180
00184 initializer(const std::string& __n,
00185 search_focus*& sfoc,
00186 gptr<search_graph>*& sgraph)
00187 : __name(__n), __wnode(NULL), __sfocus(&sfoc),
00188 __dbase(NULL), __sgraph(&sgraph)
00189 {}
00190
00194 initializer(const std::string& __n,
00195 search_focus*& sfoc,
00196 gptr<vdbl::database>*& dbase)
00197 : __name(__n), __wnode(NULL), __sfocus(&sfoc),
00198 __dbase(&dbase), __sgraph(NULL)
00199 {}
00200
00204 initializer(const std::string& __n,
00205 gptr<search_graph>*& sgraph,
00206 gptr<vdbl::database>*& dbase)
00207 : __name(__n), __wnode(NULL), __sfocus(NULL),
00208 __dbase(&dbase), __sgraph(&sgraph)
00209 {}
00210
00214 initializer(const std::string& __n, gptr<work_node>*& wnode)
00215 : __name(__n), __wnode(&wnode), __sfocus(NULL),
00216 __dbase(NULL), __sgraph(NULL)
00217 {}
00218
00222 initializer(const std::string& __n, search_focus*& sfoc)
00223 : __name(__n), __wnode(NULL), __sfocus(&sfoc),
00224 __dbase(NULL), __sgraph(NULL)
00225 {}
00226
00230 initializer(const std::string& __n, gptr<search_graph>*& sgraph)
00231 : __name(__n), __wnode(NULL), __sfocus(NULL),
00232 __dbase(NULL), __sgraph(&sgraph)
00233 {}
00234
00238 initializer(const std::string& __n, gptr<vdbl::database>*& dbase)
00239 : __name(__n), __wnode(NULL), __sfocus(NULL),
00240 __dbase(&dbase), __sgraph(NULL)
00241 {}
00242
00244 virtual ~initializer() {}
00245
00247 const std::string& get_name() const { return __name; }
00248
00254 virtual ie_return_type initialize(const control_data& _c)
00255 { std::cerr << "called the virtual initialize function" << std::endl;
00256 return ie_return_type();
00257 }
00258 };
00259
00260 }
00261
00262 #endif