torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
physical/Instance.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 /// \file
17 /// \brief Source for the Instance class.
18 
21 
22 namespace torc {
23 namespace physical {
24 
25  void Instance::addPin(const InstancePinWeakPtr& inInstancePinPtr) {
26  if(!inInstancePinPtr.expired()) {
27  InstancePinSharedPtr instancePinSharedPtr = inInstancePinPtr.lock();
28  mInstancePins.insert(InstancePinMap::value_type(instancePinSharedPtr->getPinName(),
29  instancePinSharedPtr));
30  }
31  }
32 
33  void Instance::removePin(const InstancePinWeakPtr& inInstancePinPtr) {
34  if(!inInstancePinPtr.expired()) {
35  // find all InstancePin objects for the requested pin name
36  InstancePinSharedPtr instancePinSharedPtr = inInstancePinPtr.lock();
37  std::pair<InstancePinSharedPtrIterator, InstancePinSharedPtrIterator> range
38  = mInstancePins.equal_range(instancePinSharedPtr->getPinName());
39  // delete the one entry that matches our InstancePin
40  while(range.first != range.second) {
41  if(range.first->second == instancePinSharedPtr) {
42  mInstancePins.erase(range.first);
43  break;
44  }
45  range.first++;
46  }
47  }
48  }
49 
50 } // namespace physical
51 } // namespace torc
void removePin(const InstancePinWeakPtr &inInstancePinPtr)
Remove the referenced InstancePin from our pin map.
Header for the Instance class.
void addPin(const InstancePinWeakPtr &inInstancePinPtr)
Add the referenced InstancePin to our pin map.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
InstancePinMap mInstancePins
The map of pin names to InstancePin weak pointers.
boost::weak_ptr< class InstancePin > InstancePinWeakPtr
Weak pointer encapsulation of an InstancePin.
Header for the InstancePin class.