GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4ThreadException.cxx
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4ThreadException.h"
15 
16 #include "TGo4Log.h"
17 #include "TGo4ThreadManager.h"
18 #include "TGo4Runnable.h"
19 
22 {
23  GO4TRACE((14,"TGo4ThreadException::TGo4ThreadException() copy constructor",__LINE__, __FILE__));
26  fxRunnable=right.fxRunnable;
27 }
28 
29 TGo4ThreadException::TGo4ThreadException (TGo4Runnable *runnable, const char *threadname)
30 {
31  GO4TRACE((14,"TGo4ThreadException::TGo4ThreadException(TGo4Runnable *, const char*) constructor",__LINE__, __FILE__));
32  fxRunnable = runnable;
35  if(!threadname)
36  // default: use thread belonging to runnable
37  {
38  GO4TRACE((13,"TGo4ThreadException constructor -- no threadname specified",__LINE__, __FILE__));
39 
40  fxThreadName="0"; // class member is TString...
41  }
42  else
43  {
44  // access to thread by name
45  GO4TRACE((13,"TGo4ThreadException constructor -- using given threadname",__LINE__, __FILE__));
46  fxThreadName=threadname;
47  }
48 }
49 
50 
52 {
53  GO4TRACE((14,"TGo4ThreadException::~TGo4ThreadException() destructor",__LINE__, __FILE__));
54 }
55 
56 
58 {
59  GO4TRACE((14, "TGo4ThreadException::operator=", __LINE__, __FILE__));
60  if (&right != this) {
61  TGo4ControlException::operator=(right); // copy base class members
62  fxThreadName = right.fxThreadName;
64  fxRunnable = right.fxRunnable;
65  }
66  return *this;
67 }
68 
70 {
71  GO4TRACE((14,"TGo4ThreadException::GetThreadName ()",__LINE__, __FILE__));
72  if(fxThreadName=="0")
73  // no, TString was set to zero character:
74  {
75  GO4TRACE((14,"TGo4ThreadException::GetThreadName() -- name not specified",__LINE__, __FILE__));
76  return nullptr;
77  }
78  else
79  // yes, TString contains given thread name
80  {
81  GO4TRACE((14,"TGo4ThreadException::GetThreadName() -- found thread name",__LINE__, __FILE__));
82  return fxThreadName.Data();
83  }
84 }
TGo4ThreadException & operator=(const TGo4ThreadException &right)
TGo4ThreadManager * GetThreadManager() const
Definition: TGo4Runnable.h:46
TGo4Runnable * fxRunnable
TGo4ThreadException()=delete
const char * GetThreadName() const
TGo4ThreadHandler * GetWorkHandler() const
#define GO4TRACE(X)
Definition: TGo4Log.h:25
TGo4ThreadHandler * fxThreadHandler
TGo4ControlException & operator=(const TGo4ControlException &right)