OpenASIP
2.0
src
codesign
Proxim
ProximBusEditPolicy.cc
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 ProximBusEditPolicy.cc
26
*
27
* Implementation of ProximBusEditPolicy class.
28
*
29
* @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30
* @note rating: red
31
*/
32
33
#include "
ProximBusEditPolicy.hh
"
34
#include "
Request.hh
"
35
#include "
ProximComponentStatusCmd.hh
"
36
#include "
ProximBusDetailsCmd.hh
"
37
#include "
Bus.hh
"
38
#include "
Segment.hh
"
39
#include "
EditPart.hh
"
40
#include "
ProximConstants.hh
"
41
42
using namespace
TTAMachine
;
43
44
/**
45
* The Constructor.
46
*/
47
ProximBusEditPolicy::ProximBusEditPolicy
() :
48
EditPolicy
() {
49
}
50
51
52
/**
53
* The Destructor.
54
*/
55
ProximBusEditPolicy::~ProximBusEditPolicy
() {
56
}
57
58
/**
59
* Tells whether this EditPolicy can handle request of the given type.
60
*
61
* @param Request to be handled.
62
* @return True, if the editpolicy can handle give request type.
63
*/
64
bool
65
ProximBusEditPolicy::canHandle
(
Request
* request)
const
{
66
67
Request::RequestType
type = request->
type
();
68
if
(type ==
Request::STATUS_REQUEST
||
69
type ==
Request::DETAILS_REQUEST
) {
70
return
true
;
71
}
72
73
return
false
;
74
}
75
76
77
/**
78
* Returns command correspoding to the request type.
79
*
80
* @param request Request to handle.
81
* @return NULL, if the request can't be handled.
82
*/
83
ComponentCommand
*
84
ProximBusEditPolicy::getCommand
(
Request
* request) {
85
86
Request::RequestType
type = request->
type
();
87
88
const
Bus
* bus =
dynamic_cast<
const
Bus
*
>
(
host_
->
model
());
89
if
(bus == NULL) {
90
const
Segment
* segment =
dynamic_cast<
const
Segment
*
>
(
host_
->
model
());
91
assert
(segment != NULL);
92
bus = segment->
parentBus
();
93
}
94
95
assert
(bus != NULL);
96
97
if
(type ==
Request::STATUS_REQUEST
) {
98
std::string status =
ProximConstants::MACH_WIN_BUS_LABEL
+ bus->
name
();
99
return
new
ProximComponentStatusCmd
(status);
100
}
else
if
(type ==
Request::DETAILS_REQUEST
) {
101
return
new
ProximBusDetailsCmd
(*bus);
102
}
103
return
NULL;
104
}
ProximBusEditPolicy::canHandle
virtual bool canHandle(Request *request) const
Definition:
ProximBusEditPolicy.cc:65
Request::type
RequestType type() const
ProximComponentStatusCmd.hh
TTAMachine::Component::name
virtual TCEString name() const
Definition:
MachinePart.cc:125
TTAMachine::Segment
Definition:
Segment.hh:54
TTAMachine::Bus
Definition:
Bus.hh:53
ProximBusDetailsCmd.hh
assert
#define assert(condition)
Definition:
Application.hh:86
Segment.hh
ProximConstants::MACH_WIN_BUS_LABEL
static const std::string MACH_WIN_BUS_LABEL
Label precing bus names in the machine state window.
Definition:
ProximConstants.hh:216
Request.hh
Request::DETAILS_REQUEST
@ DETAILS_REQUEST
Detailed info request.
Definition:
Request.hh:53
EditPart.hh
TTAMachine::Segment::parentBus
Bus * parentBus() const
EditPolicy::host_
EditPart * host_
Host EditPart of this EditPolicy.
Definition:
EditPolicy.hh:74
Request::RequestType
RequestType
Data type for determining the type of a Request.
Definition:
Request.hh:46
EditPolicy
Definition:
EditPolicy.hh:47
Bus.hh
EditPart::model
TTAMachine::MachinePart * model() const
Request
Definition:
Request.hh:43
ComponentCommand
Definition:
ComponentCommand.hh:46
ProximConstants.hh
Request::STATUS_REQUEST
@ STATUS_REQUEST
Status request.
Definition:
Request.hh:52
ProximBusEditPolicy.hh
ProximBusEditPolicy::~ProximBusEditPolicy
virtual ~ProximBusEditPolicy()
Definition:
ProximBusEditPolicy.cc:55
TTAMachine
Definition:
Assembler.hh:48
ProximComponentStatusCmd
Definition:
ProximComponentStatusCmd.hh:42
ProximBusEditPolicy::ProximBusEditPolicy
ProximBusEditPolicy()
Definition:
ProximBusEditPolicy.cc:47
ProximBusEditPolicy::getCommand
virtual ComponentCommand * getCommand(Request *request)
Definition:
ProximBusEditPolicy.cc:84
ProximBusDetailsCmd
Definition:
ProximBusDetailsCmd.hh:46
Generated by
1.8.17