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

#include <ProximPortEditPolicy.hh>

Inheritance diagram for ProximPortEditPolicy:
Inheritance graph
Collaboration diagram for ProximPortEditPolicy:
Collaboration graph

Public Member Functions

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

Additional Inherited Members

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

Detailed Description

Edit policy for Proxim machine state window ports.

Definition at line 41 of file ProximPortEditPolicy.hh.

Constructor & Destructor Documentation

◆ ProximPortEditPolicy()

ProximPortEditPolicy::ProximPortEditPolicy ( )

The Constructor.

Definition at line 46 of file ProximPortEditPolicy.cc.

46  :
47  EditPolicy() {
48 }

◆ ~ProximPortEditPolicy()

ProximPortEditPolicy::~ProximPortEditPolicy ( )
virtual

The Destructor.

Definition at line 54 of file ProximPortEditPolicy.cc.

54  {
55 }

Member Function Documentation

◆ canHandle()

bool ProximPortEditPolicy::canHandle ( Request request) const
virtual

Tells whether this EditPolicy can handle request of the given type.

Parameters
Requestto be handled.
Returns
True, if the editpolicy can handle give request type.

Implements EditPolicy.

Definition at line 64 of file ProximPortEditPolicy.cc.

64  {
65 
66  Request::RequestType type = request->type();
67  if (type == Request::STATUS_REQUEST) {
68  return true;
69  } else if (type == Request::DETAILS_REQUEST) {
70  // Details only available for function unit ports.
71  const FUPort* fuPort =
72  dynamic_cast<const FUPort*>(host_->model());
73 
74  if (fuPort != NULL) {
75  return true;
76  }
77  }
78 
79  return false;
80 }

References Request::DETAILS_REQUEST, EditPolicy::host_, EditPart::model(), Request::STATUS_REQUEST, and Request::type().

Here is the call graph for this function:

◆ getCommand()

ComponentCommand * ProximPortEditPolicy::getCommand ( Request request)
virtual

Returns command correspoding to the request type.

Parameters
requestRequest to handle.
Returns
NULL, if the request can't be handled.

Implements EditPolicy.

Definition at line 90 of file ProximPortEditPolicy.cc.

90  {
91 
92  Request::RequestType type = request->type();
93 
94  if (type == Request::STATUS_REQUEST) {
95  const Port* port = dynamic_cast<Port*>(host_->model());
96  assert(port != NULL);
97  std::string name = port->name();
98  return new ProximComponentStatusCmd("Port: " + name);
99  } else if (type == Request::DETAILS_REQUEST) {
100  const FUPort* fuPort =
101  dynamic_cast<const FUPort*>(host_->model());
102  if (fuPort == NULL) {
103  return NULL;
104  } else {
105  return new ProximFUPortDetailsCmd(*fuPort);
106  }
107  }
108 
109  return NULL;
110 }

References assert, Request::DETAILS_REQUEST, EditPolicy::host_, EditPart::model(), TTAMachine::Port::name(), Request::STATUS_REQUEST, and Request::type().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
Request::type
RequestType type() const
ProximFUPortDetailsCmd
Definition: ProximFUPortDetailsCmd.hh:46
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FUPort
Definition: FUPort.hh:46
Request::DETAILS_REQUEST
@ DETAILS_REQUEST
Detailed info request.
Definition: Request.hh:53
TTAMachine::Port
Definition: Port.hh:54
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
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
Request::STATUS_REQUEST
@ STATUS_REQUEST
Status request.
Definition: Request.hh:52
ProximComponentStatusCmd
Definition: ProximComponentStatusCmd.hh:42