\hypertarget{classOpenFlipperThread}{}\section{Open\+Flipper\+Thread Class Reference}
\label{classOpenFlipperThread}\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}


Thread handling class for Open\+Flipper.  




{\ttfamily \#include $<$Open\+Flipper/threads/\+Open\+Flipper\+Thread.\+hh$>$}

Inheritance diagram for Open\+Flipper\+Thread\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classOpenFlipperThread}
\end{center}
\end{figure}
\subsection*{Signals}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classOpenFlipperThread_ac0e215454748b3859ce193fa3271a463}{start\+Processing\+Internal} ()
\begin{DoxyCompactList}\small\item\em start processing of a function \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classOpenFlipperThread_a2f61c2c3cac596dad51f68ae6f3d0e91}\label{classOpenFlipperThread_a2f61c2c3cac596dad51f68ae6f3d0e91}} 
{\bfseries Open\+Flipper\+Thread} (Q\+String \+\_\+job\+Id)
\end{DoxyCompactItemize}
\subsection*{Private Slots}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classOpenFlipperThread_a7df8a9a48107b7c6c92927297e2cac02}{slot\+Job\+Finished} ()
\begin{DoxyCompactList}\small\item\em job has finished \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classOpenFlipperJob}{Open\+Flipper\+Job} $\ast$ \hyperlink{classOpenFlipperThread_a3d703023400cf4b2ceb1fdd04a2002b8}{job\+\_\+}
\begin{DoxyCompactList}\small\item\em Internal job wrapper. \end{DoxyCompactList}\item 
Q\+String \hyperlink{classOpenFlipperThread_aa8dcc8edd5d329c1c18069a5c528f825}{job\+Id\+\_\+}
\begin{DoxyCompactList}\small\item\em Id of the current job. \end{DoxyCompactList}\item 
Q\+Semaphore \hyperlink{classOpenFlipperThread_a0064b4613b7adcc2b6817a300ddcd173}{startup\+\_\+}
\begin{DoxyCompactList}\small\item\em Semaphore to control order of thread startup calls. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Advanced job processing}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classOpenFlipperThread_a6878d366fb0ec02eaf25db1163cfa5b8}{run} ()
\begin{DoxyCompactList}\small\item\em Main processing. \end{DoxyCompactList}\item 
virtual void \hyperlink{classOpenFlipperThread_a52b846d7205201c48d21267228b54de5}{cancel} ()
\begin{DoxyCompactList}\small\item\em Cancel the job. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classOpenFlipperThread_a1d353488786a7984dadb55f71db1f844}\label{classOpenFlipperThread_a1d353488786a7984dadb55f71db1f844}} 
Q\+String \hyperlink{classOpenFlipperThread_a1d353488786a7984dadb55f71db1f844}{job\+Id} ()
\begin{DoxyCompactList}\small\item\em get Job\+Id get the Id of the current Job \end{DoxyCompactList}\item 
void \hyperlink{classOpenFlipperThread_abe9badd14a386d6e61e060ad6d65d8f3}{slot\+Cancel} (Q\+String \+\_\+job\+Id)
\begin{DoxyCompactList}\small\item\em Cancel this job. \end{DoxyCompactList}\item 
void \hyperlink{classOpenFlipperThread_aab4287c49391f9b54554f646538f4f8b}{state} (Q\+String \+\_\+job\+Id, int \+\_\+state)
\begin{DoxyCompactList}\small\item\em Tell core about job state. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Simple job processing}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classOpenFlipperThread_a007c870b15292d058ac2faf4975f14f5}{start\+Processing} ()
\begin{DoxyCompactList}\small\item\em start processing \end{DoxyCompactList}\item 
void \hyperlink{classOpenFlipperThread_a6242c285f0b56225a64c94a4e70d4b9c}{function} (const Q\+String \+\_\+job\+Id=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em job function \end{DoxyCompactList}\item 
void \hyperlink{classOpenFlipperThread_adba457119f0c198cef6f71db2665291c}{finished} (Q\+String \+\_\+job\+Id)
\begin{DoxyCompactList}\small\item\em job done \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Thread handling class for Open\+Flipper. 

Instantiate this class in order to provide a thread to a plugin. Unless you don\textquotesingle{}t need a specialized \hyperlink{classOpenFlipperThread_a6878d366fb0ec02eaf25db1163cfa5b8}{run()} or \hyperlink{classOpenFlipperThread_a52b846d7205201c48d21267228b54de5}{cancel()} function, it won\textquotesingle{}t be necessary to reimplement this class. Just connect the signals for the thread to work properly.

Note\+: Updating G\+UI elements of the main window from within a thread which is not the main thread can cause unexpected crashes to Open\+Flipper. This introduces some major limitations to the usage of threads in plugins. These include avoiding the creation of new objects and generally every function that produces logging messages.

The class should be used along with \hyperlink{processInterfacePage}{Process Interface}

It is not necessary to derive from this class for most operations, but you can. 

Definition at line 77 of file Open\+Flipper\+Thread.\+hh.



\subsection{Member Function Documentation}
\mbox{\Hypertarget{classOpenFlipperThread_a52b846d7205201c48d21267228b54de5}\label{classOpenFlipperThread_a52b846d7205201c48d21267228b54de5}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!cancel@{cancel}}
\index{cancel@{cancel}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{cancel()}{cancel()}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::cancel (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Cancel the job. 

Reimplement this function to correctly terminate your job. If your job is able to terminate correctly then you can reimplement this function and stop your process. 

Reimplemented in \hyperlink{classDecimateThread_ab3d8bf3e473210d1887c7af8d0c40c0a}{Decimate\+Thread}.



Definition at line 95 of file Open\+Flipper\+Thread.\+cc.

\mbox{\Hypertarget{classOpenFlipperThread_adba457119f0c198cef6f71db2665291c}\label{classOpenFlipperThread_adba457119f0c198cef6f71db2665291c}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!finished@{finished}}
\index{finished@{finished}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{finished}{finished}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::finished (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+job\+Id }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [signal]}}



job done 

This signal is emitted if your job has finished and should be used to tell the core that your job has finished. \mbox{\Hypertarget{classOpenFlipperThread_a6242c285f0b56225a64c94a4e70d4b9c}\label{classOpenFlipperThread_a6242c285f0b56225a64c94a4e70d4b9c}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!function@{function}}
\index{function@{function}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{function}{function}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::function (\begin{DoxyParamCaption}\item[{const Q\+String}]{\+\_\+job\+Id = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [signal]}}



job function 

If you do not specialize the \hyperlink{classOpenFlipperThread}{Open\+Flipper\+Thread}, The function connected to this signal will be used as the processing function for your thread. When you call 
\begin{DoxyCode}
OpenFlipper::startProcessing();
\end{DoxyCode}


You have connect one of your slot using 
\begin{DoxyCode}
connect( \hyperlink{classOpenFlipperThread}{OpenFlipperThread} ,SIGNAL(\textcolor{keyword}{function}()),YourPlugin,SLOT(YourSlot(),
      Qt::DirectConnection) );
\end{DoxyCode}


The default implementation will call your slot inside the new thread and the core will still respond.

The optional parameter contains the job\textquotesingle{}s id. In some cases the function that is to be called needs the job\textquotesingle{}s id for further processing (status updates, etc.) \mbox{\Hypertarget{classOpenFlipperThread_a6878d366fb0ec02eaf25db1163cfa5b8}\label{classOpenFlipperThread_a6878d366fb0ec02eaf25db1163cfa5b8}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!run@{run}}
\index{run@{run}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{run()}{run()}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::run (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Main processing. 

Do not reimplement this function. Connect the \hyperlink{classOpenFlipperThread_a6242c285f0b56225a64c94a4e70d4b9c}{function()} signal with your running function. Use signal \hyperlink{classOpenFlipperThread_aab4287c49391f9b54554f646538f4f8b}{state()} in order to inform the core about the job\textquotesingle{}s current state. 

Definition at line 62 of file Open\+Flipper\+Thread.\+cc.

\mbox{\Hypertarget{classOpenFlipperThread_abe9badd14a386d6e61e060ad6d65d8f3}\label{classOpenFlipperThread_abe9badd14a386d6e61e060ad6d65d8f3}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!slot\+Cancel@{slot\+Cancel}}
\index{slot\+Cancel@{slot\+Cancel}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{slot\+Cancel}{slotCancel}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::slot\+Cancel (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+job\+Id }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [slot]}}



Cancel this job. 

Call this slot with the correct job id to abort processing This directly calls \hyperlink{classOpenFlipperThread_a52b846d7205201c48d21267228b54de5}{cancel()} This is only useful when you derived from this class, as other jobs might not react on this slot 

Definition at line 99 of file Open\+Flipper\+Thread.\+cc.

\mbox{\Hypertarget{classOpenFlipperThread_a7df8a9a48107b7c6c92927297e2cac02}\label{classOpenFlipperThread_a7df8a9a48107b7c6c92927297e2cac02}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!slot\+Job\+Finished@{slot\+Job\+Finished}}
\index{slot\+Job\+Finished@{slot\+Job\+Finished}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{slot\+Job\+Finished}{slotJobFinished}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::slot\+Job\+Finished (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}, {\ttfamily [slot]}}



job has finished 

Called by the job wrapper, when the job is done. 

Definition at line 105 of file Open\+Flipper\+Thread.\+cc.

\mbox{\Hypertarget{classOpenFlipperThread_a007c870b15292d058ac2faf4975f14f5}\label{classOpenFlipperThread_a007c870b15292d058ac2faf4975f14f5}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!start\+Processing@{start\+Processing}}
\index{start\+Processing@{start\+Processing}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{start\+Processing}{startProcessing}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::start\+Processing (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [slot]}}



start processing 

This function will start the actual processing of a job. 

Definition at line 112 of file Open\+Flipper\+Thread.\+cc.

\mbox{\Hypertarget{classOpenFlipperThread_ac0e215454748b3859ce193fa3271a463}\label{classOpenFlipperThread_ac0e215454748b3859ce193fa3271a463}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!start\+Processing\+Internal@{start\+Processing\+Internal}}
\index{start\+Processing\+Internal@{start\+Processing\+Internal}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{start\+Processing\+Internal}{startProcessingInternal}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::start\+Processing\+Internal (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [signal]}}



start processing of a function 

(I\+N\+T\+E\+R\+N\+A\+L!) ~\newline
This signal is used to start the process execution through the wrapper \mbox{\Hypertarget{classOpenFlipperThread_aab4287c49391f9b54554f646538f4f8b}\label{classOpenFlipperThread_aab4287c49391f9b54554f646538f4f8b}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!state@{state}}
\index{state@{state}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{state}{state}}
{\footnotesize\ttfamily void Open\+Flipper\+Thread\+::state (\begin{DoxyParamCaption}\item[{Q\+String}]{\+\_\+job\+Id,  }\item[{int}]{\+\_\+state }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [signal]}}



Tell core about job state. 

Use this signal to inform core about the job\textquotesingle{}s state if and only if the thread class inherits from \hyperlink{classOpenFlipperThread}{Open\+Flipper\+Thread} and the virtual \hyperlink{classOpenFlipperThread_a6878d366fb0ec02eaf25db1163cfa5b8}{run()} function is overridden. In all other cases this signal won\textquotesingle{}t be used and does not have to be connected to from within the plugins. 

\subsection{Member Data Documentation}
\mbox{\Hypertarget{classOpenFlipperThread_a3d703023400cf4b2ceb1fdd04a2002b8}\label{classOpenFlipperThread_a3d703023400cf4b2ceb1fdd04a2002b8}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!job\+\_\+@{job\+\_\+}}
\index{job\+\_\+@{job\+\_\+}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{job\+\_\+}{job\_}}
{\footnotesize\ttfamily \hyperlink{classOpenFlipperJob}{Open\+Flipper\+Job}$\ast$ Open\+Flipper\+Thread\+::job\+\_\+\hspace{0.3cm}{\ttfamily [private]}}



Internal job wrapper. 

(I\+N\+T\+E\+R\+N\+A\+L!) ~\newline
This wrapper is used to start slots inside the event queue of the current thread. All slots defined in the Q\+Thread object live in the callers thread(\+The main thread). All slots inside the wrapper live in the thread created by Q\+Thread. and therefore do not lock the main event loop 

Definition at line 205 of file Open\+Flipper\+Thread.\+hh.

\mbox{\Hypertarget{classOpenFlipperThread_aa8dcc8edd5d329c1c18069a5c528f825}\label{classOpenFlipperThread_aa8dcc8edd5d329c1c18069a5c528f825}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!job\+Id\+\_\+@{job\+Id\+\_\+}}
\index{job\+Id\+\_\+@{job\+Id\+\_\+}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{job\+Id\+\_\+}{jobId\_}}
{\footnotesize\ttfamily Q\+String Open\+Flipper\+Thread\+::job\+Id\+\_\+\hspace{0.3cm}{\ttfamily [private]}}



Id of the current job. 

This holds the id of the current job. Most functions only react if the correct id is passed to the function. 

Definition at line 212 of file Open\+Flipper\+Thread.\+hh.

\mbox{\Hypertarget{classOpenFlipperThread_a0064b4613b7adcc2b6817a300ddcd173}\label{classOpenFlipperThread_a0064b4613b7adcc2b6817a300ddcd173}} 
\index{Open\+Flipper\+Thread@{Open\+Flipper\+Thread}!startup\+\_\+@{startup\+\_\+}}
\index{startup\+\_\+@{startup\+\_\+}!Open\+Flipper\+Thread@{Open\+Flipper\+Thread}}
\subsubsection{\texorpdfstring{startup\+\_\+}{startup\_}}
{\footnotesize\ttfamily Q\+Semaphore Open\+Flipper\+Thread\+::startup\+\_\+\hspace{0.3cm}{\ttfamily [private]}}



Semaphore to control order of thread startup calls. 

This variable is used to control the order of thread startup calls. The Thread itself is started, and when it is up and running, the resource will be created. The core thread waits for this resource and afterwards starts execution of the threads processing function. Without this sync, the processing call of the main thread might get lost as the thread is not online and listening for the signal. 

Definition at line 222 of file Open\+Flipper\+Thread.\+hh.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
Open\+Flipper/threads/Open\+Flipper\+Thread.\+hh\item 
Open\+Flipper/threads/Open\+Flipper\+Thread.\+cc\end{DoxyCompactItemize}
