00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/packer/PrimitivePin.hpp $ 00003 // $Id: PrimitivePin.hpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 #ifndef TORC_PACKER_PRIMITIVEPIN_HPP 00017 #define TORC_PACKER_PRIMITIVEPIN_HPP 00018 00019 #include "torc/physical/XilinxPhysicalTypes.hpp" 00020 #include "torc/physical/Named.hpp" 00021 #include <boost/smart_ptr.hpp> 00022 #include <string> 00023 #include <vector> 00024 00025 namespace torc { 00026 namespace physical { 00027 00028 using namespace std; 00029 00030 //pin types 00031 typedef enum { Unknown, InputP, OutputP } PinType; 00032 00033 /// \brief Physical design primitive-pin 00034 /// \details This class specifies a pin on a physical design primitive. 00035 00036 class PrimitivePin: public Named { 00037 // friends 00038 /// \brief The Factory class has direct access to our internals. 00039 friend class RcFactory; 00040 protected: 00041 typedef std::string string; 00042 /// \brief Element Name 00043 string mElementName; 00044 /// \brief Type of pin 00045 PinType mType; 00046 00047 /// \brief Construct from primitive reference and pin name. 00048 PrimitivePin(string inElementName, string inPinName, const PinType inType) 00049 : Named(inPinName), mElementName(inElementName), mType(inType) {} 00050 public: 00051 00052 /// \brief Returns the element pointer or NULL. 00053 const string& getElementName(void) const { return mElementName; } 00054 /// \brief Returns pin type. 00055 const PinType getType(void) const { return mType; } 00056 00057 /// \brief Returns the type string. 00058 const string getTypeString(void) const { 00059 00060 string sTmp = (mType==Unknown) ? "Unknown" : (mType==InputP) ? "input":"output"; 00061 return sTmp; 00062 } 00063 00064 /// \brief Equality operator. 00065 bool operator ==(const PrimitivePin& rhs) const { return mElementName == rhs.mElementName 00066 && mName == rhs.mName && mType == mType; } 00067 }; 00068 00069 /// \brief Vector of primitive pins. 00070 typedef std::vector<PrimitivePin> PrimitivePinVector; 00071 00072 /// \brief Shared pointer encapsulation of a componenet 00073 typedef boost::shared_ptr<PrimitivePin> PrimitivePinSharedPtr; 00074 00075 /// \brief Weak pointer encapsulation of a componenet 00076 typedef boost::weak_ptr<PrimitivePin> PrimitivePinWeakPtr; 00077 00078 /// \brief Vector of componenet shared pointers. 00079 typedef std::vector<PrimitivePinSharedPtr> PrimitivePinSharedPtrVector; 00080 00081 00082 } // namespace physical 00083 } // namespace torc 00084 00085 #endif // TORC_PACKER_PRIMITIVEPIN_HPP