00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifndef FACTORY_H
00027 #define FACTORY_H
00028
00029 using namespace std;
00030
00031 #include <string>
00032 #include <vector>
00033 #include "xercesc/dom/DOM.hpp"
00034 #include "tdsp/dsp_vector.h"
00035 #include "boss_utility/boss_config.h"
00036 #include "boss_node.h"
00037 #include "boss_node_de.h"
00038 #include "cost.h"
00039 #include "cost_de.h"
00040
00052 class UnitSelectionFactory {
00053 public:
00054 static UnitSelectionFactory * getFactory(const string lang);
00055 virtual Cost * createCost(BOSS::Config & __cl) = 0;
00056 virtual BOSS_Node * createNode(BOSS::Config & cl) = 0;
00057 virtual BOSS_Node * createNode(const BOSS_Node & b) = 0;
00058 virtual BOSS_Node * createNode(BOSS::Config & cl,
00059 const BOSS_Node::Node_Type & t) = 0;
00060 virtual BOSS_Node * createNode(BOSS::Config &cl,
00061 const xercesc::DOMNode *node,
00062 const BOSS_Node::Node_Type & t,
00063 const unsigned & p) = 0;
00064 };
00065
00066
00071 class UnitSelectionFactoryDE: public UnitSelectionFactory {
00072
00075 Cost * createCost(BOSS::Config & cl) {
00076 return new CostDE(cl);
00077 }
00078
00081 BOSS_Node * createNode(BOSS::Config & cl) {
00082 return new BOSS_NodeDE(cl);
00083 }
00084
00087 BOSS_Node * createNode(const BOSS_Node & b) {
00088 return new BOSS_NodeDE(b);
00089 }
00090
00093 BOSS_Node * createNode(BOSS::Config & cl,
00094 const BOSS_Node::Node_Type & t) {
00095 return new BOSS_NodeDE(cl, t);
00096 }
00099 BOSS_Node * createNode(BOSS::Config &cl,const xercesc::DOMNode *node,
00100 const BOSS_Node::Node_Type & t, const unsigned & p) {
00101 return new BOSS_NodeDE(cl, node, t, p);
00102 }
00103 };
00104
00111 UnitSelectionFactory * UnitSelectionFactory::getFactory(const string lang) {
00112 if (lang == "de") {
00113 return new UnitSelectionFactoryDE();
00114 }
00115
00116
00117 else {
00118
00119 cerr << "UnitSelectionFactory::getFactory: cannot handle language = "
00120 << lang << endl;
00121 exit(EXIT_FAILURE);
00122 }
00123 return NULL;
00124 }
00125
00127 #endif
00128