FSM/vscode/manual/latex/template_f_s_m_8c.tex

152 lines
7.8 KiB
TeX
Raw Normal View History

2024-05-07 16:45:57 +08:00
\doxysection{FSM\+\_\+\+OOP/template/template\+FSM.c File Reference}
\hypertarget{template_f_s_m_8c}{}\label{template_f_s_m_8c}\index{FSM\_OOP/template/templateFSM.c@{FSM\_OOP/template/templateFSM.c}}
重新实现几个必须实现的函数,并赋值到父类指针里
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include "{}FSM\+\_\+protected.\+h"{}}\newline
{\ttfamily \#include "{}template\+FSM.\+h"{}}\newline
{\ttfamily \#include "{}template\+FSM\+\_\+private.\+h"{}}\newline
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item
static void \mbox{\hyperlink{template_f_s_m_8c_a9e6eba3b03d1ff4c504705b2da864cb3}{load\+External\+Data}} (Template\+FSMData \texorpdfstring{$\ast$}{*}data)
\item
static void \mbox{\hyperlink{template_f_s_m_8c_a7ae1c0974bb8e7f8b00f959a17d91f60}{reset\+Signals}} (\mbox{\hyperlink{struct_f_s_m_signals}{FSMSignals}} \texorpdfstring{$\ast$}{*}signals, Template\+FSMData \texorpdfstring{$\ast$}{*}data)
\begin{DoxyCompactList}\small\item\em 根据条件重置信号 \end{DoxyCompactList}\item
static void \mbox{\hyperlink{template_f_s_m_8c_a5ebc219bfad056d35b189b8e6fa94896}{init\+Data}} (Template\+FSM \texorpdfstring{$\ast$}{*}p\+FSM)
\begin{DoxyCompactList}\small\item\em 给所有内部、外部数据分配堆空间 \end{DoxyCompactList}\item
static void \mbox{\hyperlink{template_f_s_m_8c_a8b945e9059bb82bf66884af5133eb898}{init\+Data\+Loader}} (Template\+FSM \texorpdfstring{$\ast$}{*}p\+FSM)
\item
static void \mbox{\hyperlink{template_f_s_m_8c_a48fc6ebf7882fb5d4437c4d64b96255b}{setup\+Handler}} (\mbox{\hyperlink{struct_f_s_m_handler}{FSMHandler}} \texorpdfstring{$\ast$}{*}fcns)
\begin{DoxyCompactList}\small\item\em 设置状态选择函数、状态内函数和状态转移函数 \end{DoxyCompactList}\item
static void \mbox{\hyperlink{template_f_s_m_8c_ac23edf7d09bf4b52ca0cfbc1224c4c0d}{step}} (Template\+FSM \texorpdfstring{$\ast$}{*}p\+FSM)
\begin{DoxyCompactList}\small\item\em 重新实现基类的step函数添加一些打印信息 \end{DoxyCompactList}\item
Template\+FSM \texorpdfstring{$\ast$}{*} \mbox{\hyperlink{template_f_s_m_8c_ab0fc4d91dbcaaffccd8f14e56173d696}{create\+Template\+FSM}} ()
\begin{DoxyCompactList}\small\item\em Create a Template FSM object. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection{Detailed Description}
重新实现几个必须实现的函数,并赋值到父类指针里
\begin{DoxyAuthor}{Author}
天神 (\href{mailto:dalaoshi@stu.xjtu.edu.cn}{\texttt{ dalaoshi@stu.\+xjtu.\+edu.\+cn}})
\end{DoxyAuthor}
\begin{DoxyVersion}{Version}
2.\+1
\end{DoxyVersion}
\begin{DoxyDate}{Date}
2024-\/05-\/07
\end{DoxyDate}
\begin{DoxyCopyright}{Copyright}
天神创意无限公司 2024
\end{DoxyCopyright}
\doxysubsection{Function Documentation}
\Hypertarget{template_f_s_m_8c_a9e6eba3b03d1ff4c504705b2da864cb3}\label{template_f_s_m_8c_a9e6eba3b03d1ff4c504705b2da864cb3}
\index{templateFSM.c@{templateFSM.c}!loadExternalData@{loadExternalData}}
\index{loadExternalData@{loadExternalData}!templateFSM.c@{templateFSM.c}}
\doxysubsubsection{\texorpdfstring{loadExternalData()}{loadExternalData()}}
{\footnotesize\ttfamily static void load\+External\+Data (\begin{DoxyParamCaption}\item[{Template\+FSMData \texorpdfstring{$\ast$}{*}}]{data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
\begin{DoxyRefDesc}{Deprecated}
\item[\mbox{\hyperlink{deprecated__deprecated000016}{Deprecated}}]暂时没用后续考虑data是否需要加锁再说 \end{DoxyRefDesc}
\begin{DoxyParams}{Parameters}
{\em data} & 主要是外部数据 \\
\hline
\end{DoxyParams}
\Hypertarget{template_f_s_m_8c_a7ae1c0974bb8e7f8b00f959a17d91f60}\label{template_f_s_m_8c_a7ae1c0974bb8e7f8b00f959a17d91f60}
\index{templateFSM.c@{templateFSM.c}!resetSignals@{resetSignals}}
\index{resetSignals@{resetSignals}!templateFSM.c@{templateFSM.c}}
\doxysubsubsection{\texorpdfstring{resetSignals()}{resetSignals()}}
{\footnotesize\ttfamily static void reset\+Signals (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_f_s_m_signals}{FSMSignals}} \texorpdfstring{$\ast$}{*}}]{signals, }\item[{Template\+FSMData \texorpdfstring{$\ast$}{*}}]{data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
根据条件重置信号
清除被响应信号和所有小于被响应信号优先级的信号具体可以参考notion
\begin{DoxyParams}{Parameters}
{\em signals} & 状态机接收到的信号 \\
\hline
{\em data} & 状态机数据 \\
\hline
\end{DoxyParams}
\Hypertarget{template_f_s_m_8c_a5ebc219bfad056d35b189b8e6fa94896}\label{template_f_s_m_8c_a5ebc219bfad056d35b189b8e6fa94896}
\index{templateFSM.c@{templateFSM.c}!initData@{initData}}
\index{initData@{initData}!templateFSM.c@{templateFSM.c}}
\doxysubsubsection{\texorpdfstring{initData()}{initData()}}
{\footnotesize\ttfamily static void init\+Data (\begin{DoxyParamCaption}\item[{Template\+FSM \texorpdfstring{$\ast$}{*}}]{p\+FSM }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
给所有内部、外部数据分配堆空间
\begin{DoxyParams}{Parameters}
{\em p\+FSM} & \\
\hline
\end{DoxyParams}
\Hypertarget{template_f_s_m_8c_a8b945e9059bb82bf66884af5133eb898}\label{template_f_s_m_8c_a8b945e9059bb82bf66884af5133eb898}
\index{templateFSM.c@{templateFSM.c}!initDataLoader@{initDataLoader}}
\index{initDataLoader@{initDataLoader}!templateFSM.c@{templateFSM.c}}
\doxysubsubsection{\texorpdfstring{initDataLoader()}{initDataLoader()}}
{\footnotesize\ttfamily static void init\+Data\+Loader (\begin{DoxyParamCaption}\item[{Template\+FSM \texorpdfstring{$\ast$}{*}}]{p\+FSM }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
\begin{DoxyRefDesc}{Deprecated}
\item[\mbox{\hyperlink{deprecated__deprecated000017}{Deprecated}}]弃用 \end{DoxyRefDesc}
\begin{DoxyParams}{Parameters}
{\em p\+FSM} & \\
\hline
\end{DoxyParams}
\Hypertarget{template_f_s_m_8c_a48fc6ebf7882fb5d4437c4d64b96255b}\label{template_f_s_m_8c_a48fc6ebf7882fb5d4437c4d64b96255b}
\index{templateFSM.c@{templateFSM.c}!setupHandler@{setupHandler}}
\index{setupHandler@{setupHandler}!templateFSM.c@{templateFSM.c}}
\doxysubsubsection{\texorpdfstring{setupHandler()}{setupHandler()}}
{\footnotesize\ttfamily static void setup\+Handler (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_f_s_m_handler}{FSMHandler}} \texorpdfstring{$\ast$}{*}}]{fcns }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
设置状态选择函数、状态内函数和状态转移函数
\begin{DoxyParams}{Parameters}
{\em fcns} & 状态机函数表 \\
\hline
\end{DoxyParams}
\Hypertarget{template_f_s_m_8c_ac23edf7d09bf4b52ca0cfbc1224c4c0d}\label{template_f_s_m_8c_ac23edf7d09bf4b52ca0cfbc1224c4c0d}
\index{templateFSM.c@{templateFSM.c}!step@{step}}
\index{step@{step}!templateFSM.c@{templateFSM.c}}
\doxysubsubsection{\texorpdfstring{step()}{step()}}
{\footnotesize\ttfamily static void step (\begin{DoxyParamCaption}\item[{Template\+FSM \texorpdfstring{$\ast$}{*}}]{p\+FSM }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
重新实现基类的step函数添加一些打印信息
\begin{DoxyParams}{Parameters}
{\em p\+FSM} & 子类状态机指针 \\
\hline
\end{DoxyParams}
\Hypertarget{template_f_s_m_8c_ab0fc4d91dbcaaffccd8f14e56173d696}\label{template_f_s_m_8c_ab0fc4d91dbcaaffccd8f14e56173d696}
\index{templateFSM.c@{templateFSM.c}!createTemplateFSM@{createTemplateFSM}}
\index{createTemplateFSM@{createTemplateFSM}!templateFSM.c@{templateFSM.c}}
\doxysubsubsection{\texorpdfstring{createTemplateFSM()}{createTemplateFSM()}}
{\footnotesize\ttfamily Template\+FSM \texorpdfstring{$\ast$}{*} create\+Template\+FSM (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Create a Template FSM object.
子类状态机细节对外隐藏,外部只能访问基类的公有函数来操作子类变量 \begin{DoxyReturn}{Returns}
Template\+FSM\texorpdfstring{$\ast$}{*}
\end{DoxyReturn}