OpenASIP  2.0
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
EditPartFactory Class Reference

#include <EditPartFactory.hh>

Inheritance diagram for EditPartFactory:
Inheritance graph
Collaboration diagram for EditPartFactory:
Collaboration graph

Public Member Functions

virtual ~EditPartFactory ()
 
void registerFactory (Factory *factory)
 
- Public Member Functions inherited from Factory
virtual ~Factory ()
 
virtual EditPartcreateEditPart (TTAMachine::MachinePart *component)=0
 Returns an EditPart that corresponds to a Machine component. More...
 

Protected Member Functions

 EditPartFactory (EditPolicyFactory &editPolicyFactory)
 
EditPartcheckCache (const TTAMachine::MachinePart *component) const
 
void writeToCache (EditPart *editPart)
 
- Protected Member Functions inherited from Factory
 Factory ()
 

Protected Attributes

std::vector< Factory * > factories_
 Registered factories. More...
 
EditPolicyFactoryeditPolicyFactory_
 Factory which creates edit policies for edit parts. More...
 

Static Protected Attributes

static std::vector< EditPart * > created_
 Container for already created EditParts. More...
 

Private Member Functions

EditPartFactoryoperator= (EditPartFactory &old)
 Assignment not allowed. More...
 
 EditPartFactory (EditPartFactory &old)
 Copying not allowed. More...
 

Detailed Description

Abstract base class for EditPart factories that create appropriate EditParts from Machine components.

Definition at line 48 of file EditPartFactory.hh.

Constructor & Destructor Documentation

◆ ~EditPartFactory()

EditPartFactory::~EditPartFactory ( )
virtual

The Destructor.

Definition at line 57 of file EditPartFactory.cc.

57  {
58  // erase data of already created EditParts
59  created_.clear();
61 }

References created_, SequenceTools::deleteAllItems(), and factories_.

Here is the call graph for this function:

◆ EditPartFactory() [1/2]

EditPartFactory::EditPartFactory ( EditPolicyFactory editPolicyFactory)
protected

The Constructor.

Definition at line 49 of file EditPartFactory.cc.

49  :
50  Factory(),
51  editPolicyFactory_(editPolicyFactory) {
52 }

◆ EditPartFactory() [2/2]

EditPartFactory::EditPartFactory ( EditPartFactory old)
private

Copying not allowed.

Member Function Documentation

◆ checkCache()

EditPart * EditPartFactory::checkCache ( const TTAMachine::MachinePart component) const
protected

Checks if an EditPart of the given component has already been created and returns it.

Parameters
componentA machine component to check.
Returns
An EditPart of the given machine component if such has already been created, NULL otherwise.

Definition at line 72 of file EditPartFactory.cc.

72  {
73  // check if an EditPart has already been created of the component
74  vector<EditPart*>::const_iterator i = created_.begin();
75  for (; i != created_.end(); i++) {
76  if ((*i)->model() == component) {
77  return *i;
78  }
79  }
80  return NULL;
81 }

References created_.

Referenced by BusFactory::createEditPart(), SocketFactory::createEditPart(), and MachineEditPartFactory::createEditPart().

◆ operator=()

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

Assignment not allowed.

◆ registerFactory()

void EditPartFactory::registerFactory ( Factory factory)

◆ writeToCache()

void EditPartFactory::writeToCache ( EditPart editPart)
protected

Inserts an EditPart to the EditPart cache.

Parameters
editPartThe EditPart to insert.

Definition at line 89 of file EditPartFactory.cc.

89  {
90  created_.push_back(editPart);
91 }

References created_.

Referenced by BusFactory::createEditPart(), SocketFactory::createEditPart(), and MachineEditPartFactory::createEditPart().

Member Data Documentation

◆ created_

vector< EditPart * > EditPartFactory::created_
staticprotected

Container for already created EditParts.

Definition at line 62 of file EditPartFactory.hh.

Referenced by checkCache(), writeToCache(), and ~EditPartFactory().

◆ editPolicyFactory_

EditPolicyFactory& EditPartFactory::editPolicyFactory_
protected

◆ factories_

std::vector<Factory*> EditPartFactory::factories_
protected

The documentation for this class was generated from the following files:
Factory::Factory
Factory()
Definition: Factory.cc:41
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
EditPartFactory::created_
static std::vector< EditPart * > created_
Container for already created EditParts.
Definition: EditPartFactory.hh:62
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