00001 #ifndef FITSTATEFACTORY_H
00002 #define FITSTATEFACTORY_H
00003
00020
00021 #include <string>
00022 #include <map>
00023
00024 class FitState;
00025
00026 class FitStateFactory {
00027
00028 public:
00030 typedef FitState* (*FSCreator)();
00031
00032 private:
00034 typedef std::map<std::string, FSCreator> CallbackMap;
00035 typedef std::map<std::string, FitState*> StateMap;
00036
00037 public:
00038
00040 static FitStateFactory& Instance();
00041
00043 FitState* GetFitState(const std::string& fitStateId);
00044 FitState* GetFitState(const char* fitStateId);
00045
00046
00048 bool RegisterFitState (const std::string& FitStateId,
00049 FSCreator creator);
00050
00052 bool UnregisterFitState (const std::string& FitStateId);
00053
00054
00055
00056 private:
00057 static FitStateFactory* fInstance;
00058 CallbackMap fCallbacks;
00059 StateMap fFitStates;
00060
00062 FitState* CreateFitState(const std::string& FitStateId);
00064 FitStateFactory();
00065 FitStateFactory(const FitStateFactory&);
00066
00067
00068
00069 };
00070
00071 #endif