OpenASIP  2.0
NetlistPortGroup.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2015 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /*
25  * @file NetlistPortGroup.hh
26  *
27  * Declaration of NetlistPortGroup class.
28  *
29  * Created on: 24.4.2015
30  * @author: Henry Linjamäki (henry.linjamaki-no.spam-tut.fi)
31  * @note rating: red
32  */
33 
34 #ifndef NETLISTPORTGROUP_HH
35 #define NETLISTPORTGROUP_HH
36 
37 #include <vector>
38 #include <cstddef> // size_t
39 
40 #include "NetlistPort.hh"
41 
42 #include "Exception.hh"
43 #include "SignalGroup.hh"
44 
45 namespace ProGe {
46 
47 class BaseNetlistBlock;
48 class NetlistPort;
49 
50 /*
51  * Presents a group of NetlistPorts belonging together.
52  */
54 public:
55 
56  friend class BaseNetlistBlock; // For registration management.
57 
58  typedef std::vector<NetlistPort*> PortContainerType;
59 
60  NetlistPortGroup(SignalGroup signalGroup = SignalGroup());
61 
62  template <typename... PortType>
63  NetlistPortGroup(SignalGroup groupType, PortType... ts);
64 
65  virtual ~NetlistPortGroup();
66 
67  size_t portCount() const;
68  const NetlistPort& portAt(size_t index) const;
69  NetlistPort& portAt(size_t index);
70  void addPort(NetlistPort& port);
71  bool hasPortBySignal(SignalType type) const;
72  const NetlistPort& portBySignal(SignalType type) const;
73 
74  void clear();
75 
76  bool hasParent() const;
77  const BaseNetlistBlock& parent() const;
79 
80  void assignSignalGroup(SignalGroup signalGroup);
82 
83  virtual NetlistPortGroup* clone(bool asMirrored = false) const;
84 
85  typedef PortContainerType::iterator iterator;
86  typedef PortContainerType::const_iterator const_iterator;
87  typedef PortContainerType::reverse_iterator reverse_iterator;
88  typedef PortContainerType::const_reverse_iterator const_reverse_iterator;
89 
90  iterator begin();
91  iterator end();
92  const_iterator begin() const;
93  const_iterator end() const;
98 
99 protected:
100  NetlistPortGroup(const NetlistPortGroup&, bool asMirrored = false);
101 
102 private:
104 
106 
107  void setParent(BaseNetlistBlock* newParent);
108 
109  /// The parent block where the group belongs to.
111  /// The ports belonging to this group by reference.
113  /// The usage/implemented interface of the group.
115 };
116 
117 
118 
119 } /* namespace ProGe */
120 #include "NetlistPortGroup.icc"
121 
122 #endif /* NETLISTPORTGROUP_HH_ */
ProGe::BaseNetlistBlock
Definition: BaseNetlistBlock.hh:59
ProGe::NetlistPortGroup::end
iterator end()
Definition: NetlistPortGroup.cc:186
ProGe::NetlistPortGroup::clone
virtual NetlistPortGroup * clone(bool asMirrored=false) const
Definition: NetlistPortGroup.cc:169
ProGe::NetlistPortGroup::parent_
BaseNetlistBlock * parent_
The parent block where the group belongs to.
Definition: NetlistPortGroup.hh:110
Exception.hh
ProGe::NetlistPortGroup::clear
void clear()
Definition: NetlistPortGroup.cc:128
ProGe::NetlistPortGroup::portAt
const NetlistPort & portAt(size_t index) const
Definition: NetlistPortGroup.cc:83
ProGe::NetlistPortGroup::setParent
void setParent(BaseNetlistBlock *newParent)
Definition: NetlistPortGroup.cc:150
ProGe::NetlistPortGroup::hasParent
bool hasParent() const
Definition: NetlistPortGroup.cc:133
ProGe::NetlistPortGroup::rend
reverse_iterator rend()
Definition: NetlistPortGroup.cc:206
ProGe::NetlistPortGroup::operator=
NetlistPortGroup & operator=(const NetlistPortGroup &)
ProGe::NetlistPortGroup::const_reverse_iterator
PortContainerType::const_reverse_iterator const_reverse_iterator
Definition: NetlistPortGroup.hh:88
ProGe::NetlistPortGroup::reverse_iterator
PortContainerType::reverse_iterator reverse_iterator
Definition: NetlistPortGroup.hh:87
ProGe::NetlistPortGroup::assignSignalGroup
void assignSignalGroup(SignalGroup signalGroup)
Definition: NetlistPortGroup.cc:155
ProGe::SignalGroup
Definition: SignalGroup.hh:48
ProGe::NetlistPortGroup
Definition: NetlistPortGroup.hh:53
SignalGroup.hh
NetlistPort.hh
ProGe::NetlistPortGroup::addPort
void addPort(NetlistPort &port)
Definition: NetlistPortGroup.cc:93
ProGe::NetlistPortGroup::iterator
PortContainerType::iterator iterator
Definition: NetlistPortGroup.hh:85
ProGe::NetlistPortGroup::begin
iterator begin()
Definition: NetlistPortGroup.cc:181
ProGe::NetlistPortGroup::NetlistPortGroup
NetlistPortGroup()
Definition: NetlistPortGroup.cc:46
ProGe::NetlistPortGroup::PortContainerType
std::vector< NetlistPort * > PortContainerType
Definition: NetlistPortGroup.hh:58
ProGe::NetlistPortGroup::assignedSignalGroup
SignalGroup assignedSignalGroup() const
Definition: NetlistPortGroup.cc:160
ProGe::SignalType
SignalType
Definition: SignalTypes.hh:42
ProGe::NetlistPortGroup::parent
const BaseNetlistBlock & parent() const
Definition: NetlistPortGroup.cc:138
ProGe::NetlistPortGroup::signalGroup_
SignalGroup signalGroup_
The usage/implemented interface of the group.
Definition: NetlistPortGroup.hh:114
ProGe
Definition: FUGen.hh:54
ProGe::NetlistPortGroup::portBySignal
const NetlistPort & portBySignal(SignalType type) const
Definition: NetlistPortGroup.cc:111
ProGe::NetlistPort
Definition: NetlistPort.hh:70
ProGe::NetlistPortGroup::portCount
size_t portCount() const
Definition: NetlistPortGroup.cc:78
ProGe::NetlistPortGroup::rbegin
reverse_iterator rbegin()
Definition: NetlistPortGroup.cc:201
ProGe::NetlistPortGroup::hasPortBySignal
bool hasPortBySignal(SignalType type) const
Definition: NetlistPortGroup.cc:98
ProGe::NetlistPortGroup::~NetlistPortGroup
virtual ~NetlistPortGroup()
Definition: NetlistPortGroup.cc:68
ProGe::NetlistPortGroup::const_iterator
PortContainerType::const_iterator const_iterator
Definition: NetlistPortGroup.hh:86
ProGe::NetlistPortGroup::ports_
PortContainerType ports_
The ports belonging to this group by reference.
Definition: NetlistPortGroup.hh:112
NetlistPortGroup.icc