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

/Go4TaskHandlerExample/TGo4WatchRunnable.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 "TGo4WatchRunnable.h"
00017 
00018 #include "Go4Log/TGo4Log.h"
00019 #include "Go4TaskHandler/TGo4ClientStatus.h"
00020 
00021 const UInt_t TGo4WatchRunnable::fguWATCHINTERVAL=5000;
00022 
00023 TGo4WatchRunnable::TGo4WatchRunnable(const char* name, TGo4ExampleClient* cli)
00024 : TGo4Runnable(name,cli)
00025 {
00026    TRACE((15,"TGo4WatchRunnable::TGo4WatchRunnable(Text_t*,TGo4ExampleClient*) constructor",__LINE__, __FILE__));
00027    fxApplication=cli->GetApplication();
00028 }
00029 
00030 TGo4WatchRunnable::~TGo4WatchRunnable()
00031 {
00032   TRACE((15,"TGo4WatchRunnable::~TGo4WatchRunnable() destructor",__LINE__, __FILE__));
00033 
00034 }
00035 
00036 Int_t TGo4WatchRunnable::Run(void*)
00037 {
00038    TRACE((12,"TGo4WatchRunnable::Run()",__LINE__, __FILE__));
00039    TGo4ClientTask* cli= dynamic_cast<TGo4ClientTask*> (fxManager);
00040    if(cli)
00041    {
00042       cli->UpdateStatusBuffer(); // will create status object and stream it into TBuffer
00043       cli->SendStatusBuffer();   // send TBuffer with most recent client status
00044        // note: updating and sending of status buffer may be separated
00045        // into different threads. Updating aquires main mutex, sending usually
00046        // works without main mutex.
00047    if(fxApplication)
00048       {
00049          cli->SendStatusMessage(1,kTRUE,"Application %s of client %s has been watched",
00050                               fxApplication->GetName(),
00051                               cli->GetName());
00052          // method to pass text messages of priorities 0,1,2
00053          // (info, warning, error) to the server. kTRUE means additional local printout
00054       }
00055    }
00056    TGo4Thread::Sleep(fguWATCHINTERVAL); // wait for the next update
00057    return 0;
00058 }
00059 
00060 //----------------------------END OF GO4 SOURCE FILE ---------------------

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