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

#include <GCUFactory.hh>

Inheritance diagram for GCUFactory:
Inheritance graph
Collaboration diagram for GCUFactory:
Collaboration graph

Public Member Functions

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

GCUFactoryoperator= (GCUFactory &old)
 Assignment not allowed. More...
 
 GCUFactory (GCUFactory &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 global control unit EditParts corresponding to a given Machine GlobalControlUnit object.

Definition at line 45 of file GCUFactory.hh.

Constructor & Destructor Documentation

◆ GCUFactory() [1/2]

GCUFactory::GCUFactory ( EditPolicyFactory editPolicyFactory)

The Constructor.

Definition at line 54 of file GCUFactory.cc.

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

References EditPartFactory::registerFactory().

Here is the call graph for this function:

◆ ~GCUFactory()

GCUFactory::~GCUFactory ( )
virtual

The Destructor.

Definition at line 62 of file GCUFactory.cc.

62  {
63 }

◆ GCUFactory() [2/2]

GCUFactory::GCUFactory ( GCUFactory old)
private

Copying not allowed.

Member Function Documentation

◆ createEditPart()

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

Returns an EditPart corresponding to a global control unit.

Parameters
componentGlobal control unit of which to create the EditPart.
Returns
NULL if the parameter is not an instance of the ControlUnit class.

Implements Factory.

Definition at line 73 of file GCUFactory.cc.

73  {
74 
75  ControlUnit* gcu = dynamic_cast<ControlUnit*>(component);
76 
77  if (gcu != NULL) {
78  EditPart* gcuEditPart = new EditPart();
79  gcuEditPart->setModel(gcu);
80 
81  UnitFigure* fig = new UnitFigure();
82  wxString name = WxConversion::toWxString(gcu->name());
83  name.Prepend(_T("GCU: "));
84  fig->setName(name);
85  gcuEditPart->setFigure(fig);
86 
87  // Create editparts of operation ports.
88  for (int i = 0; i < gcu->operationPortCount(); i++) {
89  vector<Factory*>::const_iterator iter;
90  for (iter = factories_.begin(); iter != factories_.end(); iter++) {
91  EditPart* portEditPart =
92  (*iter)->createEditPart(gcu->operationPort(i));
93  if (portEditPart != NULL) {
94  EditPolicy* portEditPolicy =
96  if (portEditPolicy != NULL) {
97  portEditPart->installEditPolicy(portEditPolicy);
98  }
99  gcuEditPart->addChild(portEditPart);
100  }
101  }
102  }
103 
104  // Create editparts of special register ports.
105  for (int i = 0; i < gcu->specialRegisterPortCount(); i++) {
106  vector<Factory*>::const_iterator iter;
107  for (iter = factories_.begin(); iter != factories_.end(); iter++) {
108  EditPart* portEditPart =
109  (*iter)->createEditPart(gcu->specialRegisterPort(i));
110  if (portEditPart != NULL) {
111  EditPolicy* portEditPolicy =
113  if (portEditPolicy != NULL) {
114  portEditPart->installEditPolicy(portEditPolicy);
115  }
116  gcuEditPart->addChild(portEditPart);
117  }
118  }
119  }
120 
121  wxString operations = _T("{ ");
122  for (int i = 0; i < gcu->operationCount(); i++) {
123  if (i > 0) {
124  operations.Append(_T(", "));
125  }
126  operations.Append(
128  }
129  operations.Append(_T(" }"));
130 
131  fig->setInfo(operations);
132 
133  gcuEditPart->setSelectable(true);
134 
136  if (editPolicy != NULL) {
137  gcuEditPart->installEditPolicy(editPolicy);
138  }
139 
140  return gcuEditPart;
141 
142  } else {
143  return NULL;
144  }
145 }

References EditPart::addChild(), EditPolicyFactory::createFUPortEditPolicy(), EditPolicyFactory::createGCUEditPolicy(), EditPolicyFactory::createSRPortEditPolicy(), EditPartFactory::editPolicyFactory_, EditPartFactory::factories_, EditPart::installEditPolicy(), TTAMachine::HWOperation::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), EditPart::setFigure(), UnitFigure::setInfo(), EditPart::setModel(), UnitFigure::setName(), EditPart::setSelectable(), TTAMachine::ControlUnit::specialRegisterPort(), TTAMachine::ControlUnit::specialRegisterPortCount(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
EditPolicyFactory::createGCUEditPolicy
virtual EditPolicy * createGCUEditPolicy()
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
EditPolicyFactory::createFUPortEditPolicy
virtual EditPolicy * createFUPortEditPolicy()
EditPartFactory::registerFactory
void registerFactory(Factory *factory)
TTAMachine::HWOperation::name
const std::string & name() const
Definition: HWOperation.cc:141
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
TTAMachine::ControlUnit::specialRegisterPort
SpecialRegisterPort * specialRegisterPort(int index) const
Definition: ControlUnit.cc:211
UnitFigure::setInfo
void setInfo(const wxString &info)
Definition: UnitFigure.cc:323
TTAMachine::ControlUnit::specialRegisterPortCount
int specialRegisterPortCount() const
Definition: ControlUnit.cc:185
EditPolicyFactory::createSRPortEditPolicy
virtual EditPolicy * createSRPortEditPolicy()
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::FunctionUnit::operationPortCount
virtual int operationPortCount() const
Definition: FunctionUnit.cc:182
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
TTAMachine::FunctionUnit::operationPort
virtual FUPort * operationPort(const std::string &name) const
Definition: FunctionUnit.cc:224
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