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