torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Connection.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_PACKER_CONNECTION_HPP
17 #define TORC_PACKER_CONNECTION_HPP
18 
19 #include "torc/physical/Named.hpp"
22 
23 #include <string>
24 
25 namespace torc {
26 namespace physical {
27 
28  /// \brief Hierarchical componenet.
29  class Connection : public Named {
30  // friends
31  /// \brief The Factory class has direct access to our internals.
32  friend class RcFactory; protected: typedef std::string string;
34 
35 
36  public:
37  /// \brief Constructor.
38  Connection(const string& inName) : Named(inName){}
39 
40  typedef ConnectionPinVector::const_iterator ConnectionPinSharedPtrConstIterator;
41  typedef ConnectionPinVector::iterator ConnectionPinSharedPtrIterator;
42  // connectionPin iterators
49  size_t getConnectionPinCount(void) const { return mConnectionPins.size(); }
50  // connectionPin population
51  bool addConnectionPin(ConnectionPin& inConnectionPinPtr) {
52  /// \todo Acquire mutex.
54  ConnectionPinSharedPtrIterator result = std::find(connectionPinsEnd(), e, inConnectionPinPtr);
55  if(result != e) return false;
56  mConnectionPins.push_back(inConnectionPinPtr);
57  return true;
58  /// \todo Release mutex.
59  }
60 
61  // checks if the elemnt is a mux that needs to be removed
62  bool removeConnectionPin(ConnectionPin& inConnectionPinPtr) {
63  /// \todo Acquire mutex.
65  ConnectionPinSharedPtrIterator result = std::find(connectionPinsBegin(), e, inConnectionPinPtr);
66  if(result == e) return false;
67  mConnectionPins.erase(result);
68  /// \todo Release mutex.
69  return true;
70  }
71 
72 
73 
74 
75 
76  // operators
77  bool operator ==(const Connection& rhs) const { return mName == rhs.mName; }
78 
79  };
80 
81  /// \brief Shared pointer encapsulation of a componenet
82  typedef boost::shared_ptr<Connection> ConnectionSharedPtr;
83 
84  /// \brief Weak pointer encapsulation of a componenet
85  typedef boost::weak_ptr<Connection> ConnectionWeakPtr;
86 
87  /// \brief Vector of componenet shared pointers.
88  typedef std::vector<ConnectionSharedPtr> ConnectionSharedPtrVector;
89 
90 } // namespace physical
91 } // namespace torc
92 
93 #endif // TORC_PACKER_CONNECTION_HPP
ConnectionPinVector::const_iterator ConnectionPinSharedPtrConstIterator
Definition: Connection.hpp:40
Hierarchical componenet.
Definition: Connection.hpp:29
ConnectionPinSharedPtrConstIterator getSource(void) const
Definition: Connection.hpp:47
ConnectionPinSharedPtrConstIterator connectionPinsBegin(void) const
Definition: Connection.hpp:43
Connection(const string &inName)
Constructor.
Definition: Connection.hpp:38
ConnectionPinSharedPtrConstIterator getSink(void) const
Definition: Connection.hpp:48
ConnectionPinVector mConnectionPins
Definition: Connection.hpp:33
string mName
The name of the object.
Definition: Named.hpp:43
RcFactory class for physical netlist elements.
Definition: RcFactory.hpp:34
Physical design connection-pin pair, suitable for specifying a net endpoint.
ConnectionPinSharedPtrIterator connectionPinsBegin(void)
Definition: Connection.hpp:45
Concept for any object that can be named.
Definition: Named.hpp:36
std::string string
bool removeConnectionPin(ConnectionPin &inConnectionPinPtr)
Definition: Connection.hpp:62
bool addConnectionPin(ConnectionPin &inConnectionPinPtr)
Definition: Connection.hpp:51
Header for the Named class.
bool operator==(const Connection &rhs) const
Definition: Connection.hpp:77
std::vector< ConnectionSharedPtr > ConnectionSharedPtrVector
Vector of componenet shared pointers.
Definition: Connection.hpp:88
boost::shared_ptr< Connection > ConnectionSharedPtr
Shared pointer encapsulation of a componenet.
Definition: Connection.hpp:82
Header for the Progeny class.
ConnectionPinSharedPtrIterator connectionPinsEnd(void)
Definition: Connection.hpp:46
ConnectionPinSharedPtrConstIterator connectionPinsEnd(void) const
Definition: Connection.hpp:44
size_t getConnectionPinCount(void) const
Definition: Connection.hpp:49
boost::weak_ptr< Connection > ConnectionWeakPtr
Weak pointer encapsulation of a componenet.
Definition: Connection.hpp:85
ConnectionPinVector::iterator ConnectionPinSharedPtrIterator
Definition: Connection.hpp:41
std::vector< ConnectionPin > ConnectionPinVector
Vector of connection pins.