degate  0.1.2
Via.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 __VIA_H__
00024 #define __VIA_H__
00025 
00026 #include "globals.h"
00027 #include "LogicModelObjectBase.h"
00028 #include "Net.h"
00029 #include "Layer.h"
00030 #include "LogicModel.h"
00031 #include "ConnectedLogicModelObject.h"
00032 #include "degate_exceptions.h"
00033 #include "Wire.h"
00034 #include "Circle.h"
00035 #include <RemoteObject.h>
00036 
00037 #include <memory>
00038 
00039 namespace degate {
00040 
00041   /**
00042    * Representation of a via that interconnects layers of a chip.
00043    */
00044   class Via : public Circle, public ConnectedLogicModelObject, public RemoteObject {
00045 
00046   public:
00047 
00048     /**
00049      * An enum to indicate, which layer is connected.
00050      *
00051      * Vias are placed on a layer. If the via connects an object
00052      * from the current layer to a layer that is above, then the
00053      * direction is up.
00054      */
00055 
00056     enum DIRECTION {
00057       DIRECTION_UNDEFINED = 0,
00058       DIRECTION_UP = 1,
00059       DIRECTION_DOWN = 2
00060     };
00061 
00062   private:
00063 
00064     DIRECTION direction;
00065 
00066   public:
00067 
00068     explicit Via() {};
00069 
00070     /**
00071      * Constructor for a via object.
00072      */
00073 
00074     Via(int _x, int _y, diameter_t _diameter, DIRECTION _direction = DIRECTION_UNDEFINED);
00075 
00076     /**
00077      * Destructor for a via object.
00078      */
00079 
00080     virtual ~Via();
00081 
00082     //@{
00083     DeepCopyable_shptr cloneShallow() const;
00084     void cloneDeepInto(DeepCopyable_shptr destination, oldnew_t *oldnew) const;
00085     //@}
00086 
00087     /**
00088      * Get direction.
00089      */
00090 
00091     virtual DIRECTION get_direction() const;
00092 
00093     /**
00094      * Set direction.
00095      */
00096 
00097     virtual void set_direction(DIRECTION dir);
00098 
00099     /**
00100      * Get the direction as a human readable string.
00101      */
00102 
00103     virtual const std::string get_direction_as_string() const;
00104 
00105 
00106     /**
00107      * Parse a via direction string and return it as enum value.
00108      */
00109     static Via::DIRECTION get_via_direction_from_string(std::string const& via_direction_str);
00110 
00111     /**
00112      * Get a human readable string that describes the whole
00113      * logic model object. The string should be unique in order
00114      * to let the user identify the concrete object. But that
00115      * is not a must.
00116      */
00117 
00118     virtual const std::string get_descriptive_identifier() const;
00119 
00120     /**
00121      * Get a human readable string that names the object type.
00122      * Here it is "Via".
00123      */
00124 
00125     virtual const std::string get_object_type_name() const;
00126 
00127     /**
00128      * Print the object.
00129      */
00130 
00131     void print(std::ostream & os, int n_tabs) const;
00132 
00133 
00134 
00135     void shift_x(int delta_x);
00136     void shift_y(int delta_y);
00137     void set_x(int x);
00138     void set_y(int y);
00139     void set_diameter(unsigned int diameter);
00140 
00141     virtual bool in_bounding_box(BoundingBox const& bbox) const {
00142       return Circle::in_bounding_box(bbox);
00143     }
00144 
00145     virtual BoundingBox const& get_bounding_box() const {
00146       return Circle::get_bounding_box();
00147     }
00148 
00149     virtual bool in_shape(int x, int y, int max_distance = 0) const {
00150       return Circle::in_shape(x, y, max_distance);
00151     }
00152 
00153   protected:
00154 
00155     virtual object_id_t push_object_to_server(std::string const& server_url);
00156 
00157   };
00158 
00159 
00160 }
00161 
00162 #endif