degate  0.1.2
PlacedLogicModelObject.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 __PLACEDLOGICMODELOBJECT_H__
00024 #define __PLACEDLOGICMODELOBJECT_H__
00025 
00026 #include <globals.h>
00027 #include <LogicModelObjectBase.h>
00028 #include <Layer.h>
00029 #include <Shape.h>
00030 
00031 namespace degate {
00032 
00033   /**
00034    * Represents a placeable object.
00035    *
00036    * Any class that represents a somewhere placeable objects should inherit
00037    * from that base class. The term "placed objects" is related to real
00038    * existent physical structures on the chip surface
00039    * (e.g. wire, vias, ...) as well as logical objects (e.g. annotations).
00040    */
00041 
00042   class PlacedLogicModelObject : public AbstractShape,
00043                                  public LogicModelObjectBase,
00044                                  public ColoredObject,
00045          public DeepCopyable {
00046 
00047   public:
00048 
00049     enum HIGHLIGHTING_STATE {
00050       HLIGHTSTATE_NOT = 0,
00051       HLIGHTSTATE_DIRECT = 1,
00052       HLIGHTSTATE_ADJACENT = 2
00053     };
00054 
00055   private:
00056 
00057     HIGHLIGHTING_STATE highlight_state;
00058     std::shared_ptr<Layer> layer;
00059 
00060   protected:
00061 
00062     /**
00063      * Ajust the position in the quadtree.
00064      */
00065 
00066     void notify_shape_change();
00067 
00068   public:
00069 
00070     /**
00071      * The constructor.
00072      */
00073 
00074     PlacedLogicModelObject();
00075 
00076     /**
00077      * The destructor.
00078      */
00079 
00080     virtual ~PlacedLogicModelObject();
00081 
00082     void cloneDeepInto(DeepCopyable_shptr destination, oldnew_t *oldnew) const;
00083 
00084     /**
00085      * A placed object is highlightable. You can ask for its
00086      * state with this method.
00087      */
00088 
00089     virtual HIGHLIGHTING_STATE get_highlighted() const;
00090 
00091     /**
00092      * Check if an object is highlighted at all.
00093      */
00094     virtual bool is_highlighted() const;
00095 
00096     /**
00097      * Set the selection state.
00098      */
00099 
00100     virtual void set_highlighted(HIGHLIGHTING_STATE state);
00101 
00102     /**
00103      * Set the layer on which the object is placed.
00104      */
00105 
00106     virtual void set_layer(std::shared_ptr<Layer> layer);
00107 
00108     /**
00109      * Get the layer on which the object is placed.
00110      */
00111 
00112     virtual std::shared_ptr<Layer> get_layer();
00113 
00114 
00115     /**
00116      * Print the object.
00117      */
00118 
00119     virtual void print(std::ostream & os = std::cout, int n_tabs = 0) const = 0;
00120 
00121   };
00122 
00123 }
00124 
00125 #endif