torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PortListAlias.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 
18 
19 namespace torc {
20 namespace generic {
21 
22 /**
23  * Create a port list alias
24  *
25  * @param[in] inName Name of the port list alias to be created.
26  * @param[in] inPortList Pointer to port list object.
27  * @param[in] inSimulate Pointer to parented (Simulate) object [optional].
28  * If not mentioned PortListAlias will not be added to simulate.
29  *
30  * @return Pointer to created port list alias.
31  **/
33  const PortListSharedPtr& inPortList, const SimulateSharedPtr& inSimulate) throw (Error) {
34  try {
35  PortListAliasSharedPtr newPortListAlias;
36  create(newPortListAlias);
37  newPortListAlias->setName(inName);
38  newPortListAlias->setPortList(inPortList);
39  if(inSimulate) {
40  inSimulate->addPortListAlias(newPortListAlias);
41  }
42  return newPortListAlias;
43  } catch(Error& e) {
44  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
45  throw;
46  }
47 }
48 
50 
51 void PortListAlias::accept(BaseVisitor& inoutVisitor) throw (Error) {
52  try {
53  runVisitor(*this, inoutVisitor);
54  } catch(Error& e) {
55  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
56  throw;
57  }
58 }
59 
61  mPortList = inPortList;
62 }
63 
65 
66 } // namespace generic
67 } // namespace torc
virtual void accept(BaseVisitor &inoutVisitor)
boost::shared_ptr< Simulate > SimulateSharedPtr
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
Definition: VisitorType.hpp:78
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 PortListAliasSharedPtr newPortListAliasPtr(const std::string &inName, const PortListSharedPtr &inPortList, const SimulateSharedPtr &inSimulate=SimulateSharedPtr())
boost::shared_ptr< PortList > PortListSharedPtr
Represents an ordered list of port references with a name aliased.
An object that has a name.
Definition: Nameable.hpp:34
boost::shared_ptr< PortListAlias > PortListAliasSharedPtr
void setPortList(const PortListSharedPtr &inPortList)
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)
Definition: Error.cpp:73