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

#include <BusFactory.hh>

Inheritance diagram for BusFactory:
Inheritance graph
Collaboration diagram for BusFactory:
Collaboration graph

Public Member Functions

 BusFactory (EditPolicyFactory &editPolicyFactory)
 
virtual ~BusFactory ()
 
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

BusFactoryoperator= (BusFactory &old)
 Assignment not allowed. More...
 
 BusFactory (BusFactory &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 bus EditParts corresponding to a given Machine Bus object.

Definition at line 45 of file BusFactory.hh.

Constructor & Destructor Documentation

◆ BusFactory() [1/2]

BusFactory::BusFactory ( EditPolicyFactory editPolicyFactory)

The Constructor.

Definition at line 51 of file BusFactory.cc.

51  :
52  EditPartFactory(editPolicyFactory) {
53 
54  registerFactory(new SegmentFactory(editPolicyFactory));
55 }

References EditPartFactory::registerFactory().

Here is the call graph for this function:

◆ ~BusFactory()

BusFactory::~BusFactory ( )
virtual

The Destructor.

Definition at line 60 of file BusFactory.cc.

60  {
61 }

◆ BusFactory() [2/2]

BusFactory::BusFactory ( BusFactory old)
private

Copying not allowed.

Member Function Documentation

◆ createEditPart()

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

Returns an EditPart corresponding to a bus.

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

Implements Factory.

Definition at line 71 of file BusFactory.cc.

71  {
72 
73  EditPart* busEditPart = EditPartFactory::checkCache(component);
74 
75  if (busEditPart != NULL) {
76  return busEditPart;
77  }
78 
79  Bus* bus = dynamic_cast<Bus*>(component);
80 
81  if (bus != NULL) {
82 
83  busEditPart = new EditPart();
84  busEditPart->setModel(bus);
85 
86  BusFigure* fig = new BusFigure(bus->position());
87  busEditPart->setFigure(fig);
88 
89  for (int i = 0; i < bus->segmentCount(); i++) {
90  vector<Factory*>::const_iterator iter = factories_.begin();
91  while (iter != factories_.end()) {
92  EditPart* segEditPart =
93  (*iter)->createEditPart((MachinePart*)bus->segment(i));
94  if (segEditPart != NULL) {
95  busEditPart->addChild(segEditPart);
96  segEditPart->setSelectable(true);
97  segEditPart->setParent(busEditPart);
98  }
99  iter++;
100  }
101  }
102 
103  busEditPart->setSelectable(true);
104 
106  if (editPolicy != NULL) {
107  busEditPart->installEditPolicy(editPolicy);
108  }
109  EditPartFactory::writeToCache(busEditPart);
110  return busEditPart;
111 
112  } else {
113  return NULL;
114  }
115 }

References EditPart::addChild(), EditPartFactory::checkCache(), EditPolicyFactory::createBusEditPolicy(), EditPartFactory::editPolicyFactory_, EditPartFactory::factories_, EditPart::installEditPolicy(), TTAMachine::Bus::position(), TTAMachine::Bus::segment(), TTAMachine::Bus::segmentCount(), EditPart::setFigure(), EditPart::setModel(), EditPart::setParent(), EditPart::setSelectable(), and EditPartFactory::writeToCache().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
BusFigure
Definition: BusFigure.hh:48
EditPart::setSelectable
void setSelectable(bool selectable)
TTAMachine::Bus
Definition: Bus.hh:53
EditPartFactory::checkCache
EditPart * checkCache(const TTAMachine::MachinePart *component) const
Definition: EditPartFactory.cc:72
EditPolicyFactory::createBusEditPolicy
virtual EditPolicy * createBusEditPolicy()
EditPart::installEditPolicy
void installEditPolicy(EditPolicy *editpolicy)
Definition: EditPart.cc:247
TTAMachine::Bus::segment
virtual Segment * segment(int index) const
Definition: Bus.cc:329
EditPartFactory::registerFactory
void registerFactory(Factory *factory)
EditPart::setParent
void setParent(EditPart *parent)
EditPartFactory::writeToCache
void writeToCache(EditPart *editPart)
Definition: EditPartFactory.cc:89
TTAMachine::Bus::position
virtual int position() const
Definition: Bus.cc:127
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
EditPart::setFigure
void setFigure(Figure *figure)
EditPart::addChild
void addChild(EditPart *child)
Definition: EditPart.cc:260
EditPartFactory::editPolicyFactory_
EditPolicyFactory & editPolicyFactory_
Factory which creates edit policies for edit parts.
Definition: EditPartFactory.hh:64
TTAMachine::Bus::segmentCount
virtual int segmentCount() const
Definition: Bus.cc:385
SegmentFactory
Definition: SegmentFactory.hh:45
EditPartFactory::factories_
std::vector< Factory * > factories_
Registered factories.
Definition: EditPartFactory.hh:60