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

#include <ProDeBridgeEditPolicy.hh>

Inheritance diagram for ProDeBridgeEditPolicy:
Inheritance graph
Collaboration diagram for ProDeBridgeEditPolicy:
Collaboration graph

Public Member Functions

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

ProDeBridgeEditPolicyoperator= (ProDeBridgeEditPolicy &old)
 Assignment not allowed. More...
 
 ProDeBridgeEditPolicy (ProDeBridgeEditPolicy &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 bridge 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 ProDeBridgeEditPolicy.hh.

Constructor & Destructor Documentation

◆ ProDeBridgeEditPolicy() [1/2]

ProDeBridgeEditPolicy::ProDeBridgeEditPolicy ( )

The Constructor.

Definition at line 52 of file ProDeBridgeEditPolicy.cc.

52  : EditPolicy() {
53 }

◆ ~ProDeBridgeEditPolicy()

ProDeBridgeEditPolicy::~ProDeBridgeEditPolicy ( )
virtual

The Destructor.

Definition at line 58 of file ProDeBridgeEditPolicy.cc.

58  {
59 }

◆ ProDeBridgeEditPolicy() [2/2]

ProDeBridgeEditPolicy::ProDeBridgeEditPolicy ( ProDeBridgeEditPolicy old)
private

Copying not allowed.

Member Function Documentation

◆ canHandle()

bool ProDeBridgeEditPolicy::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 101 of file ProDeBridgeEditPolicy.cc.

101  {
102  Request::RequestType type = request->type();
103  if (type == Request::MODIFY_REQUEST ||
104  type == Request::DELETE_REQUEST ||
105  type == Request::STATUS_REQUEST) {
106  return true;
107  } else {
108  return false;
109  }
110 }

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

Here is the call graph for this function:

◆ getCommand()

ComponentCommand * ProDeBridgeEditPolicy::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 68 of file ProDeBridgeEditPolicy.cc.

68  {
69 
70  Request::RequestType type = request->type();
71 
72  if (type == Request::MODIFY_REQUEST) {
73  ModifyBridgeCmd* modifyCmd = new ModifyBridgeCmd(host_);
74  return modifyCmd;
75 
76  } else if (type == Request::DELETE_REQUEST) {
77  DeleteBridgeCmd* deleteCmd = new DeleteBridgeCmd(host_);
78  return deleteCmd;
79 
80  } else if (type == Request::STATUS_REQUEST) {
82  Bridge* bridge = dynamic_cast<Bridge*>(host_->model());
83  format fmt = generator->text(ProDeTextGenerator::STATUS_BRIDGE);
84  fmt % bridge->name();
85  SetStatusTextCmd* statusCmd = new SetStatusTextCmd(fmt.str());
86  return statusCmd;
87 
88  } else {
89  return NULL;
90  }
91 }

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

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
Request::type
RequestType type() const
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAMachine::Bridge
Definition: Bridge.hh:51
SetStatusTextCmd
Definition: SetStatusTextCmd.hh:43
ProDeTextGenerator::STATUS_BRIDGE
@ STATUS_BRIDGE
Status line template for bridges.
Definition: ProDeTextGenerator.hh:292
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
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
DeleteBridgeCmd
Definition: DeleteBridgeCmd.hh:44
EditPart::model
TTAMachine::MachinePart * model() const
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
ModifyBridgeCmd
Definition: ModifyBridgeCmd.hh:45
Request::MODIFY_REQUEST
@ MODIFY_REQUEST
Modfify request.
Definition: Request.hh:48
Request::STATUS_REQUEST
@ STATUS_REQUEST
Status request.
Definition: Request.hh:52