OpenASIP  2.0
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. More...
 
 ProDeIUEditPolicy (ProDeIUEditPolicy &old)
 Copying not allowed. More...
 

Additional Inherited Members

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

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 }

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 }

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(), ProDeTextGenerator::STATUS_IMMEDIATE_UNIT, Request::STATUS_REQUEST, Texts::TextGenerator::text(), Conversion::toString(), ProDeTextGenerator::TXT_RADIO_EXTENSION_SIGN, ProDeTextGenerator::TXT_RADIO_EXTENSION_ZERO, Request::type(), and TTAMachine::BaseRegisterFile::width().

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:
CopyComponent
Definition: CopyComponent.hh:42
Request::type
RequestType type() const
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
SetStatusTextCmd
Definition: SetStatusTextCmd.hh:43
Request::DELETE_REQUEST
@ DELETE_REQUEST
Delete request.
Definition: Request.hh:49
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
Conversion::toString
static std::string toString(const T &source)
ProDeTextGenerator
Definition: ProDeTextGenerator.hh:49
TTAMachine::BaseRegisterFile::numberOfRegisters
virtual int numberOfRegisters() const
assert
#define assert(condition)
Definition: Application.hh:86
ProDeTextGenerator::STATUS_IMMEDIATE_UNIT
@ STATUS_IMMEDIATE_UNIT
Status line template for IUs,.
Definition: ProDeTextGenerator.hh:287
ModifyIUCmd
Definition: ModifyIUCmd.hh:43
Request::COPY_REQUEST
@ COPY_REQUEST
Copy request.
Definition: Request.hh:51
ProDeTextGenerator::TXT_RADIO_EXTENSION_ZERO
@ TXT_RADIO_EXTENSION_ZERO
Label for 'zero' radio button.
Definition: ProDeTextGenerator.hh:100
EditPolicy::host_
EditPart * host_
Host EditPart of this EditPolicy.
Definition: EditPolicy.hh:74
EditPolicy::EditPolicy
EditPolicy()
Definition: EditPolicy.cc:41
ProDeTextGenerator::TXT_RADIO_EXTENSION_SIGN
@ TXT_RADIO_EXTENSION_SIGN
Label for 'sign' radio button.
Definition: ProDeTextGenerator.hh:101
Request::RequestType
RequestType
Data type for determining the type of a Request.
Definition: Request.hh:46
EditPart::model
TTAMachine::MachinePart * model() const
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
DeleteIUCmd
Definition: DeleteIUCmd.hh:42
Request::MODIFY_REQUEST
@ MODIFY_REQUEST
Modfify request.
Definition: Request.hh:48
Request::STATUS_REQUEST
@ STATUS_REQUEST
Status request.
Definition: Request.hh:52
TTAMachine::ImmediateUnit::extensionMode
virtual Machine::Extension extensionMode() const
Definition: ImmediateUnit.cc:143
TTAMachine::BaseRegisterFile::width
virtual int width() const
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50