torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScalarPort.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_SCALARPORT_HPP
17 #define TORC_GENERIC_SCALARPORT_HPP
18 
20 
21 //BOOST
22 #ifdef GENOM_SERIALIZATION
23 #include <boost/serialization/access.hpp>
24 #endif //GENOM_SERIALIZATION
25 #include "torc/generic/Error.hpp"
27 #include "torc/generic/Port.hpp"
28 #include "torc/generic/Scalar.hpp"
30 
31 namespace torc { namespace generic { class BaseVisitor; } }
32 
33 namespace torc {
34 namespace generic {
35 
36 /**
37  * @brief Represents a standalone port
38  *
39  * The ScalarPort class represents a standalone port object. Such objects in EDIF are declared
40  * using the (port portName ... ) syntax.
41  */
42 class ScalarPort : public Port, public Scalar<Port> {
43 #ifdef GENOM_SERIALIZATION
44  friend class boost::serialization::access;
45 #endif //GENOM_SERIALIZATION
46  friend class FactoryType<ScalarPort> ;
47 
48 public:
50 
51  /**
52  * Convenience class to create a scalar port.
53  */
54  class Factory : public FactoryType<ScalarPort> {
55  public:
57  /**
58  * Create a scalar port.
59  *
60  * @param[in] inName Name of the scalar port to be created.
61  * @param[in] inDirection Direction of port.
62  * @param[in] inViewPtr Pointer to parented(View) object.
63  * @param[in] inParentCollection Pointer to parent bundle.
64  * @param[in] inOriginalName Original name of the scalar port [optional].
65  *
66  * @return Pointer to created scalar port.
67  **/
68  virtual ScalarPortSharedPtr newScalarPortPtr(const std::string& inName,
69  const EPortDirection& inDirection, const ViewSharedPtr& inViewPtr,
70  const PortBundleSharedPtr& inParentCollection = PortBundleSharedPtr(),
71  const std::string& inOriginalName = std::string()) throw (Error);
72  };
73 
74  virtual void accept(BaseVisitor& inoutVisitor) throw (Error);
75 
76  /**
77  * @exception Error Pointer to the Net object does not exists
78  * <ul>
79  * <li>
80  * Id : eMessageIdErrorPointerToItemDoesNotExist
81  * </li>
82  * <li> Context Data
83  * <ul>
84  * <li>Pointe to Net object - <i>Net</i></li>
85  * </ul>
86  * </li>
87  * </ul>
88  *
89  * @exception Error Net size does not match with scalar port size
90  * <ul>
91  * <li>
92  * Id : eMessageIdErrorItemSizeMismatch
93  * </li>
94  * <li> Context Data
95  * <ul>
96  * <li>Net Size - <i>SizeType</i></li>
97  * <li>Scalar port Size - <i>SizeType</i></li>
98  * </ul>
99  * </li>
100  * </ul>
101  *
102  */
103 
104  virtual Connection connect(const NetSharedPtr& inNet) throw (Error);
105 
107 
108  virtual void disconnect(const Connection& inConnection) throw (Error);
109 
110  virtual ~ScalarPort() throw ();
111 
112 protected:
113  ScalarPort();
114 
115 private:
116 #ifdef GENOM_SERIALIZATION
117  template <class Archive> void serialize(Archive& ar, unsigned int);
118 #endif //GENOM_SERIALIZATION
119 };
120 
121 } // namespace generic
122 } // namespace torc
123 
124 #endif // TORC_GENERIC_SCALARPORT_HPP
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
virtual ScalarPortSharedPtr newScalarPortPtr(const std::string &inName, const EPortDirection &inDirection, const ViewSharedPtr &inViewPtr, const PortBundleSharedPtr &inParentCollection=PortBundleSharedPtr(), const std::string &inOriginalName=std::string())
Definition: ScalarPort.cpp:50
A single object with no child objects.
Definition: Scalar.hpp:34
boost::shared_ptr< ScalarPort > ScalarPortSharedPtr
boost::shared_ptr< PortBundle > PortBundleSharedPtr
std::list< NetSharedPtr >::iterator Connection
Definition: Connectable.hpp:52
virtual Connection connect(const NetSharedPtr &inNet)
Definition: ScalarPort.cpp:81
std::string string
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
boost::shared_ptr< Net > NetSharedPtr
A base class for Visitor.
Definition: VisitorType.hpp:31
Represents a standalone port.
Definition: ScalarPort.hpp:42
Interface for an EDIF port object.
boost::shared_ptr< View > ViewSharedPtr
A placeholder for a factory method.
Definition: FactoryType.hpp:35
virtual void accept(BaseVisitor &inoutVisitor)
Definition: ScalarPort.cpp:72
VisitorType< ScalarPort > Visitor
Definition: ScalarPort.hpp:49