degate  0.1.2
ColoredObject.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  Copyright 2012 Robert Nitsch
00007 
00008  Degate is free software: you can redistribute it and/or modify
00009  it under the terms of the GNU General Public License as published by
00010  the Free Software Foundation, either version 3 of the License, or
00011  any later version.
00012 
00013  Degate is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  GNU General Public License for more details.
00017 
00018  You should have received a copy of the GNU General Public License
00019  along with degate. If not, see <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #ifndef __COLOREDOBJECT_H__
00024 #define __COLOREDOBJECT_H__
00025 
00026 #include "DeepCopyable.h"
00027 
00028 namespace degate {
00029 
00030   /**
00031    * Represents an object that has a frame and a fill color.
00032    */
00033 
00034   class ColoredObject : public DeepCopyableBase {
00035   private:
00036     color_t fill_color;
00037     color_t frame_color;
00038 
00039   public:
00040     ColoredObject() : fill_color(0), frame_color(0) {}
00041     virtual ~ColoredObject() {}
00042 
00043     //@{
00044     void cloneDeepInto(DeepCopyable_shptr dest, oldnew_t *oldnew) const {
00045       auto clone = std::dynamic_pointer_cast<ColoredObject>(dest);
00046       clone->fill_color = fill_color;
00047       clone->frame_color = frame_color;
00048     };
00049     //@}
00050     
00051     /**
00052      * Is there a frame color definition.
00053      */
00054     virtual bool has_frame_color() const { return frame_color != 0; }
00055 
00056     /**
00057      * Is there a fill color definition.
00058      */
00059     virtual bool has_fill_color() const { return fill_color != 0; }
00060 
00061     /**
00062      * Get the frame color.
00063      */
00064     virtual color_t get_frame_color() const { return frame_color; }
00065 
00066     /**
00067      * Get the fill color.
00068      */
00069     virtual color_t get_fill_color() const { return fill_color; }
00070 
00071     /**
00072      * Set the frame color.
00073      */
00074 
00075     virtual void set_frame_color(color_t c) { frame_color = c; }
00076 
00077     /**
00078      * Set the fill color.
00079      */
00080     virtual void set_fill_color(color_t c) { fill_color = c; }
00081 
00082   };
00083 
00084 }
00085 
00086 #endif