GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4ControllerRunnable.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
15
16#include "TGo4Log.h"
17#include "TGo4Thread.h"
18#include "TGo4ExampleServer.h"
19
21
23: TGo4Runnable(name,serv)
24{
25 GO4TRACE((15,"TGo4ControllerRunnable::TGo4ControllerRunnable(const char *,TGo4ExampleServer *)",__LINE__, __FILE__));
27 fxServer = serv;
28}
29
31{
32 GO4TRACE((15,"TGo4ControllerRunnable::~TGo4ControllerRunnable()",__LINE__, __FILE__));
33}
34
36{
37 GO4TRACE((12,"TGo4ControllerRunnable::Run()",__LINE__, __FILE__));
38
39 // we have to update the queues according to the current task handler
40 TGo4TaskHandler *currenttask = fxServer->GetCurrentTaskHandler();
41 if (!currenttask) {
42 GO4TRACE((11, "TGo4ControllerRunnable::Run()-- no current client existing", __LINE__, __FILE__));
43 TGo4Thread::Sleep(fguCOMMANDINTERVAL); // wait before sending next command
44 // no client has connected to server so far, we do nothing!
45 } else {
46 GO4TRACE((11, "TGo4ControllerRunnable::Run()-- working on client's taskhandler queues", __LINE__, __FILE__));
47 // at least one client is there
48 TGo4Thread::Sleep(fguCOMMANDINTERVAL); // wait before sending next command
49 // send first command object created by controller:
50 TGo4Command *com = fxController->GetCommand(); // command from controller instance, may poll here
51 fxServer->SubmitCommand(com); // send controller command to client
52 // send second command object by name:
53 fxServer->SubmitCommand("EXAction2"); // send command by name
54 TObject *data = fxServer->NextObject(); // get data from client
55 fxController->DisplayData(data); // display data here on gui
56 }
57 return 0;
58}
#define GO4TRACE(X)
Definition TGo4Log.h:25
This is the Go4 Abstract Command Class; part of the Base command pattern.
Definition TGo4Command.h:35
TGo4ExampleController * fxController
1
Int_t Run(void *) override
The working function which runs in the thread.
static const UInt_t fguCOMMANDINTERVAL
frequency in ms to acquire new command from controller instance
example class for a server task that fits to the example application
TGo4ExampleController * GetController()
TGo4Runnable(const TGo4Runnable &right)
This class is responsible for the interconnection of two tasks: provided are three communication chan...
static void Sleep(UInt_t millisecs)
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termi...