GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ControllerRunnable.cxx
Go to the documentation of this file.
1 // $Id: TGo4ControllerRunnable.cxx 2757 2020-04-16 11:45:21Z 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 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 "TGo4ControllerRunnable.h"
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*) constructor",__LINE__, __FILE__));
27  fxServer=serv;
28 }
29 
31 {
32  GO4TRACE((15,"TGo4ControllerRunnable::~TGo4ControllerRunnable() destructor",__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
41  if(currenttask==0)
42  {
43  GO4TRACE((11,"TGo4ControllerRunnable::Run()-- no current client existing",__LINE__, __FILE__));
44  TGo4Thread::Sleep(fguCOMMANDINTERVAL); // wait before sending next command
45  // no client has connected to server so far, we do nothing!
46  }
47  else
48  {
49  GO4TRACE((11,"TGo4ControllerRunnable::Run()-- working on client's taskhandler queues",__LINE__, __FILE__));
50  // at least one client is there
51  TGo4Thread::Sleep(fguCOMMANDINTERVAL); // wait before sending next command
52  // send first command object created by controller:
53  TGo4Command* com=fxController->GetCommand(); // command from controller instance, may poll here
54  fxServer->SubmitCommand(com); // send controller command to client
55  // send second command object by name:
56  fxServer->SubmitCommand("EXAction2"); // send command by name
57  TObject* data= fxServer->NextObject(); // get data from client
58  fxController->DisplayData(data); // display data here on gui
59  }
60  return 0;
61 
62 }
static const UInt_t fguCOMMANDINTERVAL
static void Sleep(UInt_t millisecs)
Definition: TGo4Thread.cxx:335
Bool_t SubmitCommand(const char *name)
Definition: TGo4Task.cxx:423
TObject * NextObject(Bool_t wait=kTRUE)
Definition: TGo4Task.cxx:199
TGo4ExampleServer * fxServer
#define GO4TRACE(X)
Definition: TGo4Log.h:26
TGo4ExampleController * GetController()
TGo4TaskHandler * GetCurrentTaskHandler()
TGo4ExampleController * fxController