GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4CreateException.cxx
Go to the documentation of this file.
1 // $Id: TGo4CreateException.cxx 999 2013-07-25 11:58:59Z linev $
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 für 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 "TGo4CreateException.h"
15 
16 #include "Riostream.h"
17 
18 #include "TGo4Log.h"
19 #include "TGo4Thread.h"
20 #include "TGo4ThreadHandler.h"
21 #include "TGo4Runnable.h"
22 
24  :TGo4ThreadException(right)
25 {
26  GO4TRACE((14,"TGo4CreateException::TGo4CreateException() copy constructor",__LINE__, __FILE__));
27 }
28 
29 TGo4CreateException::TGo4CreateException (TGo4Runnable* runnable, const char* threadname)
30 :TGo4ThreadException(runnable,threadname)
31 {
32  GO4TRACE((14,"TGo4CreateException::TGo4CreateException(TGo4Runnable*, const char*) constructor",__LINE__, __FILE__));
33  fxDescription= "!!!-- Go4 Create Exception --!!!";
34 }
35 
36 
38 {
39  GO4TRACE((14,"TGo4CreateException::~TGo4CreateException() destructor",__LINE__, __FILE__));
40 }
41 
42 
44 {
45  GO4TRACE((14,"TGo4CreateException::operator=",__LINE__, __FILE__));
46  if (&right!=this)
47  {
48  GO4TRACE((13,"TGo4CreateException::operator= processing copy",__LINE__, __FILE__));
49  TGo4ThreadException::operator=(right); // copy base class members
50  // put additional member copies here...
51  return *this;
52  }
53  else
54  {
55  // copy is already source object
56  GO4TRACE((13,"TGo4CreateException::operator= source and destination objects are identical",__LINE__, __FILE__));
57  return *this;
58  }
59 }
60 
62 {
63  GO4TRACE((14,"TGo4CreateException::Handle()",__LINE__, __FILE__));
64  std::cout << "\t This is the TGo4CreateException::Handler"<<std::endl;
65  Int_t rev=-1;
66  if(GetThreadName()==0)
67  // no threadname specified, operate on thread of runnable
68  {
69  GO4TRACE((13,"TGo4CreateException::Handle() -- creating thread of runnable",__LINE__, __FILE__));
70  rev=fxRunnable->GetThread()->Create();
71  }
72  else
73  // threadname given, use thread handler to cancel
74  {
75  GO4TRACE((13,"TGo4CreateException::Handle() -- creating thread by name",__LINE__, __FILE__));
77  }
78  // note: boolean return values of called methods are implicitly casted to int
79  return rev;
80 }
81 
82 
83 
84 
TGo4ThreadException & operator=(const TGo4ThreadException &right)
TGo4CreateException & operator=(const TGo4CreateException &right)
const char * GetThreadName()
TGo4Thread * GetThread() const
Definition: TGo4Runnable.h:45
TGo4Runnable * fxRunnable
Bool_t Create(const char *thname)
Bool_t Create()
Definition: TGo4Thread.cxx:167
#define GO4TRACE(X)
Definition: TGo4Log.h:26
TGo4ThreadHandler * fxThreadHandler
TString fxDescription
Definition: TGo4Exception.h:38