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

#include <OperationImplementationResourceDialog.hh>

Inheritance diagram for OperationImplementationResourceDialog:
Inheritance graph
Collaboration diagram for OperationImplementationResourceDialog:
Collaboration graph

Public Member Functions

 OperationImplementationResourceDialog ()
 
virtual ~OperationImplementationResourceDialog ()=default
 
void onOK (wxCommandEvent &)
 
void onAddVhdlSynFile (wxFileDirPickerEvent &)
 
void onAddVhdlSimFile (wxFileDirPickerEvent &)
 
void onAddVerilogSynFile (wxFileDirPickerEvent &)
 
void onAddVerilogSimFile (wxFileDirPickerEvent &)
 
void onDeleteListItem (wxCommandEvent &)
 

Private Member Functions

std::string sanitize (const wxString &path)
 

Private Attributes

wxListCtrl * fileList1_
 
wxTextCtrl * nameCtrl_
 
wxFilePickerCtrl * ipxactPick_
 

Detailed Description

Definition at line 44 of file OperationImplementationResourceDialog.hh.

Constructor & Destructor Documentation

◆ OperationImplementationResourceDialog()

OperationImplementationResourceDialog::OperationImplementationResourceDialog ( )

◆ ~OperationImplementationResourceDialog()

virtual OperationImplementationResourceDialog::~OperationImplementationResourceDialog ( )
virtualdefault

Member Function Documentation

◆ onAddVerilogSimFile()

void OperationImplementationResourceDialog::onAddVerilogSimFile ( wxFileDirPickerEvent &  e)

Definition at line 251 of file OperationImplementationResourceDialog.cc.

252  {
253  HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
254  int idx = fileList1_->GetItemCount();
255  fileList1_->InsertItem(idx, sanitize(e.GetPath()));
256  fileList1_->SetItem(idx, 1, manager->formatString(
258 }

References fileList1_, HDB::HDBManager::formatString(), sanitize(), and HDB::BlockImplementationFile::Verilogsim.

Here is the call graph for this function:

◆ onAddVerilogSynFile()

void OperationImplementationResourceDialog::onAddVerilogSynFile ( wxFileDirPickerEvent &  e)

Definition at line 241 of file OperationImplementationResourceDialog.cc.

242  {
243  HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
244  int idx = fileList1_->GetItemCount();
245  fileList1_->InsertItem(idx, sanitize(e.GetPath()));
246  fileList1_->SetItem(idx, 1, manager->formatString(
248 }

References fileList1_, HDB::HDBManager::formatString(), sanitize(), and HDB::BlockImplementationFile::Verilog.

Here is the call graph for this function:

◆ onAddVhdlSimFile()

void OperationImplementationResourceDialog::onAddVhdlSimFile ( wxFileDirPickerEvent &  e)

Definition at line 231 of file OperationImplementationResourceDialog.cc.

232  {
233  HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
234  int idx = fileList1_->GetItemCount();
235  fileList1_->InsertItem(idx, sanitize(e.GetPath()));
236  fileList1_->SetItem(idx, 1, manager->formatString(
238 }

References fileList1_, HDB::HDBManager::formatString(), sanitize(), and HDB::BlockImplementationFile::VHDLsim.

Here is the call graph for this function:

◆ onAddVhdlSynFile()

void OperationImplementationResourceDialog::onAddVhdlSynFile ( wxFileDirPickerEvent &  e)

Definition at line 221 of file OperationImplementationResourceDialog.cc.

222  {
223  HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
224  int idx = fileList1_->GetItemCount();
225  fileList1_->InsertItem(idx, sanitize(e.GetPath()));
226  fileList1_->SetItem(idx, 1, manager->formatString(
228 }

References fileList1_, HDB::HDBManager::formatString(), sanitize(), and HDB::BlockImplementationFile::VHDL.

Here is the call graph for this function:

◆ onDeleteListItem()

void OperationImplementationResourceDialog::onDeleteListItem ( wxCommandEvent &  )

Definition at line 261 of file OperationImplementationResourceDialog.cc.

261  {
262  long item = -1;
263 
264  for (;;)
265  {
266  item = fileList1_->GetNextItem(
267  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
268  if (item == -1)
269  break;
270  fileList1_->DeleteItem(item);
271  if (fileList1_->GetItemCount() == 0 ||
272  item == fileList1_->GetItemCount())
273  break;
274  }
275 }

References fileList1_.

◆ onOK()

void OperationImplementationResourceDialog::onOK ( wxCommandEvent &  )

Definition at line 152 of file OperationImplementationResourceDialog.cc.

152  {
154  HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
155 
156  resource.name = nameCtrl_->GetLineText(0);
157  if (resource.name.length() < 1) {
158  wxMessageBox( wxT("Give the resource a name."),
159  wxT("Error"), wxICON_ERROR);
160  return;
161  }
162 
163  long items = fileList1_->GetItemCount();
164  for (int i = 0; i < items; ++i) {
165  std::string file = fileList1_->GetItemText(i, 0).ToStdString();
166  std::string type = fileList1_->GetItemText(i, 1).ToStdString();
167  if (type == manager->formatString(
169  resource.synFiles.emplace_back(file);
170  resource.synFormats.emplace_back(type);
171  } else if (type == manager->formatString(
173  resource.simFiles.emplace_back(file);
174  resource.simFormats.emplace_back(type);
175  }
176  else if (type == manager->formatString(
178  resource.synFiles.emplace_back(file);
179  resource.synFormats.emplace_back(type);
180  }
181  else if (type == manager->formatString(
183  resource.simFiles.emplace_back(file);
184  resource.simFormats.emplace_back(type);
185  } else {
186  wxMessageBox( wxT("Unknown file type."),
187  wxT("Error"), wxICON_ERROR);
188  return;
189  }
190  }
191 
192  resource.ipxact = sanitize(ipxactPick_->GetPath());
193  if (resource.ipxact.length() < 1) {
194  wxMessageBox(wxT("Give the IP-XACT component file."),
195  wxT("Error"), wxICON_ERROR);
196  return;
197  }
198 
199  manager->addOperationImplementationResource(resource);
200  wxGetApp().mainFrame().browser()->update();
201  EndModal(wxID_OK);
202 }

References HDB::HDBManager::addOperationImplementationResource(), fileList1_, HDB::HDBManager::formatString(), HDB::OperationImplementationResource::ipxact, ipxactPick_, HDB::OperationImplementationResource::name, nameCtrl_, sanitize(), HDB::OperationImplementationResource::simFiles, HDB::OperationImplementationResource::simFormats, HDB::OperationImplementationResource::synFiles, HDB::OperationImplementationResource::synFormats, HDB::BlockImplementationFile::Verilog, HDB::BlockImplementationFile::Verilogsim, HDB::BlockImplementationFile::VHDL, and HDB::BlockImplementationFile::VHDLsim.

Here is the call graph for this function:

◆ sanitize()

std::string OperationImplementationResourceDialog::sanitize ( const wxString &  path)
private

Definition at line 205 of file OperationImplementationResourceDialog.cc.

205  {
206  HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
207  std::string es(path);
208  std::string s(manager->fileName());
209  size_t i = s.rfind('/', s.length());
210  if (i != std::string::npos) {
211  s = s.substr(0, i+1);
212  if (es.find(s) == 0) {
213  return es.substr(s.length());
214  }
215  }
216  return es;
217 }

References HDB::HDBManager::fileName().

Referenced by onAddVerilogSimFile(), onAddVerilogSynFile(), onAddVhdlSimFile(), onAddVhdlSynFile(), and onOK().

Here is the call graph for this function:

Member Data Documentation

◆ fileList1_

wxListCtrl* OperationImplementationResourceDialog::fileList1_
private

◆ ipxactPick_

wxFilePickerCtrl* OperationImplementationResourceDialog::ipxactPick_
private

Definition at line 60 of file OperationImplementationResourceDialog.hh.

Referenced by onOK().

◆ nameCtrl_

wxTextCtrl* OperationImplementationResourceDialog::nameCtrl_
private

Definition at line 59 of file OperationImplementationResourceDialog.hh.

Referenced by onOK().


The documentation for this class was generated from the following files:
HDB::HDBManager::formatString
static std::string formatString(BlockImplementationFile::Format format)
Definition: HDBManager.cc:5737
HDB::BlockImplementationFile::VHDL
@ VHDL
VHDL file.
Definition: BlockImplementationFile.hh:48
OperationImplementationResourceDialog::ipxactPick_
wxFilePickerCtrl * ipxactPick_
Definition: OperationImplementationResourceDialog.hh:60
HDB::OperationImplementationResource::ipxact
std::string ipxact
Definition: OperationImplementationResource.hh:42
OperationImplementationResourceDialog::fileList1_
wxListCtrl * fileList1_
Definition: OperationImplementationResourceDialog.hh:58
HDB::OperationImplementationResource::synFiles
std::vector< std::string > synFiles
Definition: OperationImplementationResource.hh:45
HDB::HDBManager::addOperationImplementationResource
void addOperationImplementationResource(const OperationImplementationResource &resource)
Definition: HDBManager.cc:2482
HDB::OperationImplementationResource::simFormats
std::vector< std::string > simFormats
Definition: OperationImplementationResource.hh:44
HDB::OperationImplementationResource::simFiles
std::vector< std::string > simFiles
Definition: OperationImplementationResource.hh:46
HDB::HDBManager
Definition: HDBManager.hh:82
HDB::OperationImplementationResource
Definition: OperationImplementationResource.hh:38
HDB::BlockImplementationFile::Verilog
@ Verilog
Verilog file.
Definition: BlockImplementationFile.hh:49
HDB::HDBManager::fileName
std::string fileName() const
Definition: HDBManager.cc:612
HDB::BlockImplementationFile::Verilogsim
@ Verilogsim
Verilog simulation file.
Definition: BlockImplementationFile.hh:51
HDB::OperationImplementationResource::name
std::string name
Definition: OperationImplementationResource.hh:41
OperationImplementationResourceDialog::nameCtrl_
wxTextCtrl * nameCtrl_
Definition: OperationImplementationResourceDialog.hh:59
OperationImplementationResourceDialog::sanitize
std::string sanitize(const wxString &path)
Definition: OperationImplementationResourceDialog.cc:205
HDB::OperationImplementationResource::synFormats
std::vector< std::string > synFormats
Definition: OperationImplementationResource.hh:43
HDB::BlockImplementationFile::VHDLsim
@ VHDLsim
VHDL simulation file.
Definition: BlockImplementationFile.hh:50