OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
 ProDeRFEditPolicy (ProDeRFEditPolicy &old)
 Copying not allowed.
 

Additional Inherited Members

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

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}
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 * 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}
#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_RF_TYPE_NORMAL
Register file type: normal.
@ TXT_RF_TYPE_VOLATILE
Register file type: volatile.
@ STATUS_REGISTER_FILE
Status line template for RFs.
@ TXT_RF_TYPE_RESERVED
Register file type: reserved.
virtual int numberOfRegisters() const
virtual int width() const
virtual TCEString name() const
virtual bool isVolatile() const
virtual bool isReserved() const
virtual bool isNormal() const
virtual boost::format text(int textId)

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: