00001 #include "DQMServices/Core/interface/DQMOldReceiver.h" 00002 #include "DQMServices/Core/interface/DQMStore.h" 00003 #include "DQMServices/Core/interface/DQMNet.h" 00004 #include <iostream> 00005 00006 // Connect with monitoring server (DQM Collector) at <hostname> and <port_no> 00007 // using <client_name>; if flag=true, will accept downstream connections 00008 DQMOldReceiver::DQMOldReceiver(const std::string &hostname, int port, 00009 const std::string &clientName, 00010 int unusedReconnectDelaySecs, 00011 bool unusedActAsServer) 00012 : store_ (DQMStore::instance()), 00013 net_ (new DQMBasicNet (clientName)), 00014 numUpdates_ (0) 00015 { 00016 net_->requestFullUpdates(true); 00017 } 00018 00019 /* Use the default constructor for running in standalone mode (ie. without 00020 sources or collectors); if flag=true, client will accept downstream connections 00021 */ 00022 DQMOldReceiver::DQMOldReceiver(void) 00023 : store_ (DQMStore::instance()), 00024 net_ (0), 00025 numUpdates_ (0) 00026 {} 00027 00028 DQMOldReceiver::~DQMOldReceiver(void) 00029 { 00030 delete net_; 00031 } 00032 00033 // this is the "main" loop where we receive monitoring/send subscription requests; 00034 // if client acts as server, method runQTests is also sending monitoring & 00035 // test results to clients downstream; 00036 // returns success flag 00037 bool 00038 DQMOldReceiver::update(void) 00039 { 00040 std::cout 00041 << " In DQMOldReceiver::update:\n" 00042 << " This method will be deprecated soon, please replace mui->update() by:\n" 00043 << " bool ret = mui->doMonitoring();\n" 00044 << " bei->runQTests();\n"; 00045 00046 // retrieval of monitoring, sending of subscription requests/cancellations, 00047 // calculation of "collate"-type Monitoring Elements; 00048 bool ret = doMonitoring(); 00049 00050 // Run quality tests (and determine updated contents); 00051 // Method is overloaded if client acts as server to other clients downstream 00052 store_->runQTests(); 00053 00054 return ret; 00055 } 00056 00057 // retrieval of monitoring, sending of subscription requests/cancellations, 00058 // returns success flag 00059 bool 00060 DQMOldReceiver::doMonitoring(void) 00061 { 00062 store_->reset(); 00063 numUpdates_ += (net_ ? net_->receive(store_) : 0); 00064 // FIXME: Invoke callbacks? 00065 return true; 00066 }