7 py::class_<ProjectManager, RawPtrWrapper<ProjectManager>> py_project_manager(m,
"ProjectManager", R
"(
8 Project manager class that handles opening, closing, and saving of projects.
11 py::enum_<ProjectManager::ProjectStatus> py_project_status(py_project_manager, "ProjectStatus", R
"(
12 Represents the logic value that a Boolean function operates on.
15 py_project_status.value("NONE", ProjectManager::ProjectStatus::NONE, R
"(Represents the default state.)")
16 .value("OPENED", ProjectManager::ProjectStatus::OPENED, R
"(Represents an open project state.)")
17 .value("SAVED", ProjectManager::ProjectStatus::SAVED, R
"(Represents a saved project state.)")
20 py::class_<ProjectDirectory, RawPtrWrapper<ProjectDirectory>> py_project_directory(m, "ProjectDirectory", R
"(
21 Represents a project directory.
24 py_project_directory.def(py::init<const std::string&>(), py::arg("path") = std::string(), R
"(
25 Constructs a ProjectDirectory object.
27 :param str path: Path to the project directory. If empty, an empty path is used.
31 Returns the default file name for the project directory.
33 :param str extension: Extension of the default file name. If empty, '.hal' is assumed.
34 :returns: The absolute path to the default file.
39 Returns the absolute path to a file within the project directory.
41 :param str relative_filename: The relative file name within the project directory.
42 :returns: The absolute path to the file.
47 Returns the file name within the autosave (shadow) directory.
49 :param str extension: Extension of the shadow file name. If empty, '.hal' is assumed.
50 :returns: The absolute path to the shadow file.
55 Returns the path to the autosave (shadow) directory.
57 :returns: The absolute path to the autosave directory.
62 Returns the canonical path to the project directory.
64 :returns: The absolute canonical path to the project directory. If no project path is given, an empty path is returned.
69 Returns the relative file path if the file is within the project directory.
71 :param str filename: The absolute path to the file.
72 :returns: The relative file path if the file is within the project directory; otherwise, the original filename.
77 Generates a random directory name in the current working directory.
79 :returns: The absolute path to the generated directory.
87 Returns the singleton instance which gets constructed upon first call.
89 :returns: The singleton instance.
90 :rtype: hal_py.ProjectManager
98 Returns the current project status.
100 :returns: The project status value.
101 :rtype: hal_py.ProjectManager.ProjectStatus
105 Set the current project status to a new value.
106 Must be called when a project is closed.
108 :param hal_py.ProjectManager.ProjectStatus status: The new project status value.
112 Returns the relative path of the file to be parsed by an external serializer.
114 :param str serializer_name: The unique name of the serializer.
115 :returns: The relative file path.
120 Set the path to the gate library file.
122 :param str gl_path: The path to the gate library file.
126 Serialize the netlist and all dependent data to the project directory.
128 :param hal_py.Netlist netlist: The netlist.
129 :param bool shadow: Set to True if function is called from autosave procedure, False otherwise. Defaults to False.
130 :returns: True if serialization of the netlist was successful, False otherwise.
135 Open the project specified by the provided directory path.
137 :param str path: The path to the project directory. Can be omitted if the path was previously set using `ProjectManager::set_project_directory`.
138 :returns: True on success, False otherwise.
143 Returns project directory.
145 :returns: project directory
146 :rtype: hal_py.ProjectDirectory
150 Set path to the project directory.
152 :param str path: The path to the project directory.
158 Create an empty project directory at the specified location.
159 The project directory must not exist.
161 :param str path: The path to the new project directory.
162 :returns: True on success, False otherwise.
167 Remove the existing project directory and clear the path member variable.
169 :returns: True on success, False otherwise.
174 Returns the path to the netlist file.
176 :returns: The netlist file path.
std::filesystem::path get_filename(const std::string &relative_filename) const
std::filesystem::path get_relative_file_path(const std::string &filename) const
std::filesystem::path get_canonical_path() const
static const std::string s_shadow_dir
static ProjectDirectory generate_random()
std::filesystem::path get_shadow_filename(const std::string &extension=std::string()) const
std::filesystem::path get_default_filename(const std::string &extension=std::string()) const
std::filesystem::path get_shadow_dir() const
static ProjectManager * instance()
void set_project_status(ProjectStatus status)
bool create_project_directory(const std::string &path)
bool serialize_project(Netlist *netlist, bool shadow=false)
void set_gate_library_path(const std::string &gl_path)
std::string get_filename(const std::string &serializer_name)
ProjectStatus get_project_status() const
std::string get_netlist_filename() const
bool open_project(const std::string &path="")
const ProjectDirectory & get_project_directory() const
bool remove_project_directory()
void set_project_directory(const std::string &path)
void project_manager_init(py::module &m)
const Module * module(const Gate *g, const NodeBoxes &boxes)