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