Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ImageProgress.hpp

Go to the documentation of this file.
00001 /* ImLib3D
00002  * Copyright (c) 2001, ULP-IPB Strasbourg.
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or (at
00007  * your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00020 #ifndef _ImageProgress_hpp
00021 #define _ImageProgress_hpp
00022 
00023 #include<ImLib3D/TaskProgressManager.hpp>
00024 #include<ImLib3D/ImLib3D.hpp>
00025 
00026 class ImageProgressHelper
00027 {
00028 public:
00029     virtual double Progress() const =0;
00030     virtual ~ImageProgressHelper(){;};
00031 };
00032 template<class ItType>
00033 class ImageProgressHelperNormal : public ImageProgressHelper
00034 {
00035     ItType *it;
00036 public:
00037     virtual double Progress() const {return it->Progress();}
00038     ImageProgressHelperNormal(ItType &_it):it(&_it){;}
00039 };
00041 
00043 class ImageProgress : public TaskInProgress
00044 {
00045     ImageProgressHelper *helper;
00046 public:
00047     virtual double Progress() const {return helper->Progress();}
00048     virtual string ProgressLabel() const {return SPrintf("%2.1f%%",100*Progress());}
00050     template<class ItType>
00051     ImageProgress(const string &_name,ItType &p):
00052         TaskInProgress(_name,imLib3D.taskProgressManager),
00053         helper(new ImageProgressHelperNormal<ItType>(p))
00054     {
00055     }
00056     virtual ~ImageProgress(){delete helper;}
00057 };
00058 
00059 
00060 #endif //_ImageProgress_hpp

Generated on Fri Jun 17 13:36:04 2005 for ImLib3D by  doxygen 1.4.2