OpenASIP 2.2
Loading...
Searching...
No Matches
ProximRFEditPolicy.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 ProximRFEditPolicy.cc
26 *
27 * Implementation of ProximRFEditPolicy class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <string>
34#include "ProximRFEditPolicy.hh"
35#include "Application.hh"
36#include "Request.hh"
37#include "RegisterFile.hh"
38#include "EditPart.hh"
41#include "ProximRFDetailsCmd.hh"
42#include "ProximConstants.hh"
43
44using namespace TTAMachine;
45using std::string;
46
47/**
48 * The Constructor.
49 */
53
54/**
55 * The Destructor.
56 */
59
60/**
61 * Tells whether this EditPolicy can handle request of the given type.
62 *
63 * @param Request to be handled.
64 * @return True, if the editpolicy can handle give request type.
65 */
66bool
68
69 Request::RequestType type = request->type();
70 if (type == Request::MODIFY_REQUEST ||
73
74 return true;
75 }
76
77 return false;
78}
79
80
81/**
82 * Creates command corresponding to a request.
83 *
84 * @paran request Request to handle.
85 * @return Null, if the request can't be handled.
86 */
89
90 Request::RequestType type = request->type();
91 if (type == Request::MODIFY_REQUEST) {
92 return new ProximShowRegistersCmd(host_);
93 } else if (type == Request::STATUS_REQUEST) {
94
95 const RegisterFile* rf = dynamic_cast<const RegisterFile*>(
96 host_->model());
97
98 assert(rf != NULL);
99 string status = ProximConstants::MACH_WIN_RF_LABEL + rf->name();
100 return new ProximComponentStatusCmd(status);
101
102 } else if (type == Request::DETAILS_REQUEST) {
103
104 const RegisterFile* rf = dynamic_cast<const RegisterFile*>(
105 host_->model());
106
107 assert(rf != NULL);
108 return new ProximRFDetailsCmd(*rf);
109 }
110 return NULL;
111}
#define assert(condition)
TTAMachine::MachinePart * model() const
EditPart * host_
Host EditPart of this EditPolicy.
Definition EditPolicy.hh:74
static const std::string MACH_WIN_RF_LABEL
Label precing register file names in the machine state window.
virtual bool canHandle(Request *request) const
virtual ComponentCommand * getCommand(Request *request)
RequestType
Data type for determining the type of a Request.
Definition Request.hh:46
@ DETAILS_REQUEST
Detailed info request.
Definition Request.hh:53
@ STATUS_REQUEST
Status request.
Definition Request.hh:52
@ MODIFY_REQUEST
Modfify request.
Definition Request.hh:48
RequestType type() const
virtual TCEString name() const