OpenASIP 2.2
Loading...
Searching...
No Matches
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
42class ObjectState;
43
44namespace TTAMachine {
45
46class Bus;
47
48/**
49 * Represents a bridge in the machine.
50 */
51class Bridge : public Component {
52public:
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;
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
76private:
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
Bus * destinationBus() const
virtual ~Bridge()
Definition Bridge.cc:127
Bus * sourceBus() const
Bus * nextBus() const
Definition Bridge.cc:179
virtual void setName(const std::string &name)
Definition Bridge.cc:141
virtual ObjectState * saveState() const
Definition Bridge.cc:238
Bus * sourceBus_
Source bus.
Definition Bridge.hh:84
Bus * previousBus() const
Definition Bridge.cc:164
static const std::string OSNAME_BRIDGE
ObjectState name for bridge.
Definition Bridge.hh:70
static const std::string OSKEY_DESTINATION_BUS
ObjectState attribute key for destination bus name.
Definition Bridge.hh:74
static const std::string OSKEY_SOURCE_BUS
ObjectState attribute key for source bus name.
Definition Bridge.hh:72
static void setFirstOfChain(const Bus &bus)
Definition Bridge.cc:400
void setSourceAndDestination(Bus &sourceBus, Bus &destination)
Definition Bridge.cc:379
virtual void unsetMachine()
Definition Bridge.cc:207
virtual void loadState(const ObjectState *state)
Definition Bridge.cc:264
Bus * destinationBus_
Destination bus.
Definition Bridge.hh:86
void adjustChainDirection(const Bus &sourceBus, const Bus &destinationBus)
Definition Bridge.cc:327
bool sourcePrevious_
Indicates which of the buses is previous and next.
Definition Bridge.hh:88
virtual void setMachine(Machine &mach)
Definition Bridge.cc:196
virtual TCEString name() const