torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Arc.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 /// \file
17 /// \brief Header for the Arc class.
18 
19 #ifndef TORC_ARCHITECTURE_ARC_HPP
20 #define TORC_ARCHITECTURE_ARC_HPP
21 
23 
24 namespace torc {
25 namespace architecture {
26 
27  /// \brief Encapsulation of an arc between two tilewires.
28  class Arc {
29  protected:
30  // members
31  /// \brief The source tilewire.
33  /// \brief The sink tilewire.
35  public:
36  // constructors
37  /// \brief Null constructor.
38  /// \details The source and sink tilewires will be set to Tilewire::sInvalid.
40  /// \brief Public constructor.
41  Arc(const Tilewire& inSourceTilewire, const Tilewire& inSinkTilewire)
42  : mSourceTilewire(inSourceTilewire), mSinkTilewire(inSinkTilewire) {}
43  // accessors
44  /// \brief Returns the source tilewire.
45  const Tilewire& getSourceTilewire(void) const { return mSourceTilewire; }
46  /// \brief Returns the sink tilewire.
47  const Tilewire& getSinkTilewire(void) const { return mSinkTilewire; }
48  // operators
49  /// \brief Equality operator.
50  bool operator ==(const Arc& rhs) const {
52  }
53  /// \brief Comparison operator.
54  bool operator <(const Arc& rhs) const {
55  if (mSinkTilewire < rhs.mSinkTilewire) return true;
56  if (mSinkTilewire == rhs.mSinkTilewire
57  && mSourceTilewire < rhs.mSourceTilewire) return true;
58  return false;
59  }
60  // functions
61  bool isUndefined(void) const {
63  }
64  // friends
65  /// \brief Return a hash value for the specified arc.
66  friend std::size_t hash_value(const Arc& inArc);
67  };
68 
70  public:
71  // members
73  // constructors
74  InvalidArcException(const Arc& inArc) : mArc(inArc) {}
75  };
76 
77  /// \brief Vector of Arc objects.
78  typedef std::vector<Arc> ArcVector;
79 
80 } // namespace architecture
81 } // namespace torc
82 
83 #endif // TORC_ARCHITECTURE_ARC_HPP
InvalidArcException(const Arc &inArc)
Definition: Arc.hpp:74
Encapsulation of an arc between two tilewires.
Definition: Arc.hpp:28
Arc(const Tilewire &inSourceTilewire, const Tilewire &inSinkTilewire)
Public constructor.
Definition: Arc.hpp:41
Tilewire mSinkTilewire
The sink tilewire.
Definition: Arc.hpp:34
std::vector< Arc > ArcVector
Vector of Arc objects.
Definition: Arc.hpp:78
const Tilewire & getSourceTilewire(void) const
Returns the source tilewire.
Definition: Arc.hpp:45
const Tilewire & getSinkTilewire(void) const
Returns the sink tilewire.
Definition: Arc.hpp:47
Arc(void)
Null constructor.
Definition: Arc.hpp:39
Encapsulation of a device tile and wire pair.
Definition: Tilewire.hpp:39
bool operator<(const Arc &rhs) const
Comparison operator.
Definition: Arc.hpp:54
Tilewire mSourceTilewire
The source tilewire.
Definition: Arc.hpp:32
Header for the Tilewire class.
bool isUndefined(void) const
Definition: Arc.hpp:61
friend std::size_t hash_value(const Arc &inArc)
Return a hash value for the specified arc.
Definition: Arc.cpp:25
bool operator==(const Arc &rhs) const
Equality operator.
Definition: Arc.hpp:50
bool isUndefined(void) const
Definition: Tilewire.hpp:86