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

#include <ProDeBusEditPolicy.hh>

Inheritance diagram for ProDeBusEditPolicy:
Inheritance graph
Collaboration diagram for ProDeBusEditPolicy:
Collaboration graph

Public Member Functions

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

ProDeBusEditPolicyoperator= (ProDeBusEditPolicy &old)
 Assignment not allowed.
 
 ProDeBusEditPolicy (ProDeBusEditPolicy &old)
 Copying not allowed.
 

Additional Inherited Members

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

Detailed Description

Determines how a bus 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 ProDeBusEditPolicy.hh.

Constructor & Destructor Documentation

◆ ProDeBusEditPolicy() [1/2]

ProDeBusEditPolicy::ProDeBusEditPolicy ( )

The Constructor.

Definition at line 57 of file ProDeBusEditPolicy.cc.

57 : EditPolicy() {
58}

◆ ~ProDeBusEditPolicy()

ProDeBusEditPolicy::~ProDeBusEditPolicy ( )
virtual

The Destructor.

Definition at line 63 of file ProDeBusEditPolicy.cc.

63 {
64}

◆ ProDeBusEditPolicy() [2/2]

ProDeBusEditPolicy::ProDeBusEditPolicy ( ProDeBusEditPolicy old)
private

Copying not allowed.

Member Function Documentation

◆ canHandle()

bool ProDeBusEditPolicy::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 120 of file ProDeBusEditPolicy.cc.

120 {
121 Request::RequestType type = request->type();
122 if (type == Request::MODIFY_REQUEST ||
123 type == Request::DELETE_REQUEST ||
124 type == Request::COPY_REQUEST ||
125 type == Request::STATUS_REQUEST) {
126 return true;
127 } else {
128 return false;
129 }
130}
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 * ProDeBusEditPolicy::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 73 of file ProDeBusEditPolicy.cc.

73 {
74
75 Request::RequestType type = request->type();
76
77 if (type == Request::MODIFY_REQUEST) {
78 ModifyBusCmd* modifyCmd = new ModifyBusCmd(host_);
79 return modifyCmd;
80
81 } else if (type == Request::DELETE_REQUEST) {
82 DeleteBusCmd* deleteCmd = new DeleteBusCmd(host_);
83 return deleteCmd;
84
85 } else if (type == Request::COPY_REQUEST) {
86 CopyComponent* copyCmd = new CopyComponent(host_);
87 return copyCmd;
88
89 } else if (type == Request::STATUS_REQUEST) {
90 Bus* bus = dynamic_cast<Bus*>(host_->model());
92 format fmt = generator->text(ProDeTextGenerator::STATUS_BUS);
93 string extension = "";
94 if (bus->signExtends()) {
95 extension = generator->text(
97 } else {
98 extension = generator->text(
100 }
101 fmt % bus->name() % Conversion::toString(bus->width()) %
103 extension;
104 SetStatusTextCmd* statusCmd = new SetStatusTextCmd(fmt.str());
105 return statusCmd;
106
107 } else {
108 return NULL;
109 }
110}
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()
@ STATUS_BUS
Status line template for buses.
@ TXT_RADIO_EXTENSION_ZERO
Label for 'zero' radio button.
@ TXT_RADIO_EXTENSION_SIGN
Label for 'sign' radio button.
int width() const
Definition Bus.cc:149
int immediateWidth() const
Definition Bus.cc:160
bool signExtends() const
Definition Bus.cc:171
virtual TCEString name() const
virtual boost::format text(int textId)

References Request::COPY_REQUEST, Request::DELETE_REQUEST, EditPolicy::host_, TTAMachine::Bus::immediateWidth(), ProDeTextGenerator::instance(), EditPart::model(), Request::MODIFY_REQUEST, TTAMachine::Component::name(), TTAMachine::Bus::signExtends(), ProDeTextGenerator::STATUS_BUS, Request::STATUS_REQUEST, Texts::TextGenerator::text(), Conversion::toString(), ProDeTextGenerator::TXT_RADIO_EXTENSION_SIGN, ProDeTextGenerator::TXT_RADIO_EXTENSION_ZERO, Request::type(), and TTAMachine::Bus::width().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


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