torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
generic/Design.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 
16 #ifndef HAVE_CONFIG_H
17 #include "torc/generic/config.h"
18 #endif
19 
20 #include "torc/generic/Design.hpp"
21 
22 namespace torc {
23 namespace generic {
24 
26  const RootSharedPtr& inRootPtr, const std::string& inCellRefName,
27  const std::string& inLibraryRefName, const std::string& inOriginalName) throw (Error) {
28  try {
29  DesignSharedPtr newDesign;
30  create(newDesign);
31  newDesign->setName(inName);
32  newDesign->setParent(inRootPtr);
33  inRootPtr->addDesign(newDesign);
34  newDesign->setCellRefName(inCellRefName);
35  newDesign->setLibraryRefName(inLibraryRefName);
36  newDesign->setOriginalName(inOriginalName);
37  return newDesign;
38  } catch(Error& e) {
39  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
40  throw;
41  }
42 }
43 
44 void Design::accept(BaseVisitor& inoutVisitor) throw (Error) {
45  try {
46  runVisitor(*this, inoutVisitor);
47  } catch(Error& e) {
48  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
49  throw;
50  }
51 }
52 
55  mCellRefName(), mLibraryRefName() {}
56 
57 Design::Design(const std::string& inCellRefName, const std::string& inLibraryRefName) : Nameable(),
59  SelfReferencing<Design>(), UserDataContainer(), StatusContainer(), mCellRefName(inCellRefName),
60  mLibraryRefName(inLibraryRefName) {}
61 
62 Design::~Design() throw () {}
63 
64 void Design::setCellRefName(const std::string& inCellRefName) {
65  mCellRefName = inCellRefName;
66 }
67 
68 void Design::setLibraryRefName(const std::string& inLibraryRefName) {
69  mLibraryRefName = inLibraryRefName;
70 }
71 
72 } // namespace generic
73 } // namespace torc
void setCellRefName(const std::string &inCellRefName)
An object that has a parent.
void setLibraryRefName(const std::string &inLibraryRefName)
Represents objects that have properties.
Represents all classes that can hold user comments.
Definition: Commentable.hpp:36
virtual DesignSharedPtr newDesignPtr(const std::string &inName, const RootSharedPtr &inRootPtr, const std::string &inCellRefName, const std::string &inLibraryRefName, const std::string &inOriginalName=std::string())
Represents class that can hold userData.
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
Definition: VisitorType.hpp:78
std::string string
boost::shared_ptr< Design > DesignSharedPtr
The Error object thrown by different methods of EdifOM.
Definition: Error.hpp:41
A base class for Visitor.
Definition: VisitorType.hpp:31
virtual void accept(BaseVisitor &inoutVisitor)
Root of the EDIF Object Model.
Definition: Root.hpp:66
An object that has a name.
Definition: Nameable.hpp:34
Represents objects that can be renamed.
Represents objects that have status.
boost::shared_ptr< Root > RootSharedPtr
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