OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
DeleteBridgeCmd Class Reference

#include <DeleteBridgeCmd.hh>

Inheritance diagram for DeleteBridgeCmd:
Inheritance graph
Collaboration diagram for DeleteBridgeCmd:
Collaboration graph

Public Member Functions

 DeleteBridgeCmd (EditPart *editPart)
 
virtual ~DeleteBridgeCmd ()
 
virtual bool Do ()
 
- Public Member Functions inherited from ComponentCommand
 ComponentCommand ()
 
virtual ~ComponentCommand ()
 
wxWindow * parentWindow ()
 
void setParentWindow (wxWindow *window)
 

Private Attributes

EditParteditPart_
 Bridge to delete.
 

Detailed Description

Command for deleting bridges from the Machine.

Definition at line 44 of file DeleteBridgeCmd.hh.

Constructor & Destructor Documentation

◆ DeleteBridgeCmd()

DeleteBridgeCmd::DeleteBridgeCmd ( EditPart editPart)

The Constructor.

Parameters
editPartBridge to delete.

Definition at line 46 of file DeleteBridgeCmd.cc.

46 :
48 editPart_(editPart) {
49}
EditPart * editPart_
Bridge to delete.

◆ ~DeleteBridgeCmd()

DeleteBridgeCmd::~DeleteBridgeCmd ( )
virtual

The Destructor.

Definition at line 55 of file DeleteBridgeCmd.cc.

55 {
56}

Member Function Documentation

◆ Do()

bool DeleteBridgeCmd::Do ( )
virtual

Executes the command.

Returns
true, if the command was succesfully executed, false otherwise.

Implements ComponentCommand.

Definition at line 65 of file DeleteBridgeCmd.cc.

65 {
66
67 if (editPart_->childCount() == 0) {
68 Bridge* bridge = dynamic_cast<Bridge*>(editPart_->model());
69 assert (bridge != NULL);
70 delete bridge;
71 bridge = NULL;
72 } else {
73 // bidirectional bridge
75 // delete bridges of both direction
76 for (int i = 0; i < editPart_->childCount(); i++) {
77 Bridge* bridge =
78 dynamic_cast<Bridge*>(editPart_->child(i)->model());
79 assert (bridge != NULL);
80 delete bridge;
81 bridge = NULL;
82 }
83 }
84
85 return true;
86}
#define assert(condition)
int childCount() const
EditPart * child(unsigned int index) const
TTAMachine::MachinePart * model() const

References assert, EditPart::child(), EditPart::childCount(), editPart_, and EditPart::model().

Here is the call graph for this function:

Member Data Documentation

◆ editPart_

EditPart* DeleteBridgeCmd::editPart_
private

Bridge to delete.

Definition at line 52 of file DeleteBridgeCmd.hh.

Referenced by Do().


The documentation for this class was generated from the following files: