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

#include <SegmentFactory.hh>

Inheritance diagram for SegmentFactory:
Inheritance graph
Collaboration diagram for SegmentFactory:
Collaboration graph

Public Member Functions

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

SegmentFactoryoperator= (SegmentFactory &old)
 Assignment not allowed. More...
 
 SegmentFactory (SegmentFactory &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 segment EditParts corresponding to a given Machine Segment object.

Definition at line 45 of file SegmentFactory.hh.

Constructor & Destructor Documentation

◆ SegmentFactory() [1/2]

SegmentFactory::SegmentFactory ( EditPolicyFactory editPolicyFactory)

The Constructor.

Definition at line 53 of file SegmentFactory.cc.

53  :
54  EditPartFactory(editPolicyFactory) {
55 
56  registerFactory(new SocketFactory(editPolicyFactory));
57 }

References EditPartFactory::registerFactory().

Here is the call graph for this function:

◆ ~SegmentFactory()

SegmentFactory::~SegmentFactory ( )
virtual

The Destructor.

Definition at line 62 of file SegmentFactory.cc.

62  {
63 }

◆ SegmentFactory() [2/2]

SegmentFactory::SegmentFactory ( SegmentFactory old)
private

Copying not allowed.

Member Function Documentation

◆ createEditPart()

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

Returns an EditPart corresponding to a segment.

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

Implements Factory.

Definition at line 73 of file SegmentFactory.cc.

73  {
74 
75  Segment* segment = dynamic_cast<Segment*>(component);
76 
77  if (segment != NULL) {
78  EditPart* segmentEditPart = new EditPart();
79  segmentEditPart->setModel(segment);
80 
81  SegmentFigure* fig = new SegmentFigure(segment->parentBus()->width());
82  segmentEditPart->setFigure(fig);
83 
84  SocketBusConnFactory connFactory;
85 
86  for (int j = 0; j < segment->connectionCount(); j++) {
87  vector<Factory*>::const_iterator i = factories_.begin();
88  for (i = factories_.begin(); i != factories_.end(); i++) {
89  EditPart* socketEditPart =
90  (*i)->createEditPart((MachinePart*)segment->connection(j));
91  if (socketEditPart != NULL) {
92  socketEditPart->addChild(
93  connFactory.createConnection(
94  socketEditPart, segmentEditPart));
95  break;
96  }
97  }
98  }
99 
101  if (editPolicy != NULL) {
102  segmentEditPart->installEditPolicy(editPolicy);
103  }
104 
105  return segmentEditPart;
106 
107  } else {
108  return NULL;
109  }
110 }

References EditPart::addChild(), TTAMachine::Segment::connection(), TTAMachine::Segment::connectionCount(), SocketBusConnFactory::createConnection(), EditPolicyFactory::createSegmentEditPolicy(), EditPartFactory::editPolicyFactory_, EditPartFactory::factories_, EditPart::installEditPolicy(), TTAMachine::Segment::parentBus(), EditPart::setFigure(), EditPart::setModel(), and TTAMachine::Bus::width().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
SocketBusConnFactory::createConnection
virtual EditPart * createConnection(EditPart *source, EditPart *target) const
Definition: SocketBusConnFactory.cc:65
EditPolicyFactory::createSegmentEditPolicy
virtual EditPolicy * createSegmentEditPolicy()
TTAMachine::Segment
Definition: Segment.hh:54
TTAMachine::Bus::width
int width() const
Definition: Bus.cc:149
EditPart::installEditPolicy
void installEditPolicy(EditPolicy *editpolicy)
Definition: EditPart.cc:247
SegmentFigure
Definition: SegmentFigure.hh:46
EditPartFactory::registerFactory
void registerFactory(Factory *factory)
TTAMachine::Segment::connectionCount
int connectionCount() const
SocketFactory
Definition: SocketFactory.hh:47
SocketBusConnFactory
Definition: SocketBusConnFactory.hh:45
TTAMachine::Segment::parentBus
Bus * parentBus() const
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
TTAMachine::Segment::connection
const Connection & connection(const Socket &socket) const
Definition: Segment.cc:250
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
EditPartFactory::factories_
std::vector< Factory * > factories_
Registered factories.
Definition: EditPartFactory.hh:60