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