torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
generic/Port.cpp
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 HAVE_CONFIG_H
17 #include "torc/generic/config.h"
18 #endif
19 
20 #ifdef GENOM_SERIALIZATION
21 #include <boost/archive/binary_iarchive.hpp>
22 #include <boost/archive/binary_oarchive.hpp>
23 #include <boost/serialization/base_object.hpp>
24 #include <boost/serialization/is_abstract.hpp>
25 #endif //GENOM_SERIALIZATION
26 #include "torc/generic/Port.hpp"
28 
29 #ifdef GENOM_SERIALIZATION
30 #endif //GENOM_SERIALIZATION
31 namespace torc {
32 namespace generic {
33 
36  mDirection(ePortDirectionUndefined), mAttributes() {}
37 
38 Port::~Port() throw () {}
39 
40 /**
41  * Set the direction of port
42  *
43  * @param[in] inSource Direction of port
44  */
45 void Port::setDirection(const EPortDirection& inSource) {
46  mDirection = inSource;
47 }
48 
49 /**
50  * Set the attributes of the port. Attributes include dcFaninLoad, dcFanoutLoad_ etc.
51  *
52  * @note This method does not check whether prior set of properties exist or not. Newly set property will remove old properties.
53  *
54  * @param[in] inSource Pointer to PortAttributes object.
55  */
57  mAttributes = inSource;
58 }
59 
60 #ifdef GENOM_SERIALIZATION
61 template <class Archive> void Port::serialize(Archive& ar, unsigned int) {
62  ar & boost::serialization::base_object<Commentable>(*this);
63  ar & boost::serialization::base_object<Connectable>(*this);
64  ar & boost::serialization::base_object<Extern>(*this);
65  ar & boost::serialization::base_object<Nameable>(*this);
66  ar & boost::serialization::base_object<PropertyContainer>(*this);
67  ar & boost::serialization::base_object<Renamable>(*this);
68  ar & boost::serialization::base_object<Visitable>(*this);
69  ar & boost::serialization::base_object<Composite<Port> >(*this);
70  ar & mDirection;
71  ar & mAttributes;
72  //We do not serialize the parent pointer
73 }
74 
75 //TO SATISFY THE LINKER
76 template void Port::serialize<boost::archive::binary_iarchive>(
77  boost::archive::binary_iarchive& ar, const unsigned int);
78 
79 template void Port::serialize<boost::archive::binary_oarchive>(
80  boost::archive::binary_oarchive& ar, const unsigned int);
81 
82 #endif //GENOM_SERIALIZATION
83 
84 } // namespace generic
85 } // namespace torc
An object that has a parent.
Represents objects that have properties.
Represents and EDIF View.
Definition: View.hpp:61
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)
boost::shared_ptr< PortAttributes > PortAttributesSharedPtr
EPortDirection mDirection
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.
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38
Used to implement external object referencing.
Definition: Extern.hpp:36