torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LogicalResponse.cpp
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 
17 #include "torc/generic/Port.hpp"
20 
21 namespace torc {
22 namespace generic {
23 
24 /**
25  * Create a logical response.
26  *
27  * @param[in] inResponseType Response type.
28  * @param[in] inPort Connected Port to this logical response.
29  * @param[in] inLogicWaveForm Logic wave form for this logical response.
30  * @param[in] inPortListAlias Connected Port list alias to this logical response [optional].
31  *
32  * @return Pointer to created logical response.
33  */
35  const ResponseType& inResponseType, const PortSharedPtr& inPort,
36  const LogicElementSharedPtr& inLogicWaveForm, const PortListAliasSharedPtr& inPortListAlias)
37  throw (Error) {
38  try {
39  LogicalResponseSharedPtr newLogicalResponse;
40  create(newLogicalResponse);
41  newLogicalResponse->setResponseType(inResponseType);
42  newLogicalResponse->setConnectedPort(inPort);
43  newLogicalResponse->setLogicWaveForm(inLogicWaveForm);
44  newLogicalResponse->setConnectedPortListAlias(inPortListAlias);
45  return newLogicalResponse;
46  } catch(Error& e) {
47  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
48  throw;
49  }
50 }
51 
52 void LogicalResponse::accept(BaseVisitor& inoutVisitor) throw (Error) {
53  try {
54  runVisitor(*this, inoutVisitor);
55  } catch(Error& e) {
56  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
57  throw;
58  }
59 }
60 
61 /**
62  * Set the Logical response type
63  *
64  * @param[in] inSource Logical response type
65  */
67  mResponseType = inSource;
68 }
69 
70 /**
71  * Set the connected port shared pointer.
72  *
73  * @param[in] inPort Connected port shared pointer.
74  */
76  mConnectedPort = inPort;
77 }
78 
79 /**
80  * Set the connected port list shared pointer.
81  *
82  * @param[in] inPortList Connected port list shared pointer.
83  */
85  mConnectedPortList = inPortList;
86 }
87 
88 /**
89  * Set the connected port list alias shared pointer.
90  *
91  * @param[in] inPortListAlias Connected port list alias shared pointer.
92  */
94  mConnectedPortListAlias = inPortListAlias;
95 }
96 
97 /**
98  * Set the logic wave form for this response.
99  *
100  * @param[in] inSource Pointer to logic element object.
101  */
103  mLogicWaveForm = inSource;
104 }
105 
107  mResponseType(), mConnectedPort(), mConnectedPortList(), mConnectedPortListAlias(),
108  mLogicWaveForm() {}
109 
111 
112 } // namespace generic
113 } // namespace torc
virtual LogicalResponseSharedPtr newLogicalResponsePtr(const ResponseType &inResponseType, const PortSharedPtr &inPort, const LogicElementSharedPtr &inLogicWaveForm, const PortListAliasSharedPtr &inPortListAlias=PortListAliasSharedPtr())
void setLogicWaveForm(const LogicElementSharedPtr &inSource)
LogicElementSharedPtr mLogicWaveForm
boost::shared_ptr< LogicElement > LogicElementSharedPtr
void setConnectedPortList(const PortListSharedPtr &inPortList)
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
Definition: VisitorType.hpp:78
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)
boost::shared_ptr< PortList > PortListSharedPtr
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
void setConnectedPortListAlias(const PortListAliasSharedPtr &inPortListAlias)
An object that receives an inoutVisitor.
Definition: Visitable.hpp:38
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)
Definition: Error.cpp:73