Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

factory.h

Go to the documentation of this file.
00001 /* boss_node.h    $Revision: 1.2 $ $Date: 2005/12/10 20:33:54 $
00002    Copyright (C) 2000 University of Bonn.
00003    http://www.ikp.uni-bonn.de/boss
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU General Public License
00007    as published by the Free Software Foundation; either version 2
00008    of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA  02111-1307, USA.
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         } /*else if (lang = "en") {
00115                 factory = new UnitSelectionFactoryEN();
00116         }*/
00117         else { 
00118                 //throw exception;
00119                 cerr << "UnitSelectionFactory::getFactory: cannot handle language = "
00120                      << lang << endl;
00121                 exit(EXIT_FAILURE);
00122         }
00123         return NULL;
00124 }
00125  //end of boss_unitselection group
00127 #endif
00128 

Generated on Tue Dec 20 23:14:38 2005 for BOSS by doxygen 1.3.6