From 8d6a6e2db204dcc7ad10bb96cef604f7f75583be Mon Sep 17 00:00:00 2001 From: IlyaShurupov Date: Mon, 25 Mar 2024 20:26:18 +0300 Subject: [PATCH] initial commit --- .gitignore | 2 ++ CMakeLists.txt | 8 ++++++++ FileSystemEmulator.cpp | 2 ++ FileSystemEmulator.hpp | 22 ++++++++++++++++++++++ Tests.cpp | 3 +++ 5 files changed, 37 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 FileSystemEmulator.cpp create mode 100644 FileSystemEmulator.hpp create mode 100644 Tests.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bddc66e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +*build* diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1335f50 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +project(FileSystemEmulator) + +add_library(${PROJECT_NAME} STATIC FileSystemEmulator.cpp FileSystemEmulator.hpp) +target_include_directories(${PROJECT_NAME} PUBLIC .) + +add_executable(Test${PROJECT_NAME} Tests.cpp) +target_link_libraries(Test${PROJECT_NAME} ${PROJECT_NAME}) +add_test(NAME Test${PROJECT_NAME} COMMAND Test${PROJECT_NAME}) \ No newline at end of file diff --git a/FileSystemEmulator.cpp b/FileSystemEmulator.cpp new file mode 100644 index 0000000..dde3022 --- /dev/null +++ b/FileSystemEmulator.cpp @@ -0,0 +1,2 @@ + +static void f() {} \ No newline at end of file diff --git a/FileSystemEmulator.hpp b/FileSystemEmulator.hpp new file mode 100644 index 0000000..70e9482 --- /dev/null +++ b/FileSystemEmulator.hpp @@ -0,0 +1,22 @@ +#pragma once + +// use tree for leafs in the node +// use 8byte + 3byte for the name og the node, also key in the tree +// don't store size in the tree +// better use RB tree + +// each node type has different size +// implement node using virtual functions and inheritance +// only directory node has leafs (tree) + +// make two classes - emulator and interpreter +// emulator stores only lower case names + +// store number of incoming hard links in the node cache to ensure no hard-linked nodes can be removed + + +// convert command to lowercase then use full path as the key and update key pointer when descending to the leafs + +// each node has parent pointer to check for current directory + +// base node class has all the cache data. use it directly in the tree \ No newline at end of file diff --git a/Tests.cpp b/Tests.cpp new file mode 100644 index 0000000..6953216 --- /dev/null +++ b/Tests.cpp @@ -0,0 +1,3 @@ +#include "FileSystemEmulator.hpp" + +int main() { return 0; } \ No newline at end of file