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

#include <IUFactory.hh>

Inheritance diagram for IUFactory:
Inheritance graph
Collaboration diagram for IUFactory:
Collaboration graph

Public Member Functions

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

IUFactoryoperator= (IUFactory &old)
 Assignment not allowed. More...
 
 IUFactory (IUFactory &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 immediate unit EditParts corresponding to a given Machine ImmediateUnit object.

Definition at line 45 of file IUFactory.hh.

Constructor & Destructor Documentation

◆ IUFactory() [1/2]

IUFactory::IUFactory ( EditPolicyFactory editPolicyFactory)

The Constructor.

Definition at line 52 of file IUFactory.cc.

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

References EditPartFactory::registerFactory().

Here is the call graph for this function:

◆ ~IUFactory()

IUFactory::~IUFactory ( )
virtual

The Destructor.

Definition at line 61 of file IUFactory.cc.

61  {
62 }

◆ IUFactory() [2/2]

IUFactory::IUFactory ( IUFactory old)
private

Copying not allowed.

Member Function Documentation

◆ createEditPart()

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

Returns an EditPart corresponding to a immediate unit.

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

Implements Factory.

Definition at line 72 of file IUFactory.cc.

72  {
73 
74  ImmediateUnit* imm = dynamic_cast<ImmediateUnit*>(component);
75 
76  if (imm != NULL) {
77  EditPart* immEditPart = new EditPart();
78  immEditPart->setModel(imm);
79 
80  UnitFigure* fig = new UnitFigure();
81  wxString name = WxConversion::toWxString(imm->name());
82  name.Prepend(_T("IMM: "));
83  fig->setName(name);
84  immEditPart->setFigure(fig);
85 
86  for (int i = 0; i < imm->portCount(); i++) {
87  vector<Factory*>::const_iterator iter;
88  for (iter = factories_.begin(); iter != factories_.end(); iter++) {
89  EditPart* portEditPart =
90  (*iter)->createEditPart(imm->port(i));
91  if (portEditPart != NULL) {
92  EditPolicy* editPolicy =
94  if (editPolicy != NULL) {
95  portEditPart->installEditPolicy(editPolicy);
96  }
97  immEditPart->addChild(portEditPart);
98  }
99  }
100  }
101 
102 
103  wxString info = WxConversion::toWxString(imm->numberOfRegisters());
104  info.Append(_T("x"));
105  info.Append(WxConversion::toWxString(imm->width()));
106  fig->setInfo(info);
107  immEditPart->setSelectable(true);
108 
110  if (editPolicy != NULL) {
111  immEditPart->installEditPolicy(editPolicy);
112  }
113 
114  return immEditPart;
115 
116  } else {
117  return NULL;
118  }
119 }

References EditPart::addChild(), EditPolicyFactory::createIUEditPolicy(), EditPolicyFactory::createIUPortEditPolicy(), EditPartFactory::editPolicyFactory_, EditPartFactory::factories_, EditPart::installEditPolicy(), TTAMachine::Component::name(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), EditPart::setFigure(), UnitFigure::setInfo(), EditPart::setModel(), UnitFigure::setName(), EditPart::setSelectable(), WxConversion::toWxString(), and TTAMachine::BaseRegisterFile::width().

Here is the call graph for this function:

◆ operator=()

IUFactory& IUFactory::operator= ( IUFactory 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
EditPart::setSelectable
void setSelectable(bool selectable)
EditPart::installEditPolicy
void installEditPolicy(EditPolicy *editpolicy)
Definition: EditPart.cc:247
TTAMachine::BaseRegisterFile::numberOfRegisters
virtual int numberOfRegisters() const
EditPartFactory::registerFactory
void registerFactory(Factory *factory)
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
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
TTAMachine::BaseRegisterFile::port
virtual RFPort * port(const std::string &name) const
Definition: BaseRegisterFile.cc:129
UnitFigure
Definition: UnitFigure.hh:46
EditPart::setFigure
void setFigure(Figure *figure)
EditPolicyFactory::createIUPortEditPolicy
virtual EditPolicy * createIUPortEditPolicy()
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::BaseRegisterFile::width
virtual int width() const
EditPolicyFactory::createIUEditPolicy
virtual EditPolicy * createIUEditPolicy()
EditPartFactory::factories_
std::vector< Factory * > factories_
Registered factories.
Definition: EditPartFactory.hh:60
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50