00001 /* -*- Mode: c++ -*- */ 00002 /* 00003 * this is part of Spm 00004 * 00005 * Copyright (c) 2005 Guillaume Chevallereau 00006 * 00007 * This program is free software. You can redistribute it and/or modify it 00008 * under the terms of the GNU General Public License as published by the 00009 * Free Software Foundation. Either version 2 of the license or (at your 00010 * option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be usefull but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00015 * more details. 00016 * 00017 * You should have received a copy of the GNU General Public License along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00020 */ 00021 #ifndef __STEP_INTERFACE_H__ 00022 #define __STEP_INTERFACE_H__ 00023 00024 #include "interface.h" 00025 #include <string> 00026 #include <list> 00027 #include <util/def.h> 00028 #include <boost/filesystem/path.hpp> 00029 #include <util/utilException.h> 00030 00031 namespace Spm 00032 { 00033 namespace Plugin 00034 { 00035 class InstallException : public Exception 00036 { 00037 protected: 00038 InstallException () 00039 { 00040 } 00041 00042 public : 00043 InstallException (const std::string & msg) 00044 { 00045 __errMsg = msg; 00046 } 00047 }; 00048 00053 class StepInterface : public Interface 00054 { 00055 protected : 00056 std::string __stepDescription; 00057 double __fractionDone; 00058 std::map<std::string, 00059 std::string> __usedOptions; 00060 00061 StepInterface (const std::map<std::string,std::string> & pOptions) : Interface (pOptions) 00062 { 00063 __fractionDone = -1; 00064 } 00065 00066 StepInterface () 00067 { 00068 __fractionDone = -1; 00069 } 00070 00071 public : 00072 virtual ~StepInterface (){}; 00077 virtual void run (const boost::filesystem::path & dir) = 0; 00078 00082 const std::string & getStepDescription () 00083 { 00084 return __stepDescription; 00085 } 00086 00090 const std::string & getStepDescription () const 00091 { 00092 return __stepDescription; 00093 } 00094 00098 virtual double getFractionDone () 00099 { 00100 return __fractionDone; 00101 } 00102 00106 virtual double getFractionDone () const 00107 { 00108 return __fractionDone; 00109 } 00110 00115 bool handle (const std::string & uri) 00116 { 00117 return true; 00118 } 00119 00123 const std::map<std::string, 00124 std::string> & getOptions () 00125 { 00126 return __usedOptions; 00127 } 00128 00132 virtual std::list<boost::filesystem::path> getListOfFiles () = 0; 00133 }; 00134 } 00135 } 00136 00137 #endif