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

/Go4TaskHandler/TGo4TaskHandlerRunnable.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 "TGo4TaskHandlerRunnable.h"
00017 
00018 #include "Go4Log/TGo4Log.h"
00019 #include "Go4Socket/TGo4Socket.h"
00020 #include "TGo4TaskHandler.h"
00021 //#include "TGo4Task.h"
00022 #include "Go4Queue/TGo4ObjectQueue.h"
00023 #include "Go4Queue/TGo4BufferQueue.h"
00024 #include "Go4ThreadManager/TGo4Thread.h"
00025 #include "Go4ThreadManager/TGo4ThreadManager.h"
00026 #include "Go4CommandsTaskHandler/Go4CommandsTaskHandler.h"
00027 
00028 TGo4TaskHandlerRunnable::TGo4TaskHandlerRunnable(const char* name, TGo4ThreadManager* man, TGo4TaskHandler* hand, Bool_t receivermode)
00029    :TGo4Runnable(name,man), fxTransport(0), fbReceiverMode(0)
00030 {
00031    fxTaskHandler=hand;
00032    fbReceiverMode=receivermode;
00033 }
00034 
00035 TGo4TaskHandlerRunnable::~TGo4TaskHandlerRunnable()
00036 {
00037 }
00038 
00039 TGo4TaskHandler* TGo4TaskHandlerRunnable::GetTaskHandler()
00040 {
00041    return fxTaskHandler;
00042 }
00043 
00044 Bool_t TGo4TaskHandlerRunnable::CheckStopBuffer(TBuffer* buf, Int_t* result)
00045 {
00046 if(buf==0) return kFALSE;
00047 //cout <<"CCCCCCCCCC CheckStopBuffer in "<< GetName() << endl;
00048 Int_t val=TGo4BufferQueue::DecodeValueBuffer(buf);
00049 if(result) *result=val;
00050 if(val<0) return kFALSE; // no valid message in buffer
00051 Go4EmergencyCommand_t comvalue= (Go4EmergencyCommand_t) (val);
00052 if(comvalue==kComCloseInput)
00053    {
00054       //cout <<"CCCCCCCCCC CheckStopBuffer has close input in "<< GetName() <<endl;
00055       GetThread()->Stop();
00056       return kTRUE;  
00057    }
00058 else
00059    {
00060       return kFALSE;  
00061    }   
00062 }
00063 
00064 Bool_t TGo4TaskHandlerRunnable::CheckTransportOpen()
00065 {
00066 Bool_t open=kTRUE;
00067 if(fxTransport==0) 
00068    open=kFALSE;
00069 else if(!fxTransport->IsOpen())
00070    open=kFALSE;
00071 else
00072    open=kTRUE;
00073 if(!open) TGo4Thread::Sleep(TGo4TaskHandler::fguPORTWAITTIME); 
00074           // avoid wild looping in Run() when socket is not open
00075 return open;
00076 }
00077 //----------------------------END OF GO4 SOURCE FILE ---------------------

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