GSI Object Oriented Online Offline (Go4)
GO4-6.3.0
Go4TaskHandlerExample
TGo4MainRunnable.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 "
TGo4MainRunnable.h
"
15
16
#include "
TGo4Log.h
"
17
#include "TGo4LockGuard.h"
18
#include "
TGo4Thread.h
"
19
20
#include "
TGo4CommandInvoker.h
"
21
#include "
TGo4LogicException.h
"
22
23
TGo4MainRunnable::TGo4MainRunnable
(
const
char
*name,
TGo4ExampleClient
* cli)
24
:
TGo4Runnable
(name,cli)
25
{
26
GO4TRACE
((15,
"TGo4MainRunnable::TGo4MainRunnable(const char*,TGo4ExampleClient*) constructor"
,__LINE__, __FILE__));
27
fxApplication
=cli->
GetApplication
();
28
}
29
30
TGo4MainRunnable::~TGo4MainRunnable
()
31
{
32
GO4TRACE
((15,
"TGo4MainRunnable::~TGo4MainRunnable() destructor"
,__LINE__, __FILE__));
33
}
34
35
Int_t
TGo4MainRunnable::Run
(
void
*)
36
{
37
GO4TRACE
((12,
"TGo4MainRunnable::Run()"
,__LINE__, __FILE__));
38
// first test: simply wait for command, then execute it and send back an object
39
TGo4ExampleClient
* cli=
dynamic_cast<
TGo4ExampleClient
*
>
(
fxManager
);
40
if
(!cli)
41
throw
TGo4LogicException
();
42
TGo4Command
*com = cli->
NextCommand
();
43
if
(com) {
44
TGo4LockGuard
mainlock;
// protect command invocation!
45
TGo4CommandInvoker::Instance
()->
Invoke
(com);
// execute command by invoker
46
delete
com;
47
}
48
// do "main event loop"...
49
fxApplication
->
FillHistograms
();
50
TGo4Thread::Sleep
(20);
51
return
0;
52
}
TGo4ExampleClient
Definition:
TGo4ExampleClient.h:29
TGo4LockGuard
Definition:
TGo4LockGuard.h:40
TGo4Runnable::fxManager
TGo4ThreadManager * fxManager
Definition:
TGo4Runnable.h:70
TGo4MainRunnable::fxApplication
TGo4ExampleApplication * fxApplication
Definition:
TGo4MainRunnable.h:41
TGo4Task::NextCommand
virtual TGo4Command * NextCommand()
Definition:
TGo4Task.cxx:325
TGo4Thread::Sleep
static void Sleep(UInt_t millisecs)
Definition:
TGo4Thread.cxx:295
TGo4MainRunnable::TGo4MainRunnable
TGo4MainRunnable()
TGo4CommandInvoker.h
TGo4Log.h
TGo4CommandInvoker::Instance
static TGo4CommandInvoker * Instance()
Definition:
TGo4CommandInvoker.cxx:69
TGo4Thread.h
TGo4Runnable
Definition:
TGo4Runnable.h:32
TGo4ExampleApplication::FillHistograms
void FillHistograms()
Definition:
TGo4ExampleApplication.cxx:63
TGo4CommandInvoker::Invoke
virtual void Invoke(TGo4Command *com)
Definition:
TGo4CommandInvoker.cxx:113
TGo4Command
Definition:
TGo4Command.h:35
TGo4MainRunnable::~TGo4MainRunnable
virtual ~TGo4MainRunnable()
Definition:
TGo4MainRunnable.cxx:30
TGo4LogicException
Definition:
TGo4LogicException.h:19
GO4TRACE
#define GO4TRACE(X)
Definition:
TGo4Log.h:25
TGo4ExampleClient::GetApplication
TGo4ExampleApplication * GetApplication()
Definition:
TGo4ExampleClient.cxx:94
TGo4MainRunnable::Run
Int_t Run(void *) override
Definition:
TGo4MainRunnable.cxx:35
TGo4MainRunnable.h
TGo4LogicException.h
Generated on Wed Jan 10 2024 15:04:18 for GSI Object Oriented Online Offline (Go4) by
1.8.13