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

#include <SocketFactory.hh>

Inheritance diagram for SocketFactory:
Inheritance graph
Collaboration diagram for SocketFactory:
Collaboration graph

Public Member Functions

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

SocketFactoryoperator= (SocketFactory &old)
 Assignment not allowed. More...
 
 SocketFactory (SocketFactory &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 socket EditParts corresponding to a given Machine Socket object.

Definition at line 47 of file SocketFactory.hh.

Constructor & Destructor Documentation

◆ SocketFactory() [1/2]

SocketFactory::SocketFactory ( EditPolicyFactory editPolicyFactory)

The Constructor.

Definition at line 49 of file SocketFactory.cc.

49  :
50  EditPartFactory(editPolicyFactory) {
51 }

◆ ~SocketFactory()

SocketFactory::~SocketFactory ( )
virtual

The Destructor.

Definition at line 56 of file SocketFactory.cc.

56  {
57 }

◆ SocketFactory() [2/2]

SocketFactory::SocketFactory ( SocketFactory old)
private

Copying not allowed.

Member Function Documentation

◆ createEditPart()

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

Returns an EditPart corresponding to a socket.

Parameters
componentSocket of which to create the EditPart.
Returns
NULL if the parameter is not an instance of the Socket class.

Implements Factory.

Definition at line 66 of file SocketFactory.cc.

66  {
67 
68  EditPart* socketEditPart = EditPartFactory::checkCache(component);
69 
70  if (socketEditPart != NULL) {
71  return socketEditPart;
72  }
73 
74  Socket* socket = dynamic_cast<Socket*>(component);
75 
76  if (socket != NULL) {
77 
78  socketEditPart = new EditPart();
79  socketEditPart->setModel(socket);
80 
81  Figure* fig = NULL;
82 
83  if (socket->direction() == Socket::INPUT) {
84  fig = new InputSocketFigure();
85  } else if (socket->direction() == Socket::OUTPUT) {
86  fig = new OutputSocketFigure();
87  } else {
88  fig = new UnknownSocketFigure();
89  }
90  socketEditPart->setFigure(fig);
91 
92  socketEditPart->setSelectable(true);
93 
95  if (editPolicy != NULL) {
96  socketEditPart->installEditPolicy(editPolicy);
97  }
98 
99  EditPartFactory::writeToCache(socketEditPart);
100  return socketEditPart;
101 
102  } else {
103  return NULL;
104  }
105 }

References EditPartFactory::checkCache(), EditPolicyFactory::createSocketEditPolicy(), TTAMachine::Socket::direction(), EditPartFactory::editPolicyFactory_, EditPart::installEditPolicy(), EditPart::setFigure(), EditPart::setModel(), EditPart::setSelectable(), and EditPartFactory::writeToCache().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


The documentation for this class was generated from the following files:
EditPart::setSelectable
void setSelectable(bool selectable)
EditPartFactory::checkCache
EditPart * checkCache(const TTAMachine::MachinePart *component) const
Definition: EditPartFactory.cc:72
EditPart::installEditPolicy
void installEditPolicy(EditPolicy *editpolicy)
Definition: EditPart.cc:247
TTAMachine::Socket::direction
Direction direction() const
EditPolicyFactory::createSocketEditPolicy
virtual EditPolicy * createSocketEditPolicy()
OutputSocketFigure
Definition: OutputSocketFigure.hh:46
UnknownSocketFigure
Definition: UnknownSocketFigure.hh:46
EditPartFactory::writeToCache
void writeToCache(EditPart *editPart)
Definition: EditPartFactory.cc:89
Figure
Definition: Figure.hh:50
EditPart::setModel
void setModel(TTAMachine::MachinePart *model)
TTAMachine::Socket
Definition: Socket.hh:53
EditPartFactory::EditPartFactory
EditPartFactory(EditPolicyFactory &editPolicyFactory)
Definition: EditPartFactory.cc:49
EditPolicy
Definition: EditPolicy.hh:47
EditPart
Definition: EditPart.hh:60
InputSocketFigure
Definition: InputSocketFigure.hh:46
EditPart::setFigure
void setFigure(Figure *figure)
EditPartFactory::editPolicyFactory_
EditPolicyFactory & editPolicyFactory_
Factory which creates edit policies for edit parts.
Definition: EditPartFactory.hh:64