OpenASIP  2.0
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. More...
 
 ProDeBusEditPolicy (ProDeBusEditPolicy &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 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 }

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 }

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:
TTAMachine::Bus::immediateWidth
int immediateWidth() const
Definition: Bus.cc:160
CopyComponent
Definition: CopyComponent.hh:42
Request::type
RequestType type() const
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAMachine::Bus::width
int width() const
Definition: Bus.cc:149
TTAMachine::Bus
Definition: Bus.hh:53
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
ProDeTextGenerator::STATUS_BUS
@ STATUS_BUS
Status line template for buses.
Definition: ProDeTextGenerator.hh:289
Conversion::toString
static std::string toString(const T &source)
ProDeTextGenerator
Definition: ProDeTextGenerator.hh:49
TTAMachine::Bus::signExtends
bool signExtends() const
Definition: Bus.cc:171
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
DeleteBusCmd
Definition: DeleteBusCmd.hh:42
EditPart::model
TTAMachine::MachinePart * model() const
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
ModifyBusCmd
Definition: ModifyBusCmd.hh:43
Request::MODIFY_REQUEST
@ MODIFY_REQUEST
Modfify request.
Definition: Request.hh:48
Request::STATUS_REQUEST
@ STATUS_REQUEST
Status request.
Definition: Request.hh:52