|
solarpowerlog trunk
|
00001 /* ---------------------------------------------------------------------------- 00002 solarpowerlog 00003 Copyright (C) 2009 Tobias Frost 00004 00005 This file is part of solarpowerlog. 00006 00007 Solarpowerlog is free software; However, it is dual-licenced 00008 as described in the file "COPYING". 00009 00010 For this file (IDataFilterFactory.cpp), the license terms are: 00011 00012 You can redistribute it and/or modify it under the terms of the GNU 00013 General Public License as published by the Free Software Foundation; either 00014 version 3 of the License, or (at your option) any later version. 00015 00016 This program is distributed in the hope that it will be useful, but 00017 WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Library General Public 00022 License along with this proramm; if not, see 00023 <http://www.gnu.org/licenses/>. 00024 ---------------------------------------------------------------------------- 00025 */ 00026 00033 #ifdef HAVE_CONFIG_H 00034 #include "config.h" 00035 #endif 00036 00037 #include "DataFilters/interfaces/factories/IDataFilterFactory.h" 00038 00039 #ifdef HAVE_FILTER_DUMBDUMP 00040 #include "DataFilters/CDumpOutputFilter.h" 00041 #endif 00042 00043 #ifdef HAVE_FILTER_CSVDUMP 00044 #include "DataFilters/CCSVOutputFilter.h" 00045 #endif 00046 00047 #ifdef HAVE_FILTER_HTMLWRITER 00048 #include "DataFilters/HTMLWriter/CHTMLWriter.h" 00049 #endif 00050 00051 #include "configuration/Registry.h" 00052 #include "configuration/CConfigHelper.h" 00053 00054 00055 IDataFilter *IDataFilterFactory::Factory(const string & configurationpath) 00056 { 00057 00058 string type, name; 00059 CConfigHelper cfghlp(configurationpath); 00060 00061 cfghlp.GetConfig("type", type); 00062 cfghlp.GetConfig("name",name); 00063 00064 #ifdef HAVE_FILTER_DUMBDUMP 00065 if (type == "DumbDumper") { 00066 return new CDumpOutputFilter(name, configurationpath); 00067 } 00068 #endif 00069 00070 #ifdef HAVE_FILTER_CSVDUMP 00071 if (type == "CVSWriter") { 00072 return new CCSVOutputFilter(name, configurationpath); 00073 } 00074 #endif 00075 00076 #ifdef HAVE_FILTER_HTMLWRITER 00077 if (type == "HTMLWriter") { 00078 return new CHTMLWriter(name, configurationpath); 00079 } 00080 #endif 00081 00082 return NULL; 00083 }