OpenASIP  2.0
Bridge.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 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 Bridge.hh
26  *
27  * Declaration of Bridge class.
28  *
29  * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30  * @note reviewed 10 Jun 2004 by vpj, am, tr, ll
31  * @note rating: red
32  */
33 
34 #ifndef TTA_BRIDGE_HH
35 #define TTA_BRIDGE_HH
36 
37 #include <string>
38 
39 #include "MachinePart.hh"
40 #include "Exception.hh"
41 
42 class ObjectState;
43 
44 namespace TTAMachine {
45 
46 class Bus;
47 
48 /**
49  * Represents a bridge in the machine.
50  */
51 class Bridge : public Component {
52 public:
53  Bridge(const std::string& name, Bus& sourceBus, Bus& destinationBus);
54  Bridge(const ObjectState* state, Machine& mach);
55  virtual ~Bridge();
56 
57  virtual void setName(const std::string& name);
58  Bus* sourceBus() const;
59  Bus* destinationBus() const;
60  Bus* previousBus() const;
61  Bus* nextBus() const;
62 
63  virtual void setMachine(Machine& mach);
64  virtual void unsetMachine();
65 
66  virtual ObjectState* saveState() const;
67  virtual void loadState(const ObjectState* state);
68 
69  /// ObjectState name for bridge.
70  static const std::string OSNAME_BRIDGE;
71  /// ObjectState attribute key for source bus name.
72  static const std::string OSKEY_SOURCE_BUS;
73  /// ObjectState attribute key for destination bus name.
74  static const std::string OSKEY_DESTINATION_BUS;
75 
76 private:
78  const Bus& sourceBus,
79  const Bus& destinationBus);
80  void setSourceAndDestination(Bus& sourceBus, Bus& destination);
81  static void setFirstOfChain(const Bus& bus);
82 
83  /// Source bus.
85  /// Destination bus.
87  /// Indicates which of the buses is previous and next.
89 };
90 }
91 
92 #include "Bridge.icc"
93 
94 #endif
TTAMachine::Bridge::saveState
virtual ObjectState * saveState() const
Definition: Bridge.cc:238
TTAMachine::Bridge::OSKEY_SOURCE_BUS
static const std::string OSKEY_SOURCE_BUS
ObjectState attribute key for source bus name.
Definition: Bridge.hh:72
TTAMachine::Bridge::sourceBus
Bus * sourceBus() const
TTAMachine::Bridge::destinationBus
Bus * destinationBus() const
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAMachine::Bridge::destinationBus_
Bus * destinationBus_
Destination bus.
Definition: Bridge.hh:86
TTAMachine::Bridge::loadState
virtual void loadState(const ObjectState *state)
Definition: Bridge.cc:264
Exception.hh
TTAMachine::Bridge
Definition: Bridge.hh:51
TTAMachine::Bridge::unsetMachine
virtual void unsetMachine()
Definition: Bridge.cc:207
TTAMachine::Bridge::sourcePrevious_
bool sourcePrevious_
Indicates which of the buses is previous and next.
Definition: Bridge.hh:88
TTAMachine::Bridge::~Bridge
virtual ~Bridge()
Definition: Bridge.cc:127
TTAMachine::Bus
Definition: Bus.hh:53
ObjectState
Definition: ObjectState.hh:59
TTAMachine::Bridge::Bridge
Bridge(const std::string &name, Bus &sourceBus, Bus &destinationBus)
Definition: Bridge.cc:74
Bridge.icc
MachinePart.hh
TTAMachine::Bridge::setSourceAndDestination
void setSourceAndDestination(Bus &sourceBus, Bus &destination)
Definition: Bridge.cc:379
TTAMachine::Component
Definition: MachinePart.hh:90
TTAMachine::Bridge::previousBus
Bus * previousBus() const
Definition: Bridge.cc:164
TTAMachine::Bridge::nextBus
Bus * nextBus() const
Definition: Bridge.cc:179
TTAMachine::Bridge::sourceBus_
Bus * sourceBus_
Source bus.
Definition: Bridge.hh:84
TTAMachine::Bridge::setFirstOfChain
static void setFirstOfChain(const Bus &bus)
Definition: Bridge.cc:400
TTAMachine::Bridge::OSNAME_BRIDGE
static const std::string OSNAME_BRIDGE
ObjectState name for bridge.
Definition: Bridge.hh:70
TTAMachine::Bridge::OSKEY_DESTINATION_BUS
static const std::string OSKEY_DESTINATION_BUS
ObjectState attribute key for destination bus name.
Definition: Bridge.hh:74
TTAMachine::Bridge::adjustChainDirection
void adjustChainDirection(const Bus &sourceBus, const Bus &destinationBus)
Definition: Bridge.cc:327
TTAMachine
Definition: Assembler.hh:48
TTAMachine::Bridge::setMachine
virtual void setMachine(Machine &mach)
Definition: Bridge.cc:196
TTAMachine::Bridge::setName
virtual void setName(const std::string &name)
Definition: Bridge.cc:141
TTAMachine::Machine
Definition: Machine.hh:73