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