OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
ProDeIUEditPolicy Class Reference

#include <ProDeIUEditPolicy.hh>

Inheritance diagram for ProDeIUEditPolicy:
Inheritance graph
Collaboration diagram for ProDeIUEditPolicy:
Collaboration graph

Public Member Functions

 ProDeIUEditPolicy ()
 
virtual ~ProDeIUEditPolicy ()
 
virtual ComponentCommandgetCommand (Request *request)
 
virtual bool canHandle (Request *request) const
 
- Public Member Functions inherited from EditPolicy
 EditPolicy ()
 
virtual ~EditPolicy ()
 
EditParthost () const
 
void setHost (EditPart *host)
 

Private Member Functions

ProDeIUEditPolicyoperator= (ProDeIUEditPolicy &old)
 Assignment not allowed.
 
 ProDeIUEditPolicy (ProDeIUEditPolicy &old)
 Copying not allowed.
 

Additional Inherited Members

- Protected Attributes inherited from EditPolicy
EditParthost_
 Host EditPart of this EditPolicy.
 

Detailed Description

Determines how an immediate unit EditPart acts when a Request is performed on it.

Converts a given Request to a Command if the EditPolicy supports the Request.

Definition at line 49 of file ProDeIUEditPolicy.hh.

Constructor & Destructor Documentation

◆ ProDeIUEditPolicy() [1/2]

ProDeIUEditPolicy::ProDeIUEditPolicy ( )

The Constructor.

Definition at line 56 of file ProDeIUEditPolicy.cc.

56 : EditPolicy() {
57}

◆ ~ProDeIUEditPolicy()

ProDeIUEditPolicy::~ProDeIUEditPolicy ( )
virtual

The Destructor.

Definition at line 62 of file ProDeIUEditPolicy.cc.

62 {
63}

◆ ProDeIUEditPolicy() [2/2]

ProDeIUEditPolicy::ProDeIUEditPolicy ( ProDeIUEditPolicy old)
private

Copying not allowed.

Member Function Documentation

◆ canHandle()

bool ProDeIUEditPolicy::canHandle ( Request request) const
virtual

Tells whether this EditPolicy is able to handle a certain type of Request.

Parameters
requestRequest to be asked if it can be handled.
Returns
True if the Request can be handled, false otherwise.

Implements EditPolicy.

Definition at line 123 of file ProDeIUEditPolicy.cc.

123 {
124 Request::RequestType type = request->type();
125 if (type == Request::MODIFY_REQUEST ||
126 type == Request::DELETE_REQUEST ||
127 type == Request::COPY_REQUEST ||
128 type == Request::STATUS_REQUEST) {
129 return true;
130 } else {
131 return false;
132 }
133}
RequestType
Data type for determining the type of a Request.
Definition Request.hh:46
@ STATUS_REQUEST
Status request.
Definition Request.hh:52
@ MODIFY_REQUEST
Modfify request.
Definition Request.hh:48
@ DELETE_REQUEST
Delete request.
Definition Request.hh:49
@ COPY_REQUEST
Copy request.
Definition Request.hh:51
RequestType type() const

References Request::COPY_REQUEST, Request::DELETE_REQUEST, Request::MODIFY_REQUEST, Request::STATUS_REQUEST, and Request::type().

Here is the call graph for this function:

◆ getCommand()

ComponentCommand * ProDeIUEditPolicy::getCommand ( Request request)
virtual

Returns the Command corresponding to the type of the Request.

Parameters
requestRequest to be handled.
Returns
NULL if the Request cannot be handled.

Implements EditPolicy.

Definition at line 72 of file ProDeIUEditPolicy.cc.

72 {
73
74 Request::RequestType type = request->type();
75
76 if (type == Request::MODIFY_REQUEST) {
77 ModifyIUCmd* modifyCmd = new ModifyIUCmd(host_);
78 return modifyCmd;
79
80 } else if (type == Request::DELETE_REQUEST) {
81 DeleteIUCmd* deleteCmd = new DeleteIUCmd(host_);
82 return deleteCmd;
83
84 } else if (type == Request::COPY_REQUEST) {
85 CopyComponent* copyCmd = new CopyComponent(host_);
86 return copyCmd;
87
88 } else if (type == Request::STATUS_REQUEST) {
89
90 ImmediateUnit* iu = dynamic_cast<ImmediateUnit*>(host_->model());
92 format fmt = generator->text(
94 string extension = "";
95 if (iu->extensionMode() == Machine::SIGN) {
96 extension = generator->text(
98 } else if (iu->extensionMode() == Machine::ZERO) {
99 extension = generator->text(
101 } else {
102 // unknown extension
103 assert(false);
104 }
105 fmt % iu->name() % Conversion::toString(iu->numberOfRegisters()) %
106 Conversion::toString(iu->width()) % extension;
107 SetStatusTextCmd* statusCmd = new SetStatusTextCmd(fmt.str());
108 return statusCmd;
109
110 } else {
111 return NULL;
112 }
113}
#define assert(condition)
static std::string toString(const T &source)
TTAMachine::MachinePart * model() const
EditPart * host_
Host EditPart of this EditPolicy.
Definition EditPolicy.hh:74
static ProDeTextGenerator * instance()
@ TXT_RADIO_EXTENSION_ZERO
Label for 'zero' radio button.
@ TXT_RADIO_EXTENSION_SIGN
Label for 'sign' radio button.
@ STATUS_IMMEDIATE_UNIT
Status line template for IUs,.
virtual int numberOfRegisters() const
virtual int width() const
virtual TCEString name() const
virtual Machine::Extension extensionMode() const
@ SIGN
Sign extension.
Definition Machine.hh:82
@ ZERO
Zero extension.
Definition Machine.hh:81
virtual boost::format text(int textId)

References assert, Request::COPY_REQUEST, Request::DELETE_REQUEST, TTAMachine::ImmediateUnit::extensionMode(), EditPolicy::host_, ProDeTextGenerator::instance(), EditPart::model(), Request::MODIFY_REQUEST, TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::Machine::SIGN, ProDeTextGenerator::STATUS_IMMEDIATE_UNIT, Request::STATUS_REQUEST, Texts::TextGenerator::text(), Conversion::toString(), ProDeTextGenerator::TXT_RADIO_EXTENSION_SIGN, ProDeTextGenerator::TXT_RADIO_EXTENSION_ZERO, Request::type(), TTAMachine::BaseRegisterFile::width(), and TTAMachine::Machine::ZERO.

Here is the call graph for this function:

◆ operator=()

ProDeIUEditPolicy & ProDeIUEditPolicy::operator= ( ProDeIUEditPolicy old)
private

Assignment not allowed.


The documentation for this class was generated from the following files: