OpenASIP  2.0
Public Member Functions | Private Member Functions | List of all members
ProDeRFEditPolicy Class Reference

#include <ProDeRFEditPolicy.hh>

Inheritance diagram for ProDeRFEditPolicy:
Inheritance graph
Collaboration diagram for ProDeRFEditPolicy:
Collaboration graph

Public Member Functions

 ProDeRFEditPolicy ()
 
virtual ~ProDeRFEditPolicy ()
 
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

ProDeRFEditPolicyoperator= (ProDeRFEditPolicy &old)
 Assignment not allowed. More...
 
 ProDeRFEditPolicy (ProDeRFEditPolicy &old)
 Copying not allowed. More...
 

Additional Inherited Members

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

Detailed Description

Determines how a register file 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 50 of file ProDeRFEditPolicy.hh.

Constructor & Destructor Documentation

◆ ProDeRFEditPolicy() [1/2]

ProDeRFEditPolicy::ProDeRFEditPolicy ( )

The Constructor.

Definition at line 56 of file ProDeRFEditPolicy.cc.

56  : EditPolicy() {
57 }

◆ ~ProDeRFEditPolicy()

ProDeRFEditPolicy::~ProDeRFEditPolicy ( )
virtual

The Destructor.

Definition at line 62 of file ProDeRFEditPolicy.cc.

62  {
63 }

◆ ProDeRFEditPolicy() [2/2]

ProDeRFEditPolicy::ProDeRFEditPolicy ( ProDeRFEditPolicy old)
private

Copying not allowed.

Member Function Documentation

◆ canHandle()

bool ProDeRFEditPolicy::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 128 of file ProDeRFEditPolicy.cc.

128  {
129  Request::RequestType type = request->type();
130  if (type == Request::MODIFY_REQUEST ||
131  type == Request::DELETE_REQUEST ||
132  type == Request::COPY_REQUEST ||
133  type == Request::STATUS_REQUEST) {
134  return true;
135  } else {
136  return false;
137  }
138 }

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 * ProDeRFEditPolicy::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 ProDeRFEditPolicy.cc.

72  {
73 
74  Request::RequestType type = request->type();
75 
76  if (type == Request::MODIFY_REQUEST) {
77  ModifyRFCmd* modifyCmd = new ModifyRFCmd(host_);
78  return modifyCmd;
79 
80  } else if (type == Request::DELETE_REQUEST) {
81  DeleteRFCmd* deleteCmd = new DeleteRFCmd(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  RegisterFile* rf = dynamic_cast<RegisterFile*>(host_->model());
92  format fmt = generator->text(ProDeTextGenerator::STATUS_REGISTER_FILE);
93  string type = "";
94  if (rf->isNormal()) {
95  type = generator->text(
97  } else if (rf->isVolatile()) {
98  type = generator->text(
100  } else if (rf->isReserved()) {
101  type = generator->text(
103  } else {
104  // unknown rf type
105  assert(false);
106  }
107 
108  fmt % rf->name() % type %
111 
112  SetStatusTextCmd* statusCmd = new SetStatusTextCmd(fmt.str());
113  return statusCmd;
114 
115  } else {
116  return NULL;
117  }
118 }

References assert, Request::COPY_REQUEST, Request::DELETE_REQUEST, EditPolicy::host_, ProDeTextGenerator::instance(), TTAMachine::RegisterFile::isNormal(), TTAMachine::RegisterFile::isReserved(), TTAMachine::RegisterFile::isVolatile(), EditPart::model(), Request::MODIFY_REQUEST, TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), ProDeTextGenerator::STATUS_REGISTER_FILE, Request::STATUS_REQUEST, Texts::TextGenerator::text(), Conversion::toString(), ProDeTextGenerator::TXT_RF_TYPE_NORMAL, ProDeTextGenerator::TXT_RF_TYPE_RESERVED, ProDeTextGenerator::TXT_RF_TYPE_VOLATILE, Request::type(), and TTAMachine::BaseRegisterFile::width().

Here is the call graph for this function:

◆ operator=()

ProDeRFEditPolicy& ProDeRFEditPolicy::operator= ( ProDeRFEditPolicy 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
TTAMachine::RegisterFile::isReserved
virtual bool isReserved() const
Definition: RegisterFile.cc:184
DeleteRFCmd
Definition: DeleteRFCmd.hh:42
SetStatusTextCmd
Definition: SetStatusTextCmd.hh:43
ModifyRFCmd
Definition: ModifyRFCmd.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::TXT_RF_TYPE_NORMAL
@ TXT_RF_TYPE_NORMAL
Register file type: normal.
Definition: ProDeTextGenerator.hh:157
TTAMachine::RegisterFile::isNormal
virtual bool isNormal() const
Definition: RegisterFile.cc:158
Request::COPY_REQUEST
@ COPY_REQUEST
Copy request.
Definition: Request.hh:51
EditPolicy::host_
EditPart * host_
Host EditPart of this EditPolicy.
Definition: EditPolicy.hh:74
EditPolicy::EditPolicy
EditPolicy()
Definition: EditPolicy.cc:41
Request::RequestType
RequestType
Data type for determining the type of a Request.
Definition: Request.hh:46
EditPart::model
TTAMachine::MachinePart * model() const
ProDeTextGenerator::STATUS_REGISTER_FILE
@ STATUS_REGISTER_FILE
Status line template for RFs.
Definition: ProDeTextGenerator.hh:286
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
Request::MODIFY_REQUEST
@ MODIFY_REQUEST
Modfify request.
Definition: Request.hh:48
ProDeTextGenerator::TXT_RF_TYPE_RESERVED
@ TXT_RF_TYPE_RESERVED
Register file type: reserved.
Definition: ProDeTextGenerator.hh:159
Request::STATUS_REQUEST
@ STATUS_REQUEST
Status request.
Definition: Request.hh:52
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
ProDeTextGenerator::TXT_RF_TYPE_VOLATILE
@ TXT_RF_TYPE_VOLATILE
Register file type: volatile.
Definition: ProDeTextGenerator.hh:158
TTAMachine::RegisterFile::isVolatile
virtual bool isVolatile() const
Definition: RegisterFile.cc:171
TTAMachine::BaseRegisterFile::width
virtual int width() const