degate  0.1.2
ImageProcessorBase.h
Go to the documentation of this file.
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 __IMAGEPROCESSORBASE_H__
00023 #define __IMAGEPROCESSORBASE_H__
00024 
00025 #include <string>
00026 #include <ProgressControl.h>
00027 
00028 namespace degate {
00029 
00030   /**
00031    * Abstract base class for an image processor.
00032    */
00033 
00034 
00035   class ImageProcessorBase : public ProgressControl {
00036 
00037     friend class IPPipe;
00038 
00039   private:
00040 
00041     const std::string name;
00042     const std::string description;
00043 
00044     const bool has_properties;
00045 
00046     std::string type_in;
00047     std::string type_out;
00048 
00049   protected:
00050 
00051 
00052     std::string const& get_type_in() const {
00053       return type_in;
00054     }
00055 
00056     std::string const& get_type_out() const {
00057       return type_out;
00058     }
00059 
00060 
00061   public:
00062 
00063     /**
00064      * The constructor for a plugin
00065      * @param _name The name of the plugin.
00066      */
00067 
00068     ImageProcessorBase(std::string const& _name,
00069                        std::string const& _description,
00070                        bool _has_properties,
00071                        std::type_info const& _type_in,
00072                        std::type_info const& _type_out) :
00073       name(_name),
00074       description(_description),
00075       has_properties(_has_properties),
00076       type_in(_type_in.name()),
00077       type_out(_type_out.name()) {}
00078 
00079     /**
00080      * The destructor for a plugin.
00081      */
00082 
00083     virtual ~ImageProcessorBase() {}
00084 
00085 
00086     /**
00087      * Get the processor's name.
00088      */
00089 
00090     std::string const& get_name() const {
00091       return name;
00092     }
00093 
00094     /**
00095      * Get the processor's description.
00096      */
00097 
00098     std::string const& get_description() const {
00099       return description;
00100     }
00101 
00102     /**
00103      * Start processing.
00104      */
00105     virtual ImageBase_shptr run(ImageBase_shptr _in) = 0;
00106 
00107 
00108     /**
00109      * Check if the processor can be configured.
00110      */
00111     virtual bool has_property() const {
00112       return has_properties;
00113     }
00114 
00115   };
00116 
00117   typedef std::shared_ptr<ImageProcessorBase> ImageProcessorBase_shptr;
00118 }
00119 
00120 #endif
00121