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

#include <BridgeFactory.hh>

Inheritance diagram for BridgeFactory:
Inheritance graph
Collaboration diagram for BridgeFactory:
Collaboration graph

Public Member Functions

 BridgeFactory (EditPolicyFactory &editPolicyFactory)
 
virtual ~BridgeFactory ()
 
virtual EditPartcreateEditPart (TTAMachine::MachinePart *component)
 
- Public Member Functions inherited from EditPartFactory
virtual ~EditPartFactory ()
 
void registerFactory (Factory *factory)
 
- Public Member Functions inherited from Factory
virtual ~Factory ()
 

Private Member Functions

BridgeFactoryoperator= (BridgeFactory &old)
 Assignment not allowed. More...
 
 BridgeFactory (BridgeFactory &old)
 Copying not allowed. More...
 

Additional Inherited Members

- Protected Member Functions inherited from EditPartFactory
 EditPartFactory (EditPolicyFactory &editPolicyFactory)
 
EditPartcheckCache (const TTAMachine::MachinePart *component) const
 
void writeToCache (EditPart *editPart)
 
- Protected Member Functions inherited from Factory
 Factory ()
 
- Protected Attributes inherited from EditPartFactory
std::vector< Factory * > factories_
 Registered factories. More...
 
EditPolicyFactoryeditPolicyFactory_
 Factory which creates edit policies for edit parts. More...
 
- Static Protected Attributes inherited from EditPartFactory
static std::vector< EditPart * > created_
 Container for already created EditParts. More...
 

Detailed Description

Factory for creating bridge EditParts corresponding to a given Machine Bridge object.

Definition at line 45 of file BridgeFactory.hh.

Constructor & Destructor Documentation

◆ BridgeFactory() [1/2]

BridgeFactory::BridgeFactory ( EditPolicyFactory editPolicyFactory)

The Constructor.

Definition at line 50 of file BridgeFactory.cc.

50  :
51  EditPartFactory(editPolicyFactory) {
52 
53  registerFactory(new BusFactory(editPolicyFactory));
54 }

References EditPartFactory::registerFactory().

Here is the call graph for this function:

◆ ~BridgeFactory()

BridgeFactory::~BridgeFactory ( )
virtual

The Destructor.

Definition at line 59 of file BridgeFactory.cc.

59  {
60 }

◆ BridgeFactory() [2/2]

BridgeFactory::BridgeFactory ( BridgeFactory old)
private

Copying not allowed.

Member Function Documentation

◆ createEditPart()

EditPart * BridgeFactory::createEditPart ( TTAMachine::MachinePart component)
virtual

Returns an EditPart corresponding to a bridge.

Parameters
componentBridge of which to create the EditPart.
Returns
NULL if the parameter is not an instance of the Bridge class.

Implements Factory.

Definition at line 70 of file BridgeFactory.cc.

70  {
71 
72  Bridge* bridge = dynamic_cast<Bridge*>(component);
73 
74  if (bridge != NULL) {
75 
76  ConnectionEditPart* bridgeEditPart = new ConnectionEditPart();
77 
78  bridgeEditPart->setModel(bridge);
79  BridgeFigure* fig = new BridgeFigure();
80  bridgeEditPart->setFigure(fig);
81 
82  vector<Factory*>::const_iterator iter;
83 
84  for (iter = factories_.begin(); iter != factories_.end(); iter++) {
85 
86  EditPart* busEditPart = (*iter)->createEditPart(
87  (MachinePart*)bridge->sourceBus());
88 
89  if (busEditPart != NULL) {
90  bridgeEditPart->setSource(busEditPart);
91  bridgeEditPart->setTarget(
92  (*iter)->createEditPart(
93  (MachinePart*)bridge->destinationBus()));
94  break;
95  }
96  }
97 
98  assert(bridgeEditPart->target() != NULL &&
99  bridgeEditPart->source() != NULL);
100 
101  bridgeEditPart->setSelectable(true);
102 
104  if (editPolicy != NULL) {
105  bridgeEditPart->installEditPolicy(editPolicy);
106  }
107 
108  return bridgeEditPart;
109 
110  } else {
111  return NULL;
112  }
113 }

References assert, EditPolicyFactory::createBridgeEditPolicy(), TTAMachine::Bridge::destinationBus(), EditPartFactory::editPolicyFactory_, EditPartFactory::factories_, EditPart::installEditPolicy(), EditPart::setFigure(), EditPart::setModel(), EditPart::setSelectable(), ConnectionEditPart::setSource(), ConnectionEditPart::setTarget(), ConnectionEditPart::source(), TTAMachine::Bridge::sourceBus(), and ConnectionEditPart::target().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
ConnectionEditPart::setSource
void setSource(EditPart *source)
Definition: ConnectionEditPart.cc:56
TTAMachine::Bridge::sourceBus
Bus * sourceBus() const
TTAMachine::Bridge::destinationBus
Bus * destinationBus() const
TTAMachine::Bridge
Definition: Bridge.hh:51
EditPart::setSelectable
void setSelectable(bool selectable)
EditPart::installEditPolicy
void installEditPolicy(EditPolicy *editpolicy)
Definition: EditPart.cc:247
ConnectionEditPart::target
EditPart * target() const
EditPolicyFactory::createBridgeEditPolicy
virtual EditPolicy * createBridgeEditPolicy()
ConnectionEditPart::source
EditPart * source() const
EditPartFactory::registerFactory
void registerFactory(Factory *factory)
assert
#define assert(condition)
Definition: Application.hh:86
BridgeFigure
Definition: BridgeFigure.hh:46
EditPart::setModel
void setModel(TTAMachine::MachinePart *model)
TTAMachine::MachinePart
Definition: MachinePart.hh:57
EditPartFactory::EditPartFactory
EditPartFactory(EditPolicyFactory &editPolicyFactory)
Definition: EditPartFactory.cc:49
EditPolicy
Definition: EditPolicy.hh:47
EditPart
Definition: EditPart.hh:60
BusFactory
Definition: BusFactory.hh:45
EditPart::setFigure
void setFigure(Figure *figure)
ConnectionEditPart
Definition: ConnectionEditPart.hh:42
ConnectionEditPart::setTarget
void setTarget(EditPart *target)
Definition: ConnectionEditPart.cc:71
EditPartFactory::editPolicyFactory_
EditPolicyFactory & editPolicyFactory_
Factory which creates edit policies for edit parts.
Definition: EditPartFactory.hh:64
EditPartFactory::factories_
std::vector< Factory * > factories_
Registered factories.
Definition: EditPartFactory.hh:60