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

#include <ProDeGCUEditPolicy.hh>

Inheritance diagram for ProDeGCUEditPolicy:
Inheritance graph
Collaboration diagram for ProDeGCUEditPolicy:
Collaboration graph

Public Member Functions

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

ProDeGCUEditPolicyoperator= (ProDeGCUEditPolicy &old)
 Assignment not allowed. More...
 
 ProDeGCUEditPolicy (ProDeGCUEditPolicy &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 GCU 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 ProDeGCUEditPolicy.hh.

Constructor & Destructor Documentation

◆ ProDeGCUEditPolicy() [1/2]

ProDeGCUEditPolicy::ProDeGCUEditPolicy ( )

The Constructor.

Definition at line 55 of file ProDeGCUEditPolicy.cc.

55  : EditPolicy() {
56 }

◆ ~ProDeGCUEditPolicy()

ProDeGCUEditPolicy::~ProDeGCUEditPolicy ( )
virtual

The Destructor.

Definition at line 61 of file ProDeGCUEditPolicy.cc.

61  {
62 }

◆ ProDeGCUEditPolicy() [2/2]

ProDeGCUEditPolicy::ProDeGCUEditPolicy ( ProDeGCUEditPolicy old)
private

Copying not allowed.

Member Function Documentation

◆ canHandle()

bool ProDeGCUEditPolicy::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 108 of file ProDeGCUEditPolicy.cc.

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

References Request::COPY_REQUEST, Request::DELETE_REQUEST, Request::MODIFY_REQUEST, and Request::type().

Here is the call graph for this function:

◆ getCommand()

ComponentCommand * ProDeGCUEditPolicy::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 71 of file ProDeGCUEditPolicy.cc.

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

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

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
CopyComponent
Definition: CopyComponent.hh:42
DeleteGCUCmd
Definition: DeleteGCUCmd.hh:42
Request::type
RequestType type() const
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
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
Definition: ProDeTextGenerator.hh:49
ModifyGCUCmd
Definition: ModifyGCUCmd.hh:43
Request::COPY_REQUEST
@ COPY_REQUEST
Copy request.
Definition: Request.hh:51
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
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::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
ProDeTextGenerator::STATUS_GCU
@ STATUS_GCU
Status line template for GCUs.
Definition: ProDeTextGenerator.hh:288
Request::MODIFY_REQUEST
@ MODIFY_REQUEST
Modfify request.
Definition: Request.hh:48
Request::STATUS_REQUEST
@ STATUS_REQUEST
Status request.
Definition: Request.hh:52