Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
ElementDataObject Class Reference

Class to store the elements in the clipboard. More...

#include <ElementDataObject.h>

Inheritance diagram for ElementDataObject:
Collaboration diagram for ElementDataObject:

Public Member Functions

 ElementDataObject (std::vector< Element * > elementList)
 
size_t GetDataSize () const override
 
bool GetDataHere (void *buf) const override
 
bool SetData (size_t len, const void *buf) override
 
ElementsListsGetElementsLists ()
 

Protected Attributes

ElementsListsm_elementsLists = nullptr
 

Detailed Description

Class to store the elements in the clipboard.

Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
Date
06/10/2017

Definition at line 36 of file ElementDataObject.h.

Constructor & Destructor Documentation

◆ ElementDataObject() [1/2]

ElementDataObject::ElementDataObject ( )

Definition at line 20 of file ElementDataObject.cpp.

20 : wxDataObjectSimple(wxDataFormat(wxT("PSPCopy")))
21{
22 m_elementsLists = new ElementsLists();
23}

◆ ElementDataObject() [2/2]

ElementDataObject::ElementDataObject ( std::vector< Element * >  elementList)

Definition at line 25 of file ElementDataObject.cpp.

25 : wxDataObjectSimple(wxDataFormat(wxT("PSPCopy")))
26{
27 m_elementsLists = new ElementsLists();
28 if(elementList.size() > 0) {
29 // Separate buses (parents) from the rest of the elements (childs).
30 for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
31 Element* copy = (*it)->GetCopy();
32 if(copy) {
33 if(Bus* bus = dynamic_cast<Bus*>(copy))
34 m_elementsLists->parentList.push_back(bus);
35 else
36 m_elementsLists->elementList.push_back(copy);
37 }
38 }
39 }
40}
Node for power elements. All others power elements are connected through this.
Definition Bus.h:86
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:112
virtual Element * GetCopy()
Get a the element copy.
Definition Element.h:261

◆ ~ElementDataObject()

ElementDataObject::~ElementDataObject ( )

Definition at line 42 of file ElementDataObject.cpp.

42{}

Member Function Documentation

◆ GetDataHere()

bool ElementDataObject::GetDataHere ( void *  buf) const
override

Definition at line 49 of file ElementDataObject.cpp.

50{
51 *(ElementsLists**)buf = m_elementsLists;
52 //buf = m_elementsLists;
53 return true;
54}

◆ GetDataSize()

size_t ElementDataObject::GetDataSize ( ) const
override

Definition at line 43 of file ElementDataObject.cpp.

44{
45 return sizeof(void*);
46 //return sizeof(*this);
47}

◆ GetElementsLists()

ElementsLists * ElementDataObject::GetElementsLists ( )
inline

Definition at line 47 of file ElementDataObject.h.

47{ return m_elementsLists; }

◆ SetData()

bool ElementDataObject::SetData ( size_t  len,
const void *  buf 
)
override

Definition at line 56 of file ElementDataObject.cpp.

57{
58 m_elementsLists = *(ElementsLists**)buf;
59 //m_elementsLists = const_cast<ElementsLists*>(static_cast<const ElementsLists*>(buf));
60 return true;
61}

Member Data Documentation

◆ m_elementsLists

ElementsLists* ElementDataObject::m_elementsLists = nullptr
protected

Definition at line 49 of file ElementDataObject.h.


The documentation for this class was generated from the following files: