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/RcFactory.hpp $ 00003 // $Id: RcFactory.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 /// \file 00017 /// \brief Header for the RcFactory class. 00018 00019 #ifndef TORC_PACKER_RCFACTORY_HPP 00020 #define TORC_PACKER_RCFACTORY_HPP 00021 00022 #include "torc/physical/Design.hpp" 00023 #include "torc/packer/PrimitiveSet.hpp" 00024 #include "torc/packer/RoutingNet.hpp" 00025 #include "torc/packer/CombinationalPath.hpp" 00026 #include <string> 00027 #include <boost/smart_ptr.hpp> 00028 00029 namespace torc { 00030 namespace physical { 00031 00032 /// \brief RcFactory class for physical netlist elements. 00033 /// \details Physical netlist elements must be created by this RcFactory. 00034 class RcFactory { 00035 protected: 00036 // friends 00037 /// \brief Imported type name. 00038 typedef std::string string; 00039 public: 00040 // functions 00041 /// \brief Create and return a new PrimitiveSet object. 00042 static PrimitiveSetSharedPtr newPrimitiveSetPtr(const string& inName) { 00043 PrimitiveSetSharedPtr PrimitiveSetPtr(new PrimitiveSet(inName)); 00044 PrimitiveSetPtr->setSelfWeakPtr(PrimitiveSetPtr); 00045 return PrimitiveSetPtr; 00046 } 00047 00048 /// \brief Create and return a new Element object. 00049 static ElementSharedPtr newElementPtr(const string& inName) { 00050 ElementSharedPtr elementPtr(new Element(inName)); 00051 elementPtr->setSelfWeakPtr(elementPtr); 00052 return elementPtr; 00053 } 00054 00055 /// \brief Create and return a new RoutingNet object. 00056 static RoutingNetSharedPtr newRoutingNePtr(NetSharedPtr snet) { 00057 RoutingNetSharedPtr routingNetPtr(new RoutingNet(snet)); 00058 return routingNetPtr; 00059 } 00060 00061 /// \brief Create and return a new CombinationalPath object. 00062 static CombinationalPathSharedPtr newCombinationalPathPtr() { 00063 CombinationalPathSharedPtr combinationalPathPtr(new CombinationalPath()); 00064 return combinationalPathPtr; 00065 } 00066 00067 /// \brief Create and return a new Element object. 00068 static PrimitiveSharedPtr newPrimitivePtr(const string& inName) { 00069 PrimitiveSharedPtr primitivePtr(new Primitive(inName)); 00070 primitivePtr->setSelfWeakPtr(primitivePtr); 00071 return primitivePtr; 00072 } 00073 00074 /// \brief Construct an ConnectionPin and return a constant reference. 00075 /// \param inConnectionPtr The pin instance pointer. 00076 /// \param inPinName The pin name. 00077 static ConnectionPin newConnectionPin(string inElementName, 00078 const string& inPinName) { 00079 return ConnectionPin(inElementName, inPinName); 00080 } 00081 00082 /// \brief Create and return a new Element object. 00083 static ConnectionSharedPtr newConnectionPtr(const string& inName) { 00084 ConnectionSharedPtr connectionPtr(new Connection(inName)); 00085 return connectionPtr; 00086 } 00087 00088 /// \brief Create and return a new PrimitivePin shared pointer. 00089 /// \param inName The PrimitivePin name. 00090 /// \param inInstancePtr The PrimitivePin instance pointer. 00091 /// \param inPinName The PrimitivePin pin name. 00092 static PrimitivePinSharedPtr newPrimitivePinPtr(string inElementName, string inPinName, const PinType inType) { 00093 PrimitivePinSharedPtr PrimitivePinPtr(new PrimitivePin(inElementName, inPinName, inType)); 00094 return PrimitivePinPtr; 00095 } 00096 00097 }; 00098 00099 } // namespace physical 00100 } // namespace torc 00101 00102 #endif // TORC_PACKER_RCFACTORY_HPP