torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PortReference.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_GENERIC_PORTREFERENCE_HPP
17 #define TORC_GENERIC_PORTREFERENCE_HPP
18 
20 
21 //BOOST
22 #ifdef GENOM_SERIALIZATION
23 #include <boost/serialization/access.hpp>
24 #endif //GENOM_SERIALIZATION
31 
32 namespace torc { namespace generic { class Port; } }
33 namespace torc { namespace generic { class PortAttributes; } }
34 
35 namespace torc {
36 namespace generic {
37 
38 /**
39  * @brief Represents the usable instance of a port of a cell in another cell
40  *
41  * The PortReference class is used to provide an interface for port usage of an instantiated cell.
42  * In other words, it more or less models the (portRef ...) keyword in EDIF. However, unlike a
43  * simple portRef, this can have properties that can be assigned to a portRef using
44  * (portInstance ...) syntax. This interface can be used to refer to all types of port
45  * references(scalar, vector, vector-bit and bundle).
46  */
47 class PortReference : public Connectable, public PropertyContainer, public Visitable,
48  virtual public Composite<PortReference>, public ParentedObject<Instance> {
49 
50 #ifdef GENOM_SERIALIZATION
51  friend class boost::serialization::access;
52 #endif //GENOM_SERIALIZATION
53 public:
54  PortReference();
55 
56  virtual ~PortReference() throw ();
57 
58 private:
59  PortReference(const PortReference& source);
60 
61  PortReference& operator=(const PortReference& source);
62 
63 public:
64  /**
65  * Get the master(referred) port.
66  *
67  * @return The master port.
68  */
69  inline PortSharedPtr getMaster() const;
70 
71  /**
72  * Set master port.
73  *
74  * @param[in] inMaster Set the master port.
75  */
76  virtual void bindToMasterPort(const PortSharedPtr& inMaster) throw (Error);
77 
78  /**
79  * Get the attributes of the port. Attributes include dcFaninLoad, dcFanoutLoad_ etc.
80  *
81  * @return Pointer to PortAttributes object.
82  */
83  inline const PortAttributesSharedPtr getAttributes() const;
84 
85  /**
86  * Set the attributes of the port. Attributes include dcFaninLoad, dcFanoutLoad_ etc.
87  *
88  * @note This method does not check whether prior set of properties exist or not. Newly set property will remove old properties.
89  *
90  * @param[in] inSource Pointer to PortAttributes object.
91  */
92  void setAttributes(const PortAttributesSharedPtr& inSource);
93 
94  /**
95  * Get name of port-ref. This will return the same name as the master.
96  *
97  * @return Name of the master if master is set. Otherwise returns empty string.
98  */
100 
101 private:
102 #ifdef GENOM_SERIALIZATION
103  template <class Archive> void serialize(Archive& ar, unsigned int);
104 #endif //GENOM_SERIALIZATION
107 };
108 
109 /**
110  * Get the master(referred) port.
111  *
112  * @return The master port.
113  */
115  return mMaster;
116 }
117 
118 /**
119  * Get the attributes of the port. Attributes include dcFaninLoad, dcFanoutLoad_ etc.
120  *
121  * @return Pointer to PortAttributes object.
122  */
124  return mAttributes;
125 }
126 
127 } // namespace generic
128 } // namespace torc
129 
130 #endif // TORC_GENERIC_PORTREFERENCE_HPP
An object that has a parent.
Represents the usable instance of a port of a cell in another cell.
Represents objects that have properties.
Interface for objects that can be composed within each other.
Definition: Composite.hpp:45
An object that is connectable to a Net.
Definition: Connectable.hpp:44
PortSharedPtr getMaster() const
std::string string
boost::shared_ptr< PortAttributes > PortAttributesSharedPtr
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
virtual void bindToMasterPort(const PortSharedPtr &inMaster)
PortAttributesSharedPtr mAttributes
boost::shared_ptr< Port > PortSharedPtr
void setAttributes(const PortAttributesSharedPtr &inSource)
const PortAttributesSharedPtr getAttributes() const
PortReference & operator=(const PortReference &source)
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38