torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScalarPortReference.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_SCALARPORTREFERENCE_HPP
17 #define TORC_GENERIC_SCALARPORTREFERENCE_HPP
18 
20 
21 //BOOST
22 #ifdef GENOM_SERIALIZATION
23 #include <boost/serialization/access.hpp>
24 #endif //GENOM_SERIALIZATION
26 #include "torc/generic/Scalar.hpp"
29 #include "torc/generic/Error.hpp"
30 
31 namespace torc { namespace generic { class BaseVisitor; } }
32 
33 namespace torc {
34 namespace generic {
35 
36 /**
37  * @brief Represents areference to a standalone port
38  *
39  * The ScalarPortReference class represents a reference to a a standalone port object.
40  */
41 class ScalarPortReference : public PortReference, public Scalar<PortReference> {
42 #ifdef GENOM_SERIALIZATION
43  friend class boost::serialization::access;
44 #endif //GENOM_SERIALIZATION
46 
47 public:
49 
50  /**
51  * Convenience class to create a scalar port ref.
52  */
53  class Factory : public FactoryType<ScalarPortReference> {
54  public:
56  /**
57  * Create a scalar port ref.
58  *
59  * @param[in] inInstancePtr Pointer to parented(Instance) object.
60  * @param[in] inPortPtr Pointer to master(Port) object.
61  * @param[in] inParentCollection Pointer to parent bundle.
62  *
63  * @return Pointer to created scalar port ref.
64  **/
66  const InstanceSharedPtr& inInstancePtr, const PortSharedPtr& inPortPtr,
67  const PortBundleReferenceSharedPtr& inParentCollection = PortBundleReferenceSharedPtr())
68  throw (Error);
69  };
70 
71  virtual void accept(BaseVisitor& inoutVisitor) throw (Error);
72 
73  /**
74  * @exception Error Pointer to the Net object does not exists
75  * <ul>
76  * <li>
77  * Id : eMessageIdErrorPointerToItemDoesNotExist
78  * </li>
79  * <li> Context Data
80  * <ul>
81  * <li>Pointe to Net object - <i>Net</i></li>
82  * </ul>
83  * </li>
84  * </ul>
85  *
86  * @exception Error Net size does not match with scalar port reference size
87  * <ul>
88  * <li>
89  * Id : eMessageIdErrorItemSizeMismatch
90  * </li>
91  * <li> Context Data
92  * <ul>
93  * <li>Net Size - <i>SizeType</i></li>
94  * <li>Scalar port reference Size - <i>SizeType</i></li>
95  * </ul>
96  * </li>
97  * </ul>
98  *
99  */
100 
101  virtual Connection connect(const NetSharedPtr& inNet) throw (Error);
102 
104 
105  virtual void disconnect(const Connection& inConnection) throw (Error);
106 
107  ~ScalarPortReference() throw ();
108 
109 protected:
111 
112 private:
113 #ifdef GENOM_SERIALIZATION
114  template <class Archive> void serialize(Archive& ar, unsigned int);
115 #endif //GENOM_SERIALIZATION
116 };
117 
118 } // namespace generic
119 } // namespace torc
120 
121 #endif // TORC_GENERIC_SCALARPORTREFERENCE_HPP
virtual void accept(BaseVisitor &inoutVisitor)
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
boost::shared_ptr< Instance > InstanceSharedPtr
virtual Connection connect(const NetSharedPtr &inNet)
Represents areference to a standalone port.
A single object with no child objects.
Definition: Scalar.hpp:34
Represents the usable instance of a port of a cell in another cell.
std::list< NetSharedPtr >::iterator Connection
Definition: Connectable.hpp:52
boost::shared_ptr< ScalarPortReference > ScalarPortReferenceSharedPtr
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
virtual ScalarPortReferenceSharedPtr newScalarPortReferencePtr(const InstanceSharedPtr &inInstancePtr, const PortSharedPtr &inPortPtr, const PortBundleReferenceSharedPtr &inParentCollection=PortBundleReferenceSharedPtr())
VisitorType< ScalarPortReference > Visitor
boost::shared_ptr< Port > PortSharedPtr
A placeholder for a factory method.
Definition: FactoryType.hpp:35
boost::shared_ptr< PortBundleReference > PortBundleReferenceSharedPtr