torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SingleInstance.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_SINGLEINSTANCE_HPP
17 #define TORC_GENERIC_SINGLEINSTANCE_HPP
18 
20 
21 #ifdef GENOM_SERIALIZATION
22 #include <boost/serialization/access.hpp>
23 #endif //GENOM_SERIALIZATION
25 #include "torc/generic/Scalar.hpp"
28 #include "torc/generic/Error.hpp"
29 
30 namespace torc { namespace generic { class BaseVisitor; } }
31 
32 namespace torc {
33 namespace generic {
34 
35 /**
36  * @brief Represents a single instance of the view of a cell.
37  *
38  * The SingleInstance class represents a usage instance of a cell in the design specification
39  * (View) of another cell. A single instance can be created using the (instance name ...) syntax.
40  */
41 class SingleInstance : public Instance, public Scalar<Instance> {
42 #ifdef GENOM_SERIALIZATION
43  friend class boost::serialization::access;
44 #endif //GENOM_SERIALIZATION
45  friend class FactoryType<SingleInstance> ;
46 
47 public:
49 
50  /**
51  * Convenience class to create a single instance.
52  */
53  class Factory : public FactoryType<SingleInstance> {
54  public:
56  /**
57  * Create a single instance.
58  * @param[in] inName Name of the single instance to be created.
59  * @param[in] inViewPtr Pointer to parented(View) object.
60  * @param[in] inMasterPtr Pointer to master(View) object.
61  * @param[in] inOriginalName Original name of the single instance [optional].
62  *
63  * @return Pointer to created single instance.
64  */
66  const ViewSharedPtr& inViewPtr, const ViewSharedPtr& inMasterPtr,
67  const std::string& inOriginalName = std::string()) throw (Error);
68  };
69 
70  virtual void accept(BaseVisitor& inoutVisitor) throw (Error);
71 
72  virtual ~SingleInstance() throw ();
73 
74 protected:
76 
77 private:
78 #ifdef GENOM_SERIALIZATION
79  template <class Archive> void serialize(Archive& ar, unsigned int);
80 #endif //GENOM_SERIALIZATION
81 };
82 
83 } // namespace generic
84 } // namespace torc
85 
86 #endif // TORC_GENERIC_SINGLEINSTANCE_HPP
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
A single object with no child objects.
Definition: Scalar.hpp:34
Represents an instantiation of a cell view in the view of another cell.
virtual void accept(BaseVisitor &inoutVisitor)
Represents a single instance of the view of a cell.
std::string string
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
A base class for Visitor.
Definition: VisitorType.hpp:31
virtual SingleInstanceSharedPtr newSingleInstancePtr(const std::string &inName, const ViewSharedPtr &inViewPtr, const ViewSharedPtr &inMasterPtr, const std::string &inOriginalName=std::string())
boost::shared_ptr< View > ViewSharedPtr
boost::shared_ptr< SingleInstance > SingleInstanceSharedPtr
A placeholder for a factory method.
Definition: FactoryType.hpp:35
VisitorType< SingleInstance > Visitor