torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LogicalResponse.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_LOGICALRESPONSE_HPP
17 #define TORC_GENERIC_LOGICALRESPONSE_HPP
18 
24 
25 namespace torc { namespace generic { class Port; } }
26 namespace torc { namespace generic { class PortList; } }
27 namespace torc { namespace generic { class PortListAlias; } }
28 namespace torc { namespace generic { class LogicElement; } }
29 
30 namespace torc {
31 namespace generic {
32 
33 /**
34  * @brief This class is used to model logicInput/logicOutput construct.
35  * This class holds information of logical response to be expected from
36  * a ports during simulation.
37  */
38 class LogicalResponse : public Visitable, public SelfReferencing<LogicalResponse> {
39  friend class FactoryType<LogicalResponse> ;
40 
41 public:
42  /**
43  * @enum ResponseType
44  * Logical response types (logicInput/logicOutput)
45  */
46  enum ResponseType {
48  };
49 
50  /**
51  * Get the Logical response type
52  *
53  * @return Logical response type
54  */
55  inline const ResponseType getResponseType() const;
56 
57  /**
58  * Set the Logical response type
59  *
60  * @param[in] inSource Logical response type
61  */
62  void setResponseType(const ResponseType& inSource);
63 
64  /**
65  * Convenience class to visit LogicalResponse.
66  */
68 
69  virtual void accept(BaseVisitor& inoutVisitor) throw (Error);
70 
71  /**
72  * Convenience class to create LogicalResponse.
73  */
74  class Factory : public FactoryType<LogicalResponse> {
75  public:
77  /**
78  * Create a logical response.
79  *
80  * @param[in] inResponseType Response type.
81  * @param[in] inPort Connected Port to this logical response.
82  * @param[in] inLogicWaveForm Logic wave form for this logical response.
83  * @param[in] inPortListAlias Connected Port list alias to this logical response [optional].
84  *
85  * @return Pointer to created logical response.
86  */
87  virtual LogicalResponseSharedPtr newLogicalResponsePtr(const ResponseType& inResponseType,
88  const PortSharedPtr& inPort, const LogicElementSharedPtr& inLogicWaveForm,
89  const PortListAliasSharedPtr& inPortListAlias = PortListAliasSharedPtr()) throw (Error);
90  };
91 
92  /**
93  * Get the connected port shared pointer.
94  *
95  * @return Connected port shared pointer.
96  */
97  inline const PortSharedPtr getConnectedPort() const;
98 
99  /**
100  * Set the connected port shared pointer.
101  *
102  * @param[in] inPort Connected port shared pointer.
103  */
104  void setConnectedPort(const PortSharedPtr& inPort);
105 
106  /**
107  * Get the connected port list shared pointer.
108  *
109  * @return Connected port list shared pointer.
110  */
111  inline const PortListSharedPtr getConnectedPortList() const;
112 
113  /**
114  * Set the connected port list shared pointer.
115  *
116  * @param[in] inPortList Connected port list shared pointer.
117  */
118  void setConnectedPortList(const PortListSharedPtr& inPortList);
119 
120  /**
121  * Get the connected port list alias shared pointer.
122  *
123  * @return Connected port list alias shared pointer.
124  */
126 
127  /**
128  * Set the connected port list alias shared pointer.
129  *
130  * @param[in] inPortListAlias Connected port list alias shared pointer.
131  */
132  void setConnectedPortListAlias(const PortListAliasSharedPtr& inPortListAlias);
133 
134  /**
135  * Get the logic wave form for this response.
136  *
137  * @return LogicElementSharedPtr Pointer to logic element object.
138  */
139  inline const LogicElementSharedPtr getLogicWaveForm() const;
140 
141  /**
142  * Set the logic wave form for this response.
143  *
144  * @param[in] inSource Pointer to logic element object.
145  */
146  void setLogicWaveForm(const LogicElementSharedPtr& inSource);
147 
148  ~LogicalResponse() throw ();
149 
150 protected:
151  LogicalResponse();
152 
153 private:
154  LogicalResponse(const LogicalResponse& source);
155 
156  LogicalResponse& operator=(const LogicalResponse& source);
157 
163 
164 };
165 
166 /**
167  * Get the Logical response type
168  *
169  * @return Logical response type
170  */
171 inline const LogicalResponse::ResponseType LogicalResponse::getResponseType() const {
172  return mResponseType;
173 }
174 
175 /**
176  * Get the connected port shared pointer.
177  *
178  * @return Connected port shared pointer.
179  */
181  return mConnectedPort;
182 }
183 
184 /**
185  * Get the connected port list shared pointer.
186  *
187  * @return Connected port list shared pointer.
188  */
190  return mConnectedPortList;
191 }
192 
193 /**
194  * Get the connected port list alias shared pointer.
195  *
196  * @return Connected port list alias shared pointer.
197  */
200 }
201 
202 /**
203  * Get the logic wave form for this response.
204  *
205  * @return LogicElementSharedPtr Pointer to logic element object.
206  */
208  return mLogicWaveForm;
209 }
210 
211 } // namespace generic
212 } // namespace torc
213 
214 #endif // TORC_GENERIC_LOGICALRESPONSE_HPP
virtual LogicalResponseSharedPtr newLogicalResponsePtr(const ResponseType &inResponseType, const PortSharedPtr &inPort, const LogicElementSharedPtr &inLogicWaveForm, const PortListAliasSharedPtr &inPortListAlias=PortListAliasSharedPtr())
An acyclic inoutVisitor implementation.
Definition: VisitorType.hpp:57
void setLogicWaveForm(const LogicElementSharedPtr &inSource)
LogicElementSharedPtr mLogicWaveForm
boost::shared_ptr< LogicElement > LogicElementSharedPtr
VisitorType< LogicalResponse > Visitor
void setConnectedPortList(const PortListSharedPtr &inPortList)
const PortListSharedPtr getConnectedPortList() const
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
boost::shared_ptr< LogicalResponse > LogicalResponseSharedPtr
A base class for Visitor.
Definition: VisitorType.hpp:31
virtual void accept(BaseVisitor &inoutVisitor)
void setConnectedPort(const PortSharedPtr &inPort)
const ResponseType getResponseType() const
boost::shared_ptr< PortList > PortListSharedPtr
const LogicElementSharedPtr getLogicWaveForm() const
PortListAliasSharedPtr mConnectedPortListAlias
void setResponseType(const ResponseType &inSource)
This class is used to model logicInput/logicOutput construct. This class holds information of logical...
boost::shared_ptr< PortListAlias > PortListAliasSharedPtr
boost::shared_ptr< Port > PortSharedPtr
const PortListAliasSharedPtr getConnectedPortListAlias() const
A placeholder for a factory method.
Definition: FactoryType.hpp:35
const PortSharedPtr getConnectedPort() const
void setConnectedPortListAlias(const PortListAliasSharedPtr &inPortListAlias)
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38