Alida-C++ 0.1
|
00001 /* 00002 * This file is part of Alida-C++ library for 00003 * 00004 * Advanced Library for Integrated Development of Data Analysis Applications. 00005 * 00006 * Copyright (C) 2012 - @YEAR@ 00007 * 00008 * This program is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 * Fore more information on Alida, visit 00022 * 00023 * http://www.informatik.uni-halle.de/alida/ 00024 * 00025 */ 00026 00027 /* 00028 * Most recent change(s): 00029 * 00030 * $Rev: 96 $ 00031 * $Date: 2012-03-11 17:23:38 +0100 (So, 11 Mrz 2012) $ 00032 * $Author: moeller $ 00033 * 00034 */ 00035 00036 #ifndef OPERATOR_H_INCLUDED 00037 #define OPERATOR_H_INCLUDED 00038 00039 #include <map> 00040 #include <string> 00041 #include <typeinfo> 00042 00043 #include "operator/ALDOpParameterDescriptor.h" 00044 #include "exceptions/ALDException.h" 00045 00046 namespace Alida { 00047 00050 #define DEFINE_PARAMETER( TYPE, NAME, DIRECTION, REQUIRED, SUPPLEMENTAL, LABEL, EXPLANATION, DEFAULTVALUE ) \ 00051 this->parameters[#NAME] = \ 00052 new ALDOpParameterDescriptor( #NAME, typeid( new TYPE()).name(), #TYPE, \ 00053 DIRECTION, REQUIRED, SUPPLEMENTAL, LABEL, EXPLANATION, DEFAULTVALUE); 00054 00056 class ALDOperator 00057 { 00058 protected: 00059 00061 std::map<std::string, ALDOpParameterDescriptor*> parameters; 00062 00064 virtual ~ALDOperator() {}; 00065 00067 virtual void operate() = 0; 00068 00069 public: 00070 00072 void runOp() throw (ALDException); 00073 00075 void validate() throw (ALDException); 00076 00078 virtual void validateCustom() {}; 00079 00081 std::map<std::string, ALDOpParameterDescriptor*>& getParameters(); 00082 00084 void* getParameter(std::string); 00085 00087 void setParameter(std::string, void*); 00088 }; 00089 00090 } 00091 00092 #endif /* OPERATOR_H_INCLUDED */