![]() |
TinkerCell Core 1.0
TinkerCell's Core library providing all basic functionalities
|
This class is used to run specific functions inside a C dynamic library as a separate thread. The class can be used to load a library or just run a specific function inside an already loaded library. If the library is loaded by this class, the library will be unloaded upon completion on the function. To prevent the automatic unloading, use the setAutoUnload option. Only four types of functions are supported. More...
#include <CThread.h>
Public Slots | |
virtual void | unload () |
unload the C library | |
virtual void | update () |
call the callback function, if one exists | |
Signals | |
void | setProgress (int) |
display progress of this thread (0-100). This signal is usually connected to a slot in ProgressBarSignalItem | |
void | setTitle (const QString &) |
void | hideProgressBar () |
hide the progress bar | |
void | showProgressBar () |
show the progress bar | |
Public Member Functions | |
virtual void | showProgress (const QString &, int) |
show progress in a progress dialog | |
CThread (MainWindow *main, QLibrary *lib=0, bool autoUnload=false) | |
constructor | |
CThread (MainWindow *main, const QString &lib, bool autoUnload=false) | |
constructor | |
virtual | ~CThread () |
destructor. unload and deletes the library | |
virtual void | setFunction (void(*f)(void), QSemaphore *sem=0) |
set the function to run inside this threads | |
virtual void | setFunction (void(*f)(double), QSemaphore *sem=0) |
set the function to run inside this threads | |
virtual void | setFunction (void(*f)(const char *), QSemaphore *sem=0) |
set the function to run inside this threads | |
virtual void | setFunction (void(*f)(tc_matrix), QSemaphore *sem=0) |
set the function to run inside this threads | |
virtual void | setVoidFunction (const char *, QSemaphore *sem=0) |
set the function to run inside this threads | |
virtual void | setDoubleFunction (const char *, QSemaphore *sem=0) |
set the function to run inside this threads | |
virtual void | setCharFunction (const char *, QSemaphore *sem=0) |
set the function to run inside this threads | |
virtual void | setMatrixFunction (const char *, QSemaphore *sem=0) |
set the function to run inside this threads | |
virtual void | setLibrary (QLibrary *) |
set the dynamic library for this threads. The library will be loaded if it has not already been loaded | |
virtual void | setLibrary (const QString &) |
set the dynamic library for this threads. | |
virtual QLibrary * | library () |
the library used inside this thread | |
virtual void | setAutoUnload (bool) |
set whether or not to automatically unload the library when the thread is done running | |
virtual bool | autoUnload () |
whether or not to automatically unload the library when the thread is done running | |
virtual void | setArg (double, QSemaphore *sem=0) |
set the argument for the target function | |
virtual void | setArg (const QString &, QSemaphore *sem=0) |
set the argument for the target function | |
virtual void | setArg (const DataTable< qreal > &, QSemaphore *sem=0) |
set the argument for the target function | |
Static Public Member Functions | |
static QLibrary * | loadLibrary (const QString &name, QObject *parent=0) |
search the default tinkercell folders for the library and load it | |
Public Attributes | |
MainWindow * | mainWindow |
main window | |
Static Public Attributes | |
static QList< CThread * > | cthreads |
list stores pointers to different threads | |
Protected Slots | |
virtual void | cleanupAfterTerminated () |
cleanup (such as unload libraries) upon termination | |
Protected Member Functions | |
virtual void | setupCFunctionPointers (QLibrary *lib=0) |
setup the C pointers in TC_Main.h | |
virtual void | call_tc_main () |
call tc_main | |
virtual void | run () |
the main function that runs one of the specified functions | |
Protected Attributes | |
bool | hasDialog |
bool | autoUnloadLibrary |
whether or not to automatically unload the library when the thread is done running | |
void(* | f1 )(void) |
one of the functions that can be run inside this thread | |
void(* | f2 )(double) |
one of the functions that can be run inside this thread | |
void(* | f3 )(const char *) |
one of the functions that can be run inside this thread | |
void(* | f4 )(tc_matrix) |
one of the functions that can be run inside this thread | |
void(* | callbackPtr )(void) |
callback function | |
void(* | callWhenExitPtr )(void) |
call when exit function | |
QLibrary * | lib |
the library where the functions are located that can be run inside this thread | |
double | argDouble |
the argument for one of the the run function | |
QString | argString |
the argument for one of the the run function | |
DataTable< qreal > | argMatrix |
the argument for one of the the run function |
This class is used to run specific functions inside a C dynamic library as a separate thread. The class can be used to load a library or just run a specific function inside an already loaded library. If the library is loaded by this class, the library will be unloaded upon completion on the function. To prevent the automatic unloading, use the setAutoUnload option. Only four types of functions are supported.
Tinkercell::CThread::CThread | ( | MainWindow * | main, |
QLibrary * | lib = 0 , |
||
bool | autoUnload = false |
||
) |
constructor
MainWindow | the Tinkercell main window |
QLibrary | the dynamic library to load (optional) |
bool | whether or not to automatically unload the library |
Definition at line 54 of file CThread.cpp.
Tinkercell::CThread::CThread | ( | MainWindow * | main, |
const QString & | lib, | ||
bool | autoUnload = false |
||
) |
constructor
MainWindow | the Tinkercell main window |
QString | the name of the dynamic library to load (optional) |
bool | whether or not to automatically unload the library |
Definition at line 74 of file CThread.cpp.
Tinkercell::CThread::~CThread | ( | ) | [virtual] |
destructor. unload and deletes the library
Definition at line 103 of file CThread.cpp.
bool Tinkercell::CThread::autoUnload | ( | ) | [virtual] |
whether or not to automatically unload the library when the thread is done running
Definition at line 241 of file CThread.cpp.
void Tinkercell::CThread::call_tc_main | ( | ) | [protected, virtual] |
void Tinkercell::CThread::cleanupAfterTerminated | ( | ) | [protected, virtual, slot] |
cleanup (such as unload libraries) upon termination
Definition at line 292 of file CThread.cpp.
void Tinkercell::CThread::hideProgressBar | ( | ) | [signal] |
hide the progress bar
QLibrary * Tinkercell::CThread::library | ( | ) | [virtual] |
QLibrary * Tinkercell::CThread::loadLibrary | ( | const QString & | name, |
QObject * | parent = 0 |
||
) | [static] |
search the default tinkercell folders for the library and load it
QString | name of library (with or without full path) |
QObject | parent |
Definition at line 416 of file CThread.cpp.
void Tinkercell::CThread::run | ( | ) | [protected, virtual] |
the main function that runs one of the specified functions
Definition at line 246 of file CThread.cpp.
void Tinkercell::CThread::setArg | ( | double | d, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the argument for the target function
double |
Definition at line 271 of file CThread.cpp.
void Tinkercell::CThread::setArg | ( | const QString & | s, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the argument for the target function
QString |
Definition at line 278 of file CThread.cpp.
void Tinkercell::CThread::setArg | ( | const DataTable< qreal > & | dat, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the argument for the target function
DataTable |
Definition at line 285 of file CThread.cpp.
void Tinkercell::CThread::setAutoUnload | ( | bool | b | ) | [virtual] |
set whether or not to automatically unload the library when the thread is done running
bool |
Definition at line 236 of file CThread.cpp.
void Tinkercell::CThread::setCharFunction | ( | const char * | f, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the function to run inside this threads
void | name of the function inside the library that has been loaded in this thread. |
Definition at line 155 of file CThread.cpp.
void Tinkercell::CThread::setDoubleFunction | ( | const char * | f, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the function to run inside this threads
void | name of the function inside the library that has been loaded in this thread. |
Definition at line 140 of file CThread.cpp.
void Tinkercell::CThread::setFunction | ( | void(*)(void) | f, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the function to run inside this threads
void | function pointer |
Definition at line 118 of file CThread.cpp.
void Tinkercell::CThread::setFunction | ( | void(*)(double) | f, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the function to run inside this threads
void | function pointer |
Definition at line 133 of file CThread.cpp.
void Tinkercell::CThread::setFunction | ( | void(*)(const char *) | f, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the function to run inside this threads
void | function pointer |
Definition at line 148 of file CThread.cpp.
void Tinkercell::CThread::setFunction | ( | void(*)(tc_matrix) | f, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the function to run inside this threads
void | function pointer |
Definition at line 163 of file CThread.cpp.
void Tinkercell::CThread::setLibrary | ( | QLibrary * | lib | ) | [virtual] |
set the dynamic library for this threads. The library will be loaded if it has not already been loaded
QLibrary* | library |
Definition at line 204 of file CThread.cpp.
void Tinkercell::CThread::setLibrary | ( | const QString & | libname | ) | [virtual] |
set the dynamic library for this threads.
QLibrary* | library |
Definition at line 219 of file CThread.cpp.
void Tinkercell::CThread::setMatrixFunction | ( | const char * | f, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the function to run inside this threads
void | name of the function inside the library that has been loaded in this thread. |
Definition at line 170 of file CThread.cpp.
void Tinkercell::CThread::setProgress | ( | int | ) | [signal] |
display progress of this thread (0-100). This signal is usually connected to a slot in ProgressBarSignalItem
void Tinkercell::CThread::setTitle | ( | const QString & | ) | [signal] |
set title of the dialog for this thread that shows the progress bar and kill button
void Tinkercell::CThread::setupCFunctionPointers | ( | QLibrary * | lib = 0 | ) | [protected, virtual] |
setup the C pointers in TC_Main.h
Definition at line 184 of file CThread.cpp.
void Tinkercell::CThread::setVoidFunction | ( | const char * | f, |
QSemaphore * | sem = 0 |
||
) | [virtual] |
set the function to run inside this threads
void | name of the function inside the library that has been loaded in this thread. |
Definition at line 125 of file CThread.cpp.
void Tinkercell::CThread::showProgress | ( | const QString & | title, |
int | progress | ||
) | [virtual] |
show progress in a progress dialog
QString | title of the progress bar |
int | progress in range 0-100 |
Definition at line 392 of file CThread.cpp.
void Tinkercell::CThread::showProgressBar | ( | ) | [signal] |
show the progress bar
void Tinkercell::CThread::unload | ( | ) | [virtual, slot] |
unload the C library
Definition at line 304 of file CThread.cpp.
void Tinkercell::CThread::update | ( | ) | [virtual, slot] |
call the callback function, if one exists
Definition at line 298 of file CThread.cpp.
double Tinkercell::CThread::argDouble [protected] |
DataTable<qreal> Tinkercell::CThread::argMatrix [protected] |
QString Tinkercell::CThread::argString [protected] |
bool Tinkercell::CThread::autoUnloadLibrary [protected] |
void(* Tinkercell::CThread::callbackPtr)(void) [protected] |
void(* Tinkercell::CThread::callWhenExitPtr)(void) [protected] |
QList< CThread * > Tinkercell::CThread::cthreads [static] |
void(* Tinkercell::CThread::f1)(void) [protected] |
void(* Tinkercell::CThread::f2)(double) [protected] |
void(* Tinkercell::CThread::f3)(const char *) [protected] |
void(* Tinkercell::CThread::f4)(tc_matrix) [protected] |
bool Tinkercell::CThread::hasDialog [protected] |
QLibrary* Tinkercell::CThread::lib [protected] |