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

#include <RFFactory.hh>

Inheritance diagram for RFFactory:
Inheritance graph
Collaboration diagram for RFFactory:
Collaboration graph

Public Member Functions

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

RFFactoryoperator= (RFFactory &old)
 Assignment not allowed. More...
 
 RFFactory (RFFactory &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 register file EditParts corresponding to a given Machine RegisterFile object.

Definition at line 45 of file RFFactory.hh.

Constructor & Destructor Documentation

◆ RFFactory() [1/2]

RFFactory::RFFactory ( EditPolicyFactory editPolicyFactory)

The Constructor.

Definition at line 53 of file RFFactory.cc.

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

References EditPartFactory::registerFactory().

Here is the call graph for this function:

◆ ~RFFactory()

RFFactory::~RFFactory ( )
virtual

The Destructor.

Definition at line 62 of file RFFactory.cc.

62  {
63 }

◆ RFFactory() [2/2]

RFFactory::RFFactory ( RFFactory old)
private

Copying not allowed.

Member Function Documentation

◆ createEditPart()

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

Returns an EditPart corresponding to a register file.

Parameters
componentRegister file of which to create the EditPart.
Returns
NULL if the parameter is not an instance of the RegisterFile class.

Implements Factory.

Definition at line 73 of file RFFactory.cc.

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

References EditPart::addChild(), EditPolicyFactory::createRFEditPolicy(), EditPolicyFactory::createRFPortEditPolicy(), 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=()

RFFactory& RFFactory::operator= ( RFFactory 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
UnboundedRegisterFile
Definition: UnboundedRegisterFile.hh:43
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
EditPolicyFactory::createRFPortEditPolicy
virtual EditPolicy * createRFPortEditPolicy()
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)
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
EditPart::addChild
void addChild(EditPart *child)
Definition: EditPart.cc:260
EditPolicyFactory::createRFEditPolicy
virtual EditPolicy * createRFEditPolicy()
EditPartFactory::editPolicyFactory_
EditPolicyFactory & editPolicyFactory_
Factory which creates edit policies for edit parts.
Definition: EditPartFactory.hh:64
TTAMachine::BaseRegisterFile::width
virtual int width() const
EditPartFactory::factories_
std::vector< Factory * > factories_
Registered factories.
Definition: EditPartFactory.hh:60