|
degate 0.1.1
|
00001 /* -*-c++-*- 00002 00003 This file is part of the IC reverse engineering tool degate. 00004 00005 Copyright 2008, 2009, 2010 by Martin Schobert 00006 00007 Degate is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 any later version. 00011 00012 Degate is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with degate. If not, see <http://www.gnu.org/licenses/>. 00019 00020 */ 00021 00022 #ifndef __IPPIPE_H__ 00023 #define __IPPIPE_H__ 00024 00025 #include <string> 00026 #include <ImageProcessorBase.h> 00027 #include <ProgressControl.h> 00028 00029 namespace degate { 00030 00031 /** 00032 * Represents an image processing pipe for multiple image processors. 00033 */ 00034 00035 00036 class IPPipe : public ProgressControl { 00037 00038 private: 00039 00040 typedef std::list<std::tr1::shared_ptr<ImageProcessorBase> > processor_list_type; 00041 processor_list_type processor_list; 00042 00043 public: 00044 00045 /** 00046 * The constructor for a processing pipe. 00047 */ 00048 00049 IPPipe() { 00050 } 00051 00052 /** 00053 * The destructor for a plugin. 00054 */ 00055 00056 virtual ~IPPipe() {} 00057 00058 00059 /** 00060 * Add a processor. 00061 */ 00062 00063 void add(std::tr1::shared_ptr<ImageProcessorBase> processor) { 00064 processor_list.push_back(processor); 00065 } 00066 00067 /** 00068 * Check if the pipe is empty 00069 * @see size() 00070 */ 00071 00072 bool is_empty() const { 00073 return processor_list.empty(); 00074 } 00075 00076 /** 00077 * Get the number of processing elements in the pipe. 00078 * @see empty() 00079 */ 00080 00081 size_t size() const { 00082 return processor_list.size(); 00083 } 00084 00085 00086 00087 00088 /** 00089 * Start processing. 00090 */ 00091 ImageBase_shptr run(ImageBase_shptr img_in) { 00092 00093 assert(img_in != NULL); 00094 00095 ImageBase_shptr last_img = img_in; 00096 00097 // iterate over list 00098 for(processor_list_type::iterator iter = processor_list.begin(); 00099 iter != processor_list.end(); ++iter) { 00100 00101 ImageProcessorBase_shptr ip = *iter; 00102 00103 assert(last_img != NULL); 00104 last_img = ip->run(last_img); 00105 assert(last_img != NULL); 00106 } 00107 00108 return last_img; 00109 } 00110 00111 00112 00113 }; 00114 00115 } 00116 00117 #endif 00118
1.7.4