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