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

#include <ProDeClipboard.hh>

Collaboration diagram for ProDeClipboard:
Collaboration graph

Public Member Functions

void setContents (ObjectState *contents, const TTAMachine::Machine *sourceMachine)
 
ObjectStatecopyContents ()
 
const TTAMachine::MachinesourceMachine ()
 
bool isEmpty ()
 

Static Public Member Functions

static ProDeClipboardinstance ()
 
static void destroy ()
 

Private Member Functions

 ProDeClipboard ()
 
 ~ProDeClipboard ()
 

Private Attributes

ObjectStatecontents_
 
const TTAMachine::MachinesourceMachine_
 

Static Private Attributes

static ProDeClipboardinstance_ = NULL
 

Detailed Description

A Clipboard class for copying machine components in ProDe.

The clipboard can store one Component. This class is implemented using the 'singleton' design pattern.

Definition at line 47 of file ProDeClipboard.hh.

Constructor & Destructor Documentation

◆ ProDeClipboard()

ProDeClipboard::ProDeClipboard ( )
private

The Constructor.

Definition at line 41 of file ProDeClipboard.cc.

41  : contents_(NULL) {
42 }

Referenced by instance().

◆ ~ProDeClipboard()

ProDeClipboard::~ProDeClipboard ( )
private

The Destructor.

Definition at line 48 of file ProDeClipboard.cc.

48  {
49  if (contents_ != NULL) {
50  delete contents_;
51  contents_ = NULL;
52  }
53 }

References contents_.

Member Function Documentation

◆ copyContents()

ObjectState * ProDeClipboard::copyContents ( )

Returns a copy of the clipboard contents.

Returns
Copy of the cliboard contents.

Definition at line 104 of file ProDeClipboard.cc.

104  {
105 
106  if (contents_ == NULL) {
107  return NULL;
108  }
109 
110  ObjectState* component = new ObjectState(*contents_);
111  return component;
112 }

References contents_.

Referenced by PasteComponentCmd::Do().

◆ destroy()

void ProDeClipboard::destroy ( )
static

Deletes the singleton instance of the clipboard.

Definition at line 74 of file ProDeClipboard.cc.

74  {
75  if (instance_ != NULL) {
76  delete instance_;
77  instance_ = NULL;
78  }
79 }

References instance_.

Referenced by ProDe::OnExit().

◆ instance()

ProDeClipboard * ProDeClipboard::instance ( )
static

Returns the singleton instance of the clipboard.

Returns
Singleton instance of the clipboard.

Definition at line 62 of file ProDeClipboard.cc.

62  {
63  if (instance_ == NULL) {
64  instance_ = new ProDeClipboard();
65  }
66  return instance_;
67 }

References instance_, and ProDeClipboard().

Referenced by CopyComponent::Do(), PasteComponentCmd::Do(), and PasteComponentCmd::isEnabled().

Here is the call graph for this function:

◆ isEmpty()

bool ProDeClipboard::isEmpty ( )

Returns true if the clipboard is empty.

Returns
true, if the clipboard is empty.

Definition at line 121 of file ProDeClipboard.cc.

121  {
122  if (contents_ == NULL) {
123  return true;
124  }
125  return false;
126 }

References contents_.

Referenced by PasteComponentCmd::isEnabled().

◆ setContents()

void ProDeClipboard::setContents ( ObjectState component,
const TTAMachine::Machine sourceMachine 
)

Sets the clipboard contents.

 

Parameters
componentCopied/cut component.

Definition at line 88 of file ProDeClipboard.cc.

89  {
90  if (contents_ != NULL) {
91  delete contents_;
92  }
94  contents_ = component;
95 }

References contents_, sourceMachine(), and sourceMachine_.

Referenced by CopyComponent::Do().

Here is the call graph for this function:

◆ sourceMachine()

const TTAMachine::Machine* ProDeClipboard::sourceMachine ( )
inline

Definition at line 54 of file ProDeClipboard.hh.

54 { return sourceMachine_; }

References sourceMachine_.

Referenced by PasteComponentCmd::Do(), and setContents().

Member Data Documentation

◆ contents_

ObjectState* ProDeClipboard::contents_
private

Definition at line 62 of file ProDeClipboard.hh.

Referenced by copyContents(), isEmpty(), setContents(), and ~ProDeClipboard().

◆ instance_

ProDeClipboard * ProDeClipboard::instance_ = NULL
staticprivate

Definition at line 61 of file ProDeClipboard.hh.

Referenced by destroy(), and instance().

◆ sourceMachine_

const TTAMachine::Machine* ProDeClipboard::sourceMachine_
private

Definition at line 63 of file ProDeClipboard.hh.

Referenced by setContents(), and sourceMachine().


The documentation for this class was generated from the following files:
ProDeClipboard::sourceMachine_
const TTAMachine::Machine * sourceMachine_
Definition: ProDeClipboard.hh:63
ProDeClipboard::ProDeClipboard
ProDeClipboard()
Definition: ProDeClipboard.cc:41
ObjectState
Definition: ObjectState.hh:59
ProDeClipboard::sourceMachine
const TTAMachine::Machine * sourceMachine()
Definition: ProDeClipboard.hh:54
ProDeClipboard::instance_
static ProDeClipboard * instance_
Definition: ProDeClipboard.hh:61
ProDeClipboard::contents_
ObjectState * contents_
Definition: ProDeClipboard.hh:62