torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NetBundle.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_NETBUNDLE_HPP
17 #define TORC_GENERIC_NETBUNDLE_HPP
18 
20 
21 //BOOST
22 #ifdef GENOM_SERIALIZATION
23 #include <boost/serialization/access.hpp>
24 #endif //GENOM_SERIALIZATION
25 #include "torc/generic/Net.hpp"
26 #include "torc/generic/Bundle.hpp"
29 #include "torc/generic/Error.hpp"
31 
32 namespace torc { namespace generic { class BaseVisitor; } }
33 
34 namespace torc {
35 namespace generic {
36 
37 /**
38  * @brief Represents a bundle of nets.
39  *
40  * The NetBundle class represents an EDIF net bundle. NetBundles are ordered collection of scalar
41  * and vector nets and can be created using the (nettBundle ...) syntax.
42  */
43 class NetBundle : public Net, public Bundle<Net> {
44 #ifdef GENOM_SERIALIZATION
45  friend class boost::serialization::access;
46 #endif //GENOM_SERIALIZATION
47  friend class FactoryType<NetBundle> ;
48 
49 public:
51 
52  /**
53  * Convenience class to create a net bundle.
54  */
55  class Factory : public FactoryType<NetBundle> {
56  public:
58  /**
59  * Create a net bundle.
60  *
61  * @param[in] inName Name of the net bundle to be created.
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 net bundle [optional].
65  *
66  * @return Pointer to created net bundle.
67  **/
68  virtual NetBundleSharedPtr newNetBundlePtr(const std::string& inName,
69  const ViewSharedPtr& inViewPtr, const NetBundleSharedPtr& inParentCollection =
70  NetBundleSharedPtr(), const std::string& inOriginalName = std::string())
71  throw (Error);
72  };
73 
74  virtual void accept(BaseVisitor& inoutVisitor) throw (Error);
75 
76  virtual void setParent(const ViewSharedPtr& inParent);
77 
78  /**
79  * Connect the given net with this net. During connection, a none-to-one correspondence is
80  * maintained, and all children of the given net are connected to the children of the current
81  * net. As a result, if the given net is a preserved vector, it will be exploded.
82  * @param[in] inNet Net to be connected to the current net
83  *
84  * @exception Error Provided connection is invalid, because pointer to the Net does not exist
85  * <ul>
86  * <li>
87  * Id : eMessageIdErrorPointerToItemDoesNotExist
88  * </li>
89  * <li> Context Data
90  * <ul>
91  * <li>Pointer to Net - <i>boost::shared_ptr</i></li>
92  * </ul>
93  * </li>
94  * </ul>
95  *
96  * @exception Error Net size does not match with NetBundle size
97  * <ul>
98  * <li>
99  * Id : eMessageIdErrorItemSizeMismatch
100  * </li>
101  * <li> Context Data
102  * <ul>
103  * <li>Net Size - <i>SizeType</i></li>
104  * <li>NetBundle Size - <i>SizeType</i></li>
105  * </ul>
106  * </li>
107  * </ul>
108  *
109  */
110  virtual Connection connect(const NetSharedPtr& inNet) throw (Error);
111 
112  void disconnect(const Connection& inConnection) throw (Error);
113 
114  void disconnect() throw (Error);
115 
116  virtual ~NetBundle() throw ();
117 
118 protected:
119  NetBundle();
120 
121 private:
122 #ifdef GENOM_SERIALIZATION
123  template <class Archive> void serialize(Archive& ar, unsigned int);
124 #endif //GENOM_SERIALIZATION
125 };
126 
127 } // namespace generic
128 } // namespace torc
129 
130 #endif // TORC_GENERIC_NETBUNDLE_HPP
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
virtual NetBundleSharedPtr newNetBundlePtr(const std::string &inName, const ViewSharedPtr &inViewPtr, const NetBundleSharedPtr &inParentCollection=NetBundleSharedPtr(), const std::string &inOriginalName=std::string())
Definition: NetBundle.cpp:47
Represents an EDIF Net.
Definition: generic/Net.hpp:58
std::list< NetSharedPtr >::iterator Connection
Definition: Connectable.hpp:52
std::string string
virtual void setParent(const ViewSharedPtr &inParent)
Definition: NetBundle.cpp:71
VisitorType< NetBundle > Visitor
Definition: NetBundle.hpp:50
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 void accept(BaseVisitor &inoutVisitor)
Definition: NetBundle.cpp:67
virtual Connection connect(const NetSharedPtr &inNet)
Definition: NetBundle.cpp:77
Represents a bundle of nets.
Definition: NetBundle.hpp:43
boost::shared_ptr< View > ViewSharedPtr
A placeholder for a factory method.
Definition: FactoryType.hpp:35
boost::shared_ptr< NetBundle > NetBundleSharedPtr
Represents a "bundle" in the EDIF sense.
Definition: Bundle.hpp:43