torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
generic/Port.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_PORT_HPP
17 #define TORC_GENERIC_PORT_HPP
18 
20 
21 //BOOST
22 #ifdef GENOM_SERIALIZATION
23 #include <boost/serialization/access.hpp>
24 #endif //GENOM_SERIALIZATION
27 #include "torc/generic/Extern.hpp"
35 #include "torc/generic/View.hpp"
37 
38 namespace torc { namespace generic { class PortAttributes; } }
39 
40 namespace torc {
41 namespace generic {
42 
43 /**
44  * @brief Interface for an EDIF port object
45  *
46  * The Port class acts as an interface for ports in an EDIF cell. A port can be of scalar, vector
47  * or bundle type. This class provides a simplified view of all three types of port. To get a
48  * handle to an actual port, the client will have to use a Visitor with proper overloads of the
49  * visit() function, or dynamic_cast can be used. The latter method is however not recommended. A
50  * port object supports storing properties for storing different EDIF properties. See documentation
51  * of the Property and PropertyContainer classes for more details.
52  */
53 class Port : public Commentable, public Connectable, public Extern, public Nameable,
54  public PropertyContainer, public Renamable, public Visitable, virtual public Composite<Port>,
55  public ParentedObject<View>, public UserDataContainer {
56 #ifdef GENOM_SERIALIZATION
57  friend class boost::serialization::access;
58 #endif //GENOM_SERIALIZATION
59 public:
60  /**
61  * Get the direction of port
62  *
63  * @return Direction of port
64  */
65  inline const EPortDirection getDirection() const;
66 
67  /**
68  * Set the direction of port
69  *
70  * @param[in] inSource Direction of port
71  */
72  void setDirection(const EPortDirection& inSource);
73 
74  /**
75  * Get the attributes of the port. Attributes include dcFaninLoad, dcFanoutLoad_ etc.
76  *
77  * @return Pointer to PortAttributes object.
78  */
79  inline const PortAttributesSharedPtr
80  getAttributes() const;
81 
82  /**
83  * Set the attributes of the port. Attributes include dcFaninLoad, dcFanoutLoad_ etc.
84  *
85  * @note This method does not check whether prior set of properties exist or not. Newly set property will remove old properties.
86  *
87  * @param[in] inSource Pointer to PortAttributes object.
88  */
89  void setAttributes(const PortAttributesSharedPtr& inSource);
90 
91 protected:
92  explicit Port();
93 
94 public:
95  virtual ~Port() throw ();
96 
97 private:
98 #ifdef GENOM_SERIALIZATION
99  template <class Archive> void serialize(Archive& ar, unsigned int);
100 #endif //GENOM_SERIALIZATION
101  Port(const Port& source);
102 
103  Port& operator=(const Port& source);
104 
107 };
108 
109 /**
110  * Get the direction of port
111  *
112  * @return Direction of port
113  */
114 inline const EPortDirection Port::getDirection() const {
115  return mDirection;
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_PORT_HPP
An object that has a parent.
const EPortDirection getDirection() const
Represents objects that have properties.
const PortAttributesSharedPtr getAttributes() const
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
Represents all classes that can hold user comments.
Definition: Commentable.hpp:36
PortAttributesSharedPtr mAttributes
Represents class that can hold userData.
void setDirection(const EPortDirection &inSource)
EPortDirection mDirection
boost::shared_ptr< PortAttributes > PortAttributesSharedPtr
void setAttributes(const PortAttributesSharedPtr &inSource)
Interface for an EDIF port object.
An object that has a name.
Definition: Nameable.hpp:34
Represents objects that can be renamed.
Port & operator=(const Port &source)
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38
Used to implement external object referencing.
Definition: Extern.hpp:36