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

#include <FUFactory.hh>

Inheritance diagram for FUFactory:
Inheritance graph
Collaboration diagram for FUFactory:
Collaboration graph

Public Member Functions

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

FUFactoryoperator= (FUFactory &old)
 Assignment not allowed. More...
 
 FUFactory (FUFactory &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 function unit EditParts corresponding to a given Machine FunctionUnit object.

Definition at line 45 of file FUFactory.hh.

Constructor & Destructor Documentation

◆ FUFactory() [1/2]

FUFactory::FUFactory ( EditPolicyFactory editPolicyFactory)

The Constructor.

Definition at line 53 of file FUFactory.cc.

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

References EditPartFactory::registerFactory().

Here is the call graph for this function:

◆ ~FUFactory()

FUFactory::~FUFactory ( )
virtual

The Destructor.

Definition at line 63 of file FUFactory.cc.

63  {
64 }

◆ FUFactory() [2/2]

FUFactory::FUFactory ( FUFactory old)
private

Copying not allowed.

Member Function Documentation

◆ createEditPart()

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

Returns an EditPart corresponding to a function unit.

Parameters
componentFunction unit of which to create the EditPart.
Returns
NULL if the parameter is not an instance of the FunctionUnit class.

Implements Factory.

Definition at line 75 of file FUFactory.cc.

75  {
76 
77  FunctionUnit* fu = dynamic_cast<FunctionUnit*>(component);
78 
79  if (fu != NULL) {
80  EditPart* fuEditPart = new EditPart();
81  fuEditPart->setModel(fu);
82 
83  UnitFigure* fig = new UnitFigure();
84  wxString name = WxConversion::toWxString(fu->name());
85  name.Prepend(_T("FU: "));
86  fig->setName(name);
87  fuEditPart->setFigure(fig);
88 
89  for (int i = 0; i < fu->portCount(); i++) {
90  vector<Factory*>::const_iterator iter;
91  for (iter = factories_.begin(); iter != factories_.end(); iter++) {
92  EditPart* portEditPart =
93  (*iter)->createEditPart(fu->port(i));
94  if (portEditPart != NULL) {
95  fuEditPart->addChild(portEditPart);
96  EditPolicy* editPolicy =
98  if (editPolicy != NULL) {
99  portEditPart->installEditPolicy(editPolicy);
100  }
101  }
102  }
103  }
104 
105  wxString operations = _T("{ ");
106  AddressSpace* as = fu->addressSpace();
107  if (as != NULL) {
108  operations.Append(_T("AS: "));
109  operations.Append(
111  operations.Append(_T(" Ops:"));
112  }
113 
114  for (int i = 0; i < fu->operationCount(); i++) {
115  if (i > 0) {
116  operations.Append(_T(", "));
117  }
118  operations.Append(
120  }
121  operations.Append(_T(" }"));
122  fig->setInfo(operations);
123 
124  fuEditPart->setSelectable(true);
125 
127  if (editPolicy != NULL) {
128  fuEditPart->installEditPolicy(editPolicy);
129  }
130 
131  return fuEditPart;
132 
133  } else {
134  return NULL;
135  }
136 }

References EditPart::addChild(), TTAMachine::FunctionUnit::addressSpace(), EditPolicyFactory::createFUEditPolicy(), EditPolicyFactory::createFUPortEditPolicy(), EditPartFactory::editPolicyFactory_, EditPartFactory::factories_, EditPart::installEditPolicy(), TTAMachine::HWOperation::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), EditPart::setFigure(), UnitFigure::setInfo(), EditPart::setModel(), UnitFigure::setName(), EditPart::setSelectable(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
WxConversion::toWxString
static wxString toWxString(const std::string &source)
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
EditPart::setSelectable
void setSelectable(bool selectable)
EditPart::installEditPolicy
void installEditPolicy(EditPolicy *editpolicy)
Definition: EditPart.cc:247
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
TTAMachine::FunctionUnit::addressSpace
virtual AddressSpace * addressSpace() const
Definition: FunctionUnit.cc:580
EditPolicyFactory::createFUPortEditPolicy
virtual EditPolicy * createFUPortEditPolicy()
EditPartFactory::registerFactory
void registerFactory(Factory *factory)
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
EditPolicyFactory::createFUEditPolicy
virtual EditPolicy * createFUEditPolicy()
UnitFigure::setInfo
void setInfo(const wxString &info)
Definition: UnitFigure.cc:323
EditPart::setModel
void setModel(TTAMachine::MachinePart *model)
EditPartFactory::EditPartFactory
EditPartFactory(EditPolicyFactory &editPolicyFactory)
Definition: EditPartFactory.cc:49
TTAMachine::FunctionUnit::operationCount
virtual int operationCount() const
Definition: FunctionUnit.cc:419
UnitFigure::setName
void setName(const wxString &name)
Definition: UnitFigure.cc:304
EditPolicy
Definition: EditPolicy.hh:47
EditPart
Definition: EditPart.hh:60
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
UnitPortFactory
Definition: UnitPortFactory.hh:45
UnitFigure
Definition: UnitFigure.hh:46
EditPart::setFigure
void setFigure(Figure *figure)
TTAMachine::FunctionUnit::operation
virtual HWOperation * operation(const std::string &name) const
Definition: FunctionUnit.cc:363
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