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

#include <ProDeFUEditPolicy.hh>

Inheritance diagram for ProDeFUEditPolicy:
Inheritance graph
Collaboration diagram for ProDeFUEditPolicy:
Collaboration graph

Public Member Functions

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

ProDeFUEditPolicyoperator= (ProDeFUEditPolicy &old)
 Assignment not allowed. More...
 
 ProDeFUEditPolicy (ProDeFUEditPolicy &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 function 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 ProDeFUEditPolicy.hh.

Constructor & Destructor Documentation

◆ ProDeFUEditPolicy() [1/2]

ProDeFUEditPolicy::ProDeFUEditPolicy ( )

The Constructor.

Definition at line 53 of file ProDeFUEditPolicy.cc.

53  : EditPolicy() {
54 }

◆ ~ProDeFUEditPolicy()

ProDeFUEditPolicy::~ProDeFUEditPolicy ( )
virtual

The Destructor.

Definition at line 59 of file ProDeFUEditPolicy.cc.

59  {
60 }

◆ ProDeFUEditPolicy() [2/2]

ProDeFUEditPolicy::ProDeFUEditPolicy ( ProDeFUEditPolicy old)
private

Copying not allowed.

Member Function Documentation

◆ canHandle()

bool ProDeFUEditPolicy::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 107 of file ProDeFUEditPolicy.cc.

107  {
108  Request::RequestType type = request->type();
109  if (type == Request::MODIFY_REQUEST ||
110  type == Request::DELETE_REQUEST ||
111  type == Request::COPY_REQUEST ||
112  type == Request::STATUS_REQUEST) {
113  return true;
114  } else {
115  return false;
116  }
117 }

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 * ProDeFUEditPolicy::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 69 of file ProDeFUEditPolicy.cc.

69  {
70 
71  Request::RequestType type = request->type();
72 
73  if (type == Request::MODIFY_REQUEST) {
74  ModifyFUCmd* modifyCmd = new ModifyFUCmd(host_);
75  return modifyCmd;
76 
77  } else if (type == Request::DELETE_REQUEST) {
78  DeleteFUCmd* deleteCmd = new DeleteFUCmd(host_);
79  return deleteCmd;
80 
81  } else if (type == Request::COPY_REQUEST) {
82  CopyComponent* copyCmd = new CopyComponent(host_);
83  return copyCmd;
84 
85  } else if (type == Request::STATUS_REQUEST) {
86 
88  FunctionUnit* fu = dynamic_cast<FunctionUnit*>(host_->model());
89  format fmt = generator->text(ProDeTextGenerator::STATUS_FUNCTION_UNIT);
90  fmt % fu->name();
91  SetStatusTextCmd* statusCmd = new SetStatusTextCmd(fmt.str());
92  return statusCmd;
93 
94  } else {
95  return NULL;
96  }
97 }

References Request::COPY_REQUEST, Request::DELETE_REQUEST, EditPolicy::host_, ProDeTextGenerator::instance(), EditPart::model(), Request::MODIFY_REQUEST, TTAMachine::Component::name(), ProDeTextGenerator::STATUS_FUNCTION_UNIT, Request::STATUS_REQUEST, Texts::TextGenerator::text(), and Request::type().

Here is the call graph for this function:

◆ operator=()

ProDeFUEditPolicy& ProDeFUEditPolicy::operator= ( ProDeFUEditPolicy 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
ModifyFUCmd
Definition: ModifyFUCmd.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
Definition: ProDeTextGenerator.hh:49
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
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
DeleteFUCmd
Definition: DeleteFUCmd.hh:42
EditPart::model
TTAMachine::MachinePart * model() const
ProDeTextGenerator::STATUS_FUNCTION_UNIT
@ STATUS_FUNCTION_UNIT
Status line template for FUs.
Definition: ProDeTextGenerator.hh:285
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
Request::MODIFY_REQUEST
@ MODIFY_REQUEST
Modfify request.
Definition: Request.hh:48
Request::STATUS_REQUEST
@ STATUS_REQUEST
Status request.
Definition: Request.hh:52