Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4TaskHandlerExample/TGo4ControllerRunnable.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4ControllerRunnable.h"
00017 
00018 #include "TGo4ExampleServer.h"
00019 #include "TGo4ExampleController.h"
00020 
00021 const UInt_t TGo4ControllerRunnable::fguCOMMANDINTERVAL=10000;
00022 
00023 TGo4ControllerRunnable::TGo4ControllerRunnable(const char* name, TGo4ExampleServer* serv)
00024 : TGo4Runnable(name,serv)
00025 {
00026    TRACE((15,"TGo4ControllerRunnable::TGo4ControllerRunnable(Text_t*,TGo4ExampleServer*) constructor",__LINE__, __FILE__));
00027    fxController=serv->GetController();
00028    fxServer=serv;
00029 }
00030 
00031 TGo4ControllerRunnable::~TGo4ControllerRunnable()
00032 {
00033    TRACE((15,"TGo4ControllerRunnable::~TGo4ControllerRunnable() destructor",__LINE__, __FILE__));
00034 }
00035 
00036 Int_t TGo4ControllerRunnable::Run(void*)
00037 {
00038    TRACE((12,"TGo4ControllerRunnable::Run()",__LINE__, __FILE__));
00039 
00040    // we have to update the queues according to the current task handler
00041    TGo4TaskHandler* currenttask=fxServer->GetCurrentTaskHandler();
00042    if(currenttask==0)
00043       {
00044          TRACE((11,"TGo4ControllerRunnable::Run()-- no current client existing",__LINE__, __FILE__));
00045          TGo4Thread::Sleep(fguCOMMANDINTERVAL); // wait before sending next command
00046          // no client has connected to server so far, we do nothing!
00047       }
00048    else
00049       {
00050          TRACE((11,"TGo4ControllerRunnable::Run()-- working on client's taskhandler queues",__LINE__, __FILE__));
00051          // at least one client is there
00052          TGo4Thread::Sleep(fguCOMMANDINTERVAL); // wait before sending next command
00053          // send first command object created by controller:
00054          TGo4Command* com=fxController->GetCommand(); // command from controller instance, may poll here
00055          fxServer->SubmitCommand(com); // send controller command to client
00056          // send second command object by name:
00057          fxServer->SubmitCommand("EXAction2"); // send command by name
00058          TObject* data= fxServer->NextObject(); // get data from client
00059          fxController->DisplayData(data); // display data here on gui
00060       }
00061    return 0;
00062 
00063 }
00064 
00065 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:07 2005 for Go4-v2.10-5 by doxygen1.2.15