Mercurial > hg > Papers > 2024 > matac-master
changeset 27:f4b076177b9a
...
author | matac42 <matac@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 16 Jan 2024 19:31:10 +0900 |
parents | 905910e9fb04 |
children | 4b5c140233f3 |
files | Paper/master_paper.lol Paper/master_paper.pdf Paper/master_paper.tex Paper/src/RedBlackTreeImpl.cbc Paper/src/Tree.h |
diffstat | 5 files changed, 49 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Paper/master_paper.lol Tue Jan 16 17:17:25 2024 +0900 +++ b/Paper/master_paper.lol Tue Jan 16 19:31:10 2024 +0900 @@ -2,5 +2,7 @@ \contentsline {lstlisting}{\numberline {3.1}Queueのインターフェース}{12}{}% \contentsline {lstlisting}{\numberline {3.2}Interfaceの呼び出し}{13}{}% \contentsline {lstlisting}{\numberline {3.3}Queueのインターフェース}{13}{}% +\contentsline {lstlisting}{\numberline {3.4}RedBlackTreeの実装}{15}{}% +\contentsline {lstlisting}{\numberline {3.5}Treeの仕様}{15}{}% \contentsline {lstlisting}{\numberline {6.1}CopyRedBlackTreeの実装}{25}{}% \contentsline {lstlisting}{\numberline {6.2}CopyRedBlackTreeのアルゴリズム}{27}{}%
--- a/Paper/master_paper.tex Tue Jan 16 17:17:25 2024 +0900 +++ b/Paper/master_paper.tex Tue Jan 16 19:31:10 2024 +0900 @@ -346,6 +346,16 @@ \section{GearsOSのRedBlackTree} +RedBlackTreeはGearsFileSystemで用いられる重要な構造の1つであり, +ディレクトリ構造を表現するために使用されている. +GearsOSにおけるRedBlackTreeの実装の記述の一部をソースコード\ref{src:RedBlackTreeImpl.cbc}, +Treeの仕様記述をソースコード\ref{src:Tree.h}に示す. + +\lstinputlisting[label=src:RedBlackTreeImpl.cbc, caption=RedBlackTreeの実装]{src/RedBlackTreeImpl.cbc} +\lstinputlisting[label=src:Tree.h, caption=Treeの仕様]{src/Tree.h} + +4行目からRedBlackTreeはTreeの仕様の実装であることがわかる. + \chapter{GearsOSのファイルシステム} \section{DataGearManagerによる分散ファイルシステム} \section{i-nodeを用いたファイルシステム}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/src/RedBlackTreeImpl.cbc Tue Jan 16 19:31:10 2024 +0900 @@ -0,0 +1,24 @@ +#include <stdio.h> + +#include "../context.h" +#impl "Tree.h" as "RedBlackTree.h" +#interface "Stack.h" + +extern enum Relational compare(struct Node* node1, struct Node* node2); + +Tree* createRedBlackTree(struct Context* context) { + struct Tree* tree = new Tree(); + struct RedBlackTree* redBlackTree = new RedBlackTree(); + + tree->tree = (union Data*)redBlackTree; + tree->put = C_putRedBlackTree; + tree->get = C_getRedBlackTree; + tree->remove = C_removeRedBlackTree; + // tree->clear = C_clearRedBlackTree; + + redBlackTree->root = NULL; + redBlackTree->nodeStack = createSingleLinkedStack(context); + return tree; +} + +// ~~省略~~
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/src/Tree.h Tue Jan 16 19:31:10 2024 +0900 @@ -0,0 +1,13 @@ +typedef struct Tree<> { + /* future Code */ + /* Type* tree; */ + /* Type* node; */ + union Data* tree; + struct Node* node; + __code put(Impl* tree, Type* node, __code next(...)); + __code get(Impl* tree, Type* node, __code next(...)); + __code remove(Impl* tree, Type* node, __code next(...)); + __code copy(Impl* tree, Type* node, __code next(...)); + // __code clearRedBlackTree(); + __code next(...); +} Tree; \ No newline at end of file