ToolDAQFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
MyToolThread.cpp
Go to the documentation of this file.
1 #include "MyToolThread.h"
2 
4 
6 
7 
9 
10 
11 bool MyToolThread::Initialise(std::string configfile, DataModel &data){
12 
13  if(configfile!="") m_variables.Initialise(configfile);
14  //m_variables.Print();
15 
16  m_data= &data;
17  m_log= m_data->Log;
18 
19  if(!m_variables.Get("verbose",m_verbose)) m_verbose=1;
20 
21  m_util=new Utilities(m_data->context);
22  args=new MyToolThread_args();
23 
24  m_util->CreateThread("test", &Thread, args);
25 
26  return true;
27 }
28 
29 
31 
32  return true;
33 }
34 
35 
37 
39 
40  delete args;
41  args=0;
42 
43  delete m_util;
44  m_util=0;
45 
46  return true;
47 }
48 
50 
51  MyToolThread_args* args=reinterpret_cast<MyToolThread_args*>(arg);
52 
53 }
bool Initialise(std::string configfile, DataModel &data)
Initialise Function for setting up Tool resorces.
Utilities * m_util
Pointer to utilities class to help with threading.
Definition: MyToolThread.h:50
Logging * Log
Log class pointer for use in Tools, it can be used to send messages which can have multiple error lev...
Definition: DataModel.h:60
bool Finalise()
Finalise funciton used to clean up resorces.
Thread_args * CreateThread(std::string ThreadName, void(*func)(std::string))
Definition: Utilities.cpp:130
MyToolThread()
Simple constructor.
Definition: MyToolThread.cpp:8
static void Thread(Thread_args *arg)
Function to be run by the thread in a loop. Make sure not to block in it.
MyToolThread_args * args
thread args (also holds pointer to the thread)
Definition: MyToolThread.h:51
bool KillThread(Thread_args *&args)
Kill a thread assosiated to args.
Definition: Utilities.cpp:234
bool Execute()
Executre function used to perform Tool perpose.