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: 10 $ 00031 * $Date: 2012/03/06 20:50:22 $ 00032 * $Author: posch $ 00033 * 00034 */ 00035 00036 #ifndef OPERATOR_MANAGER_H_INCLUDED 00037 #define OPERATOR_MANAGER_H_INCLUDED 00038 00039 #include <map> 00040 #include <string> 00041 #include <typeinfo> 00042 00043 #include "../external/loki-0.1.7/include/loki/Singleton.h" 00044 00045 #include "operator/ALDOperator.h" 00046 #include "operator/ALDOpParameterDescriptor.h" 00047 00052 #define REGISTER_OPERATOR(OPERATOR_CLASS) \ 00053 ALDOperator* OPERATOR_CLASS ## _myOperator = \ 00054 ALDOperatorManager::Instance().registerOperator(#OPERATOR_CLASS, new OPERATOR_CLASS()); 00055 00059 /* @{ */ 00060 /* @} */ 00061 00062 /* 00063 * Definition for the Loki library to enable multithread support for the 00064 * singleton class. 00065 */ 00066 #define LOKI_OBJECT_LEVEL_THREADING 00067 00068 namespace Alida { 00069 00071 00080 class _ALDOperatorManager 00081 { 00082 protected: 00083 00085 std::map<std::string, ALDOperator*>* operatorHash; 00086 00088 _ALDOperatorManager(); 00089 00091 virtual ~_ALDOperatorManager() {}; 00092 00093 /* 00094 * Friend declarations. 00095 */ 00096 friend class Loki::CreateUsingNew<Alida::_ALDOperatorManager>; 00097 00098 public: 00099 00101 ALDOperator* registerOperator(std::string name, ALDOperator *op); 00102 00104 ALDOperator* getOperator(std::string); 00105 00107 void printOperatorHash(); 00108 }; 00109 00110 } 00111 00115 /* @{ */ 00116 00118 typedef Loki::SingletonHolder<Alida::_ALDOperatorManager, 00119 Loki::CreateUsingNew, 00120 Loki::DefaultLifetime, 00121 Loki::SingleThreaded 00122 > ALDOperatorManager; 00123 00124 /* @} */ 00125 00126 #endif /* OPERATOR_MANAGER_H_INCLUDED */