HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::SimulatorSerializer Class Reference

#include </home/runner/work/hal/hal/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/plugin_netlist_simulator_controller.h>

Inheritance diagram for hal::SimulatorSerializer:
Inheritance graph
Collaboration diagram for hal::SimulatorSerializer:
Collaboration graph

Public Member Functions

 SimulatorSerializer ()
 
std::string serialize (Netlist *netlist, const std::filesystem::path &savedir, bool isAutosave) override
 
void deserialize (Netlist *netlist, const std::filesystem::path &loaddir) override
 
std::vector< std::unique_ptr< NetlistSimulatorController > > restore ()
 
- Public Member Functions inherited from hal::ProjectSerializer
 ProjectSerializer (const std::string &name)
 
virtual ~ProjectSerializer ()
 

Additional Inherited Members

- Protected Attributes inherited from hal::ProjectSerializer
std::string m_name
 

Detailed Description

Stores the simulation controllers of a project so that they can be restored when the project is opened again.

Definition at line 45 of file plugin_netlist_simulator_controller.h.

Constructor & Destructor Documentation

◆ SimulatorSerializer()

hal::SimulatorSerializer::SimulatorSerializer ( )

Definition at line 24 of file plugin_netlist_simulator_controller.cpp.

Member Function Documentation

◆ deserialize()

void hal::SimulatorSerializer::deserialize ( Netlist netlist,
const std::filesystem::path &  loaddir 
)
overridevirtual

Abstract deserialize method to be implemented by derived class. Note that it can be assumed upon calling this method that the deserialization of the netlist has been successful. Caller will provide project directory name but not the filename. The latter one can be queried from ProjectManager.

Parameters
[in]netlistThe netlist already deserialized
[in]loaddirProject directory to load files from

Implements hal::ProjectSerializer.

Definition at line 57 of file plugin_netlist_simulator_controller.cpp.

References hal::NetlistSimulatorControllerMap::clearAll(), QString::fromStdString(), and hal::NetlistSimulatorControllerMap::instance().

◆ restore()

◆ serialize()

std::string hal::SimulatorSerializer::serialize ( Netlist netlist,
const std::filesystem::path &  savedir,
bool  isAutosave 
)
overridevirtual

Abstract serialize method to be implemented by derived class. If there was no need for serialization or serialization failed an empty file name should be returned.

Parameters
[in]netlistThe netlist to be serialized
[in]savedirTarget project directory
[in]isAutosavetrue if serialize call was issued from autosave, false otherwise
Returns
relative name of file name that was used for serialization

Implements hal::ProjectSerializer.

Definition at line 28 of file plugin_netlist_simulator_controller.cpp.

References QDir::absoluteFilePath(), QJsonArray::append(), QJsonDocument::Compact, QString::fromStdString(), hal::ProjectManager::get_project_directory(), hal::ProjectDirectory::get_relative_file_path(), hal::ProjectManager::instance(), hal::NetlistSimulatorControllerMap::instance(), QFile::open(), QString::toStdString(), QIODevice::write(), and QIODevice::WriteOnly.


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