aboutsummaryrefslogtreecommitdiffstats
path: root/doc/latex/classmeow_1_1Self.tex
diff options
context:
space:
mode:
authorcathook <b01902109@csie.ntu.edu.tw>2014-06-01 13:56:57 +0800
committercathook <b01902109@csie.ntu.edu.tw>2014-06-01 13:56:57 +0800
commitd5052f1c296dddf51b3e83d59bf3e3c1952cb2d0 (patch)
tree16f7920c5079e0aefcf9509d2dbab59c464d42bd /doc/latex/classmeow_1_1Self.tex
parentbd58f63900410ec4764031f2e6de2d75e91434b3 (diff)
downloadmeow-d5052f1c296dddf51b3e83d59bf3e3c1952cb2d0.tar
meow-d5052f1c296dddf51b3e83d59bf3e3c1952cb2d0.tar.gz
meow-d5052f1c296dddf51b3e83d59bf3e3c1952cb2d0.tar.bz2
meow-d5052f1c296dddf51b3e83d59bf3e3c1952cb2d0.tar.lz
meow-d5052f1c296dddf51b3e83d59bf3e3c1952cb2d0.tar.xz
meow-d5052f1c296dddf51b3e83d59bf3e3c1952cb2d0.tar.zst
meow-d5052f1c296dddf51b3e83d59bf3e3c1952cb2d0.zip
big chnage
Diffstat (limited to 'doc/latex/classmeow_1_1Self.tex')
-rw-r--r--doc/latex/classmeow_1_1Self.tex302
1 files changed, 302 insertions, 0 deletions
diff --git a/doc/latex/classmeow_1_1Self.tex b/doc/latex/classmeow_1_1Self.tex
new file mode 100644
index 0000000..8ac76bc
--- /dev/null
+++ b/doc/latex/classmeow_1_1Self.tex
@@ -0,0 +1,302 @@
+\hypertarget{classmeow_1_1Self}{\section{meow\-:\-:Self$<$ Data $>$ Class Template Reference}
+\label{classmeow_1_1Self}\index{meow\-::\-Self$<$ Data $>$@{meow\-::\-Self$<$ Data $>$}}
+}
+
+
+具有copy on write, 且擁有比\-C++更靈活的reference機制
+
+
+
+
+{\ttfamily \#include \char`\"{}Self.\-h\char`\"{}}
+
+\subsection*{Public Member Functions}
+\begin{DoxyCompactItemize}
+\item
+\hyperlink{classmeow_1_1Self_a0db7c98f250aeee3b06a49ebe0f16937}{Self} (bool create\-\_\-body)
+\begin{DoxyCompactList}\small\item\em constructor \end{DoxyCompactList}\item
+\hyperlink{classmeow_1_1Self_a000ede7e217c31401cc0a4b1c6749ee5}{Self} (\hyperlink{classmeow_1_1Self}{Self} const \&b)
+\begin{DoxyCompactList}\small\item\em 不允許copy constructor \end{DoxyCompactList}\item
+\hyperlink{classmeow_1_1Self_ada16564a03665b10810a6342d61044bc}{$\sim$\-Self} ()
+\begin{DoxyCompactList}\small\item\em 解構子 \end{DoxyCompactList}\item
+Data const $\ast$ \hyperlink{classmeow_1_1Self_a6063551c3e6ac647500e938ade8fbc99}{operator-\/$>$} () const
+\begin{DoxyCompactList}\small\item\em 回傳指向 Data const 的指標 \end{DoxyCompactList}\item
+Data $\ast$ \hyperlink{classmeow_1_1Self_ace312355261c68ac7531767939f5c4c2}{operator-\/$>$} ()
+\begin{DoxyCompactList}\small\item\em 回傳指向 Data 的指標, 如有需要, 這邊會做資料的duplicate \end{DoxyCompactList}\item
+\hyperlink{classmeow_1_1Self}{Self} \& \hyperlink{classmeow_1_1Self_a5962339e9ee49312ab770f1119256ca6}{operator()} () const
+\begin{DoxyCompactList}\small\item\em 回傳非const型態的自己 \end{DoxyCompactList}\item
+void \hyperlink{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}{copy\-From} (\hyperlink{classmeow_1_1Self}{Self} const \&s)
+\begin{DoxyCompactList}\small\item\em 將給定的 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} 的資料複製到自己這裡 \end{DoxyCompactList}\item
+void \hyperlink{classmeow_1_1Self_a576e99ba0ba6e8263b4d2cfd9238440f}{reference\-From} (\hyperlink{classmeow_1_1Self}{Self} const \&s)
+\begin{DoxyCompactList}\small\item\em 將自己reference 到給定的 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} \end{DoxyCompactList}\item
+bool \hyperlink{classmeow_1_1Self_ab3671e44693b79e2f987f59652d46ca9}{same} (\hyperlink{classmeow_1_1Self}{Self} const \&s) const
+\begin{DoxyCompactList}\small\item\em 比對兩個 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} 是否指向同一個reference \end{DoxyCompactList}\item
+bool \hyperlink{classmeow_1_1Self_a91098e2218c358470e81d64f35d6491d}{equal} (\hyperlink{classmeow_1_1Self}{Self} const \&s) const
+\begin{DoxyCompactList}\small\item\em 比對兩個 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} 的內容是否一樣 \end{DoxyCompactList}\item
+bool \hyperlink{classmeow_1_1Self_a10f22a83c3afcf65f8f9680f2a2f945c}{reference\-Less} (\hyperlink{classmeow_1_1Self}{Self} const \&s) const
+\begin{DoxyCompactList}\small\item\em 以reference作為判斷依據的小於判斷 \end{DoxyCompactList}\item
+void \hyperlink{classmeow_1_1Self_af3277e1109c59e5f81549889b344a675}{operator=} (\hyperlink{classmeow_1_1Self}{Self} const \&a)
+\begin{DoxyCompactList}\small\item\em 將 {\ttfamily operator=} 給disable掉 \end{DoxyCompactList}\end{DoxyCompactItemize}
+
+
+\subsection{Detailed Description}
+\subsubsection*{template$<$class Data$>$class meow\-::\-Self$<$ Data $>$}
+
+具有copy on write, 且擁有比\-C++更靈活的reference機制
+
+使用上就是把所有成員變數包到一個class/structure裡, 送給\-Self \par
+ 例如以下
+\begin{DoxyCode}
+\textcolor{keyword}{class }A \{
+\textcolor{keyword}{private}:
+ \textcolor{keyword}{struct }Myself \{
+ \textcolor{keywordtype}{int} data;
+ Myself()\{
+ data = 0;
+ \}
+ ~Myself() \{
+ \}
+ Myself \hyperlink{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}{copyFrom}(Myself \textcolor{keyword}{const}& ms)\textcolor{keyword}{ const }\{
+ data = ms.data;
+ \}
+ \};
+ Self<Myself> \textcolor{keyword}{const} \textcolor{keyword}{self};
+\textcolor{keyword}{public}:
+ A(): self(true) \{ \textcolor{comment}{// self(true) 表示要建立實體, 即struct Myself}
+ \}
+ A(A \textcolor{keyword}{const}& a): self(false) \{ \textcolor{comment}{// for std::swap}
+ \hyperlink{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}{copyFrom}(a);
+ \}
+ \textcolor{comment}{// A(A const& a); // disable 模糊用法, 與上者二選一}
+ A(A \textcolor{keyword}{const}& a, \textcolor{keywordtype}{bool} reference): self(false) \{
+ \textcolor{keywordflow}{if} (reference) \{
+ \hyperlink{classmeow_1_1Self_a576e99ba0ba6e8263b4d2cfd9238440f}{referenceFrom}(a);
+ \} \textcolor{keywordflow}{else} \{
+ \hyperlink{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}{copyFrom}(a);
+ \}
+ \}
+ ~A() \{
+ \}
+ \textcolor{keywordtype}{void} setMemeber(\textcolor{keywordtype}{int} k) \{
+ \textcolor{keyword}{self}()->data = k; \textcolor{comment}{// self()->?? 可以有write權限}
+ \}
+ \textcolor{keywordtype}{int} getMemember(\textcolor{keywordtype}{int} wh)\textcolor{keyword}{ const }\{
+ \textcolor{keywordflow}{return} \textcolor{keyword}{self}->data; \textcolor{comment}{// self->?? 只有const}
+ \}
+ A \hyperlink{classmeow_1_1Self_a576e99ba0ba6e8263b4d2cfd9238440f}{referenceFrom}(A \textcolor{keyword}{const}& a) \{
+ \textcolor{keyword}{self}.referenceFrom(a.self);
+ \}
+ A \hyperlink{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}{copyFrom}(A \textcolor{keyword}{const}& a) \{
+ \textcolor{keyword}{self}.copyFrom(a.self);
+ \}
+ A& \hyperlink{classmeow_1_1Self_af3277e1109c59e5f81549889b344a675}{operator=}(A \textcolor{keyword}{const}& b) \{ \textcolor{comment}{// for std::swap}
+ \hyperlink{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}{copyFrom}(b);
+ \}
+ A& \hyperlink{classmeow_1_1Self_af3277e1109c59e5f81549889b344a675}{operator=}(A \textcolor{keyword}{const}& b); \textcolor{comment}{// 避免諢亂用法}
+\};
+\end{DoxyCode}
+
+
+\begin{DoxyAuthor}{Author}
+cathook
+\end{DoxyAuthor}
+\begin{DoxyWarning}{Warning}
+{\ttfamily \hyperlink{classmeow_1_1Self}{Self}} 這個class會把{\ttfamily operator=} 給disable掉, 所以使用它當 kernel的class預設的 {\ttfamily operator=} 都會無法使用
+\end{DoxyWarning}
+
+
+\subsection{Constructor \& Destructor Documentation}
+\hypertarget{classmeow_1_1Self_a0db7c98f250aeee3b06a49ebe0f16937}{\index{meow\-::\-Self@{meow\-::\-Self}!Self@{Self}}
+\index{Self@{Self}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{Self}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ {\bf meow\-::\-Self}$<$ Data $>$\-::{\bf Self} (
+\begin{DoxyParamCaption}
+\item[{bool}]{create\-\_\-body}
+\end{DoxyParamCaption}
+)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_a0db7c98f250aeee3b06a49ebe0f16937}
+
+
+constructor
+
+
+\begin{DoxyParams}[1]{Parameters}
+\mbox{\tt in} & {\em create\-\_\-body} & 是否要new一個實體資料 (如果constructor完, 馬上就要 {\ttfamily \hyperlink{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}{copy\-From()}} , 或是 {\ttfamily \hyperlink{classmeow_1_1Self_a576e99ba0ba6e8263b4d2cfd9238440f}{reference\-From()}} 的話 不太需要 new一個實體, 否則基本上都要 \\
+\hline
+\end{DoxyParams}
+\hypertarget{classmeow_1_1Self_a000ede7e217c31401cc0a4b1c6749ee5}{\index{meow\-::\-Self@{meow\-::\-Self}!Self@{Self}}
+\index{Self@{Self}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{Self}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ {\bf meow\-::\-Self}$<$ Data $>$\-::{\bf Self} (
+\begin{DoxyParamCaption}
+\item[{{\bf Self}$<$ Data $>$ const \&}]{b}
+\end{DoxyParamCaption}
+)}}\label{classmeow_1_1Self_a000ede7e217c31401cc0a4b1c6749ee5}
+
+
+不允許copy constructor
+
+\hypertarget{classmeow_1_1Self_ada16564a03665b10810a6342d61044bc}{\index{meow\-::\-Self@{meow\-::\-Self}!$\sim$\-Self@{$\sim$\-Self}}
+\index{$\sim$\-Self@{$\sim$\-Self}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{$\sim$\-Self}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ {\bf meow\-::\-Self}$<$ Data $>$\-::$\sim${\bf Self} (
+\begin{DoxyParamCaption}
+{}
+\end{DoxyParamCaption}
+)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_ada16564a03665b10810a6342d61044bc}
+
+
+解構子
+
+
+
+\subsection{Member Function Documentation}
+\hypertarget{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}{\index{meow\-::\-Self@{meow\-::\-Self}!copy\-From@{copy\-From}}
+\index{copy\-From@{copy\-From}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{copy\-From}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ void {\bf meow\-::\-Self}$<$ Data $>$\-::copy\-From (
+\begin{DoxyParamCaption}
+\item[{{\bf Self}$<$ Data $>$ const \&}]{s}
+\end{DoxyParamCaption}
+)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_a7ae7da730705bf2330a259308e5a6828}
+
+
+將給定的 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} 的資料複製到自己這裡
+
+
+\begin{DoxyParams}[1]{Parameters}
+\mbox{\tt in} & {\em s} & 給定的{\ttfamily \hyperlink{classmeow_1_1Self}{Self}} \\
+\hline
+\end{DoxyParams}
+\begin{DoxyReturn}{Returns}
+無
+\end{DoxyReturn}
+\begin{DoxyNote}{Note}
+與reference的差別是, copy之後若該給定的 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} 有資料修改, this 這邊 {\bfseries 不會} 被改到
+\end{DoxyNote}
+\hypertarget{classmeow_1_1Self_a91098e2218c358470e81d64f35d6491d}{\index{meow\-::\-Self@{meow\-::\-Self}!equal@{equal}}
+\index{equal@{equal}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{equal}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ bool {\bf meow\-::\-Self}$<$ Data $>$\-::equal (
+\begin{DoxyParamCaption}
+\item[{{\bf Self}$<$ Data $>$ const \&}]{s}
+\end{DoxyParamCaption}
+) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_a91098e2218c358470e81d64f35d6491d}
+
+
+比對兩個 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} 的內容是否一樣
+
+
+\begin{DoxyParams}[1]{Parameters}
+\mbox{\tt in} & {\em s} & 另一個 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} \\
+\hline
+\end{DoxyParams}
+\begin{DoxyReturn}{Returns}
+{\ttfamily true/false} 表示兩個內容是否一樣
+\end{DoxyReturn}
+\begin{DoxyNote}{Note}
+需要用到 Data的equal()
+\end{DoxyNote}
+\hypertarget{classmeow_1_1Self_a5962339e9ee49312ab770f1119256ca6}{\index{meow\-::\-Self@{meow\-::\-Self}!operator()@{operator()}}
+\index{operator()@{operator()}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{operator()}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ {\bf Self}\& {\bf meow\-::\-Self}$<$ Data $>$\-::operator() (
+\begin{DoxyParamCaption}
+{}
+\end{DoxyParamCaption}
+) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_a5962339e9ee49312ab770f1119256ca6}
+
+
+回傳非const型態的自己
+
+\hypertarget{classmeow_1_1Self_a6063551c3e6ac647500e938ade8fbc99}{\index{meow\-::\-Self@{meow\-::\-Self}!operator-\/$>$@{operator-\/$>$}}
+\index{operator-\/$>$@{operator-\/$>$}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{operator-\/$>$}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ Data const$\ast$ {\bf meow\-::\-Self}$<$ Data $>$\-::operator-\/$>$ (
+\begin{DoxyParamCaption}
+{}
+\end{DoxyParamCaption}
+) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_a6063551c3e6ac647500e938ade8fbc99}
+
+
+回傳指向 Data const 的指標
+
+\hypertarget{classmeow_1_1Self_ace312355261c68ac7531767939f5c4c2}{\index{meow\-::\-Self@{meow\-::\-Self}!operator-\/$>$@{operator-\/$>$}}
+\index{operator-\/$>$@{operator-\/$>$}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{operator-\/$>$}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ Data$\ast$ {\bf meow\-::\-Self}$<$ Data $>$\-::operator-\/$>$ (
+\begin{DoxyParamCaption}
+{}
+\end{DoxyParamCaption}
+)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_ace312355261c68ac7531767939f5c4c2}
+
+
+回傳指向 Data 的指標, 如有需要, 這邊會做資料的duplicate
+
+\hypertarget{classmeow_1_1Self_af3277e1109c59e5f81549889b344a675}{\index{meow\-::\-Self@{meow\-::\-Self}!operator=@{operator=}}
+\index{operator=@{operator=}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{operator=}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ void {\bf meow\-::\-Self}$<$ Data $>$\-::operator= (
+\begin{DoxyParamCaption}
+\item[{{\bf Self}$<$ Data $>$ const \&}]{a}
+\end{DoxyParamCaption}
+)}}\label{classmeow_1_1Self_af3277e1109c59e5f81549889b344a675}
+
+
+將 {\ttfamily operator=} 給disable掉
+
+\hypertarget{classmeow_1_1Self_a576e99ba0ba6e8263b4d2cfd9238440f}{\index{meow\-::\-Self@{meow\-::\-Self}!reference\-From@{reference\-From}}
+\index{reference\-From@{reference\-From}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{reference\-From}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ void {\bf meow\-::\-Self}$<$ Data $>$\-::reference\-From (
+\begin{DoxyParamCaption}
+\item[{{\bf Self}$<$ Data $>$ const \&}]{s}
+\end{DoxyParamCaption}
+)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_a576e99ba0ba6e8263b4d2cfd9238440f}
+
+
+將自己reference 到給定的 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}}
+
+
+\begin{DoxyParams}[1]{Parameters}
+\mbox{\tt in} & {\em s} & 給定的{\ttfamily \hyperlink{classmeow_1_1Self}{Self}} \\
+\hline
+\end{DoxyParams}
+\begin{DoxyReturn}{Returns}
+無
+\end{DoxyReturn}
+\begin{DoxyNote}{Note}
+把reference想像成指標會比較容易思考, 譬如 {\ttfamily a.\-reference\-From(b)} {\ttfamily b.\-reference\-From(c)} 相當於 {\bfseries a指向b原本指的記憶體位置}, {\bfseries b指向c原本指的記憶體位置} , 之後更動c時, 只有b會被牽連
+\end{DoxyNote}
+\hypertarget{classmeow_1_1Self_a10f22a83c3afcf65f8f9680f2a2f945c}{\index{meow\-::\-Self@{meow\-::\-Self}!reference\-Less@{reference\-Less}}
+\index{reference\-Less@{reference\-Less}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{reference\-Less}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ bool {\bf meow\-::\-Self}$<$ Data $>$\-::reference\-Less (
+\begin{DoxyParamCaption}
+\item[{{\bf Self}$<$ Data $>$ const \&}]{s}
+\end{DoxyParamCaption}
+) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_a10f22a83c3afcf65f8f9680f2a2f945c}
+
+
+以reference作為判斷依據的小於判斷
+
+
+\begin{DoxyParams}[1]{Parameters}
+\mbox{\tt in} & {\em s} & 另一個 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} \\
+\hline
+\end{DoxyParams}
+\begin{DoxyReturn}{Returns}
+{\ttfamily true/false} 表示自己是否小於另一個 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}}
+\end{DoxyReturn}
+\hypertarget{classmeow_1_1Self_ab3671e44693b79e2f987f59652d46ca9}{\index{meow\-::\-Self@{meow\-::\-Self}!same@{same}}
+\index{same@{same}!meow::Self@{meow\-::\-Self}}
+\subsubsection[{same}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Data$>$ bool {\bf meow\-::\-Self}$<$ Data $>$\-::same (
+\begin{DoxyParamCaption}
+\item[{{\bf Self}$<$ Data $>$ const \&}]{s}
+\end{DoxyParamCaption}
+) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classmeow_1_1Self_ab3671e44693b79e2f987f59652d46ca9}
+
+
+比對兩個 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} 是否指向同一個reference
+
+
+\begin{DoxyParams}[1]{Parameters}
+\mbox{\tt in} & {\em s} & 另一個 {\ttfamily \hyperlink{classmeow_1_1Self}{Self}} \\
+\hline
+\end{DoxyParams}
+\begin{DoxyReturn}{Returns}
+{\ttfamily true/false} 表示是否為同一個reference
+\end{DoxyReturn}
+
+
+The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
+\item
+meowpp/\hyperlink{Self_8h}{Self.\-h}\end{DoxyCompactItemize}