|
Maat C++ Documentation
|
Public Types | |
| using | snapshot_t = int |
Public Member Functions | |
| FileSystem (OS system) | |
| Create a new filesystem for OS 'system'. | |
| physical_file_t | get_file (const std::string &path, bool follow_symlink=true) |
| Get a file in the file system. More... | |
| physical_file_t | get_file_by_handle (filehandle_t handle) |
| Convenience function to get a physical file by handle. More... | |
| bool | create_file (const std::string &path, bool create_path=false) |
| Create a file specified by its absolute path. Returns 'true' on success and 'false' on failure. More... | |
| bool | delete_file (const std::string &path, bool weak=true) |
| Delete a file Returns 'true' on success and 'false' on failure. More... | |
| bool | file_exists (const std::string &path) |
| Check if a file exists in the filesystem. | |
| bool | create_symlink (const std::string &link, const std::string &pointed_file, bool create_path=false) |
| Create a symbolic link. More... | |
| filehandle_t | new_fa (const std::string &path) |
| Create a new file accessor. More... | |
| FileAccessor & | get_fa_by_handle (filehandle_t handle) |
| Get a file accessor by handle. | |
| void | delete_fa (filehandle_t handle, bool weak=true) |
| Delete a file accessor. More... | |
| bool | create_dir (const std::string &path) |
| Create a directory in the filesystem. Returns 'true' on success, 'false' on failure. | |
| directory_t | get_dir (const std::string &path) |
| Get directory by absolute path. This function doesn't check wheter the dir was deleted or not! | |
| bool | delete_dir (const std::string &path, bool weak=true) |
| Delete a directory. More... | |
| std::string | path_from_fspath (const fspath_t &path) |
| fspath_t | fspath_from_path (const std::string &path) |
| fspath_t | fspath_from_path_relative_to (std::string rel_path, fspath_t path_base) |
| std::string | path_from_relative_path (std::string rel_path, std::string path_base) |
| std::string | pointed_path_from_symlink (std::string symlink_file) |
| bool | is_relative_path (const std::string &path) |
| node_status_t | get_node_status (const std::string &path) |
| std::string | get_stdin_for_pid (int pid) |
| Return the stdin file for process with PID 'pid'. | |
| std::string | get_stdout_for_pid (int pid) |
| Return the stdout file for process with PID 'pid'. | |
| std::string | get_stderr_for_pid (int pid) |
| Return the stderr file for process with PID 'pid'. | |
| snapshot_t | take_snapshot () |
| Take a snapshot of the filesystem. | |
| void | restore_snapshot (snapshot_t snapshot, bool remove=false) |
| Restore a snapshot of the filesystem. | |
| void | restore_last_snapshot (bool remove=false) |
| Restore latests snapshot. | |
Friends | |
| class | EnvEmulator |
| class | LinuxEmulator |
| std::ostream & | operator<< (std::ostream &os, const FileSystem &fs) |
| bool maat::env::FileSystem::create_file | ( | const std::string & | path, |
| bool | create_path = false |
||
| ) |
Create a file specified by its absolute path. Returns 'true' on success and 'false' on failure.
| path | Absolute path of the file |
| create_path | If set to 'true', any missing directories in 'link' will be automatically created |
| bool maat::env::FileSystem::create_symlink | ( | const std::string & | link, |
| const std::string & | pointed_file, | ||
| bool | create_path = false |
||
| ) |
Create a symbolic link.
| link | The absolute path of the symbolic link |
| pointed_file | The file pointed to by the symbolic link |
| create_path | If set to 'true', any missing directories in 'link' will be automatically created |
| bool maat::env::FileSystem::delete_dir | ( | const std::string & | path, |
| bool | weak = true |
||
| ) |
Delete a directory.
| path | Absolute path of the directory |
| weak | If set to 'true', the directory is virtually deleted from the emulated filesystem, but its contents are preserved internally and will be restored if a snapshot rewinds back to before the deletion. If set to 'false' the file object is completely deleted internally |
| void maat::env::FileSystem::delete_fa | ( | filehandle_t | handle, |
| bool | weak = true |
||
| ) |
Delete a file accessor.
| handle | Unique handle of the file accessor to delete |
| weak | If set to 'true', the file accessor is virtually deleted , but its contents are preserved internally and will be restored if a snapshot rewinds back to before the deletion. If set to 'false' the object is completely deleted internally |
| bool maat::env::FileSystem::delete_file | ( | const std::string & | path, |
| bool | weak = true |
||
| ) |
Delete a file Returns 'true' on success and 'false' on failure.
| path | Absolute path of the file |
| weak | If set to 'true', the file is virtually deleted from the emulated filesystem, but its contents are preserved internally and will be restored if a snapshot rewinds back to before the deletion. If set to 'false' the file object is completely deleted internally |
| physical_file_t maat::env::FileSystem::get_file | ( | const std::string & | path, |
| bool | follow_symlink = true |
||
| ) |
Get a file in the file system.
| path | Absolute path of the file |
| follow_symlink | If set to 'true', resolve potential symbolic links to get the actual file |
| physical_file_t maat::env::FileSystem::get_file_by_handle | ( | filehandle_t | handle | ) |
Convenience function to get a physical file by handle.
| handle | The handle of the file |
| filehandle_t maat::env::FileSystem::new_fa | ( | const std::string & | path | ) |
Create a new file accessor.
| path | Absolute path of the file to access |