torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
packer/PrimitivePin.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_PACKER_PRIMITIVEPIN_HPP
17 #define TORC_PACKER_PRIMITIVEPIN_HPP
18 
20 #include "torc/physical/Named.hpp"
21 #include <boost/smart_ptr.hpp>
22 #include <string>
23 #include <vector>
24 
25 namespace torc {
26 namespace physical {
27 
28  using namespace std;
29 
30  //pin types
31  typedef enum { Unknown, InputP, OutputP } PinType;
32 
33  /// \brief Physical design primitive-pin
34  /// \details This class specifies a pin on a physical design primitive.
35 
36  class PrimitivePin: public Named {
37  // friends
38  /// \brief The Factory class has direct access to our internals.
39  friend class RcFactory;
40  protected:
42  /// \brief Element Name
43  string mElementName;
44  /// \brief Type of pin
46 
47  /// \brief Construct from primitive reference and pin name.
48  PrimitivePin(string inElementName, string inPinName, const PinType inType)
49  : Named(inPinName), mElementName(inElementName), mType(inType) {}
50  public:
51 
52  /// \brief Returns the element pointer or NULL.
53  const string& getElementName(void) const { return mElementName; }
54  /// \brief Returns pin type.
55  const PinType getType(void) const { return mType; }
56 
57  /// \brief Returns the type string.
58  const string getTypeString(void) const {
59 
60  string sTmp = (mType==Unknown) ? "Unknown" : (mType==InputP) ? "input":"output";
61  return sTmp;
62  }
63 
64  /// \brief Equality operator.
65  bool operator ==(const PrimitivePin& rhs) const { return mElementName == rhs.mElementName
66  && mName == rhs.mName && mType == mType; }
67  };
68 
69  /// \brief Vector of primitive pins.
70  typedef std::vector<PrimitivePin> PrimitivePinVector;
71 
72  /// \brief Shared pointer encapsulation of a componenet
73  typedef boost::shared_ptr<PrimitivePin> PrimitivePinSharedPtr;
74 
75  /// \brief Weak pointer encapsulation of a componenet
76  typedef boost::weak_ptr<PrimitivePin> PrimitivePinWeakPtr;
77 
78  /// \brief Vector of componenet shared pointers.
79  typedef std::vector<PrimitivePinSharedPtr> PrimitivePinSharedPtrVector;
80 
81 
82 } // namespace physical
83 } // namespace torc
84 
85 #endif // TORC_PACKER_PRIMITIVEPIN_HPP
const string & getElementName(void) const
Returns the element pointer or NULL.
string mName
The name of the object.
Definition: Named.hpp:43
std::vector< PrimitivePin > PrimitivePinVector
Vector of primitive pins.
RcFactory class for physical netlist elements.
Definition: RcFactory.hpp:34
Concept for any object that can be named.
Definition: Named.hpp:36
std::string string
const string getTypeString(void) const
Returns the type string.
Header for Xilinx physical types.
Header for the Named class.
const PinType getType(void) const
Returns pin type.
PrimitivePin(string inElementName, string inPinName, const PinType inType)
Construct from primitive reference and pin name.
boost::weak_ptr< PrimitivePin > PrimitivePinWeakPtr
Weak pointer encapsulation of a componenet.
bool operator==(const location &loc1, const location &loc2)
Compare two location objects.
Physical design primitive-pin.
boost::shared_ptr< PrimitivePin > PrimitivePinSharedPtr
Shared pointer encapsulation of a componenet.
std::vector< PrimitivePinSharedPtr > PrimitivePinSharedPtrVector
Vector of componenet shared pointers.