CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XmasToDQM.h
Go to the documentation of this file.
1 // $Id: XmasToDQM.h,v 1.2 2008/10/23 14:36:07 vpatras Exp $
2 
3 /*************************************************************************
4  * XDAQ Components for Distributed Data Acquisition *
5  * Copyright (C) 2000-2004, CERN. *
6  * All rights reserved. *
7  * Authors: J. Gutleber and L. Orsini *
8  * *
9  * For the licensing terms see LICENSE. *
10  * For the list of contributors see CREDITS. *
11  *************************************************************************/
12 
13 #ifndef _parse_xmas2dqm_wse_Application_h_
14 #define _parse_xmas2dqm_wse_Application_h_
15 
16 #include <string>
17 #include <map>
18 
19 #include "toolbox/ActionListener.h"
20 #include "toolbox/task/AsynchronousEventDispatcher.h"
21 
22 #include "xdaq/ApplicationDescriptorImpl.h"
23 #include "xdaq/Application.h"
24 #include "xdaq/ApplicationContext.h"
25 
26 #include "xdata/String.h"
27 #include "xdata/Vector.h"
28 #include "xdata/Boolean.h"
29 #include "xdata/ActionListener.h"
30 
31 #include "xoap/MessageReference.h"
32 #include "xoap/MessageFactory.h"
33 #include "xoap/SOAPEnvelope.h"
34 #include "xoap/SOAPBody.h"
35 #include "xoap/domutils.h"
36 #include "xoap/Method.h"
37 #include "xdata/UnsignedInteger64.h"
38 
39 #include "ws/addressing/EndpointReference.h"
40 
41 #include "xgi/Method.h"
42 #include "xgi/Utils.h"
43 #include "xgi/exception/Exception.h"
44 #include "Exception.h"
45 #include "ToDqm.h"
46 
47 #include "xdaq/ContextTable.h"
48 
49 #include "xdaq/NamespaceURI.h"
50 
51 #include "toolbox/fsm/FiniteStateMachine.h"
52 #include "toolbox/fsm/FailedEvent.h"
53 
54 
55 // for the work loop and timer
56 #include "toolbox/task/WorkLoopFactory.h"
57 #include "toolbox/task/WaitingWorkLoop.h"
58 #include "toolbox/task/Timer.h"
59 #include "toolbox/task/TimerFactory.h"
60 
61 #include <curl/curl.h>
62 #include <curl/easy.h>
63 #include <fstream> // for ifstream, ofstream, ios_base
64 #include <iostream>
65 
66 //#include "DQMServices/XdaqCollector/interface/FlashlistElements.h"
67 
68 namespace xmas2dqm
69 {
70  namespace wse
71  {
72  struct MemoryStruct
73  {
74  char *memory;
75  size_t size;
76  };
77 
78  class XmasToDQM :public xdaq::Application, public toolbox::task::TimerListener, public xdata::ActionListener
79  /*,public toolbox::ActionListener,*/
80  {
81  public:
82 
84 
85  XmasToDQM(xdaq::ApplicationStub* s) throw (xdaq::exception::Exception);
86  ~XmasToDQM();
87 
88  // Callback for listening to exported parameter values
89  void actionPerformed (xdata::Event& e);
90 
91  //void actionPerformed( toolbox::Event& event );
92 
93  //
94  // XGI Interface
95  //
97 
98 
99  //
100  // SOAP interface
101  //
102 
104  xoap::MessageReference report (xoap::MessageReference msg) throw (xoap::exception::Exception);
105 
106  protected:
107 
108 
109 
110  // SOAP Callback trigger state change
111  //
112  xoap::MessageReference fireEvent (xoap::MessageReference msg)
114 
115  // SOAP Callback to reset the state machine
116  //
117  xoap::MessageReference reset (xoap::MessageReference msg)
119 
120  // Finite State Machine action callbacks
121  //
122  void ConfigureAction (toolbox::Event::Reference e)
124 
125  void EnableAction (toolbox::Event::Reference e)
127 
128  void SuspendAction (toolbox::Event::Reference e)
130 
131  void ResumeAction (toolbox::Event::Reference e)
133 
134  void HaltAction (toolbox::Event::Reference e)
136 
137  void failedTransition (toolbox::Event::Reference e)
139 
140  // Finite State Machine callback for entring state
141  //
142  void stateChanged (toolbox::fsm::FiniteStateMachine & fsm)
144 
145  bool LASReadoutWorkLoop (toolbox::task::WorkLoop* wl);
146 
147  void timeExpired (toolbox::task::TimerEvent& e);
148 
149  static void *myrealloc(void *ptr, size_t size);
150 
151  static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data);
152 
153  int getEXDR_LAS(/*xdata::Table::Reference &*/xdata::Table *rtable);
154 
155  xdata::String state_; // used to reflect the current state to the outside world
156  xdata::String LASurl_; //holds the value of the LAS URL
157  xdata::String Period_; //LAS parsing period time in seconds
158  xdata::String LASQueueSize_; //LAS parsing period time in seconds
159 
160  //xdata::Bag<xmas2dqm::wse::FlashlistElements> flashlistMonitor_;
161 
162 
163  private:
164 
165 
166  // dqm hook
168 
169  //toolbox::task::AsynchronousEventDispatcher dispatcher_;
170  //xdata::UnsignedInteger64T reportLostCounter_;
171 
172 
173  toolbox::fsm::FiniteStateMachine fsm_;
174 
175  //Working loop in the system
176  toolbox::task::WorkLoop* LASReadoutWorkLoop_ ;
177 
178  //method to be activated by the work loop
179  toolbox::task::ActionSignature* LASReadout_ ;
180 
181  toolbox::task::Timer * LASReadoutTimer_;
182  toolbox::TimeVal startLASReadout_;
183 
184 
185  };
186  }
187 }
188 #endif
void ConfigureAction(toolbox::Event::Reference e)
#define Input(cl)
Definition: vmac.h:189
xoap::MessageReference fireEvent(xoap::MessageReference msg)
Definition: XmasToDQM.cc:490
xoap::MessageReference report(xoap::MessageReference msg)
Receive metrics from a sensor.
void stateChanged(toolbox::fsm::FiniteStateMachine &fsm)
Definition: XmasToDQM.cc:611
xdata::String Period_
Definition: XmasToDQM.h:157
xdata::String LASurl_
Definition: XmasToDQM.h:156
void failedTransition(toolbox::Event::Reference e)
Definition: XmasToDQM.cc:618
void actionPerformed(xdata::Event &e)
Definition: XmasToDQM.cc:399
static void * myrealloc(void *ptr, size_t size)
Definition: XmasToDQM.cc:369
xmas2dqm::wse::ToDqm * dqmHook_
Definition: XmasToDQM.h:167
void HaltAction(toolbox::Event::Reference e)
Definition: XmasToDQM.cc:584
void SuspendAction(toolbox::Event::Reference e)
void EnableAction(toolbox::Event::Reference e)
Definition: XmasToDQM.cc:550
void ResumeAction(toolbox::Event::Reference e)
void timeExpired(toolbox::task::TimerEvent &e)
Definition: XmasToDQM.cc:356
xdata::String state_
Definition: XmasToDQM.h:155
toolbox::task::ActionSignature * LASReadout_
Definition: XmasToDQM.h:179
tuple out
Definition: dbtoconf.py:99
int getEXDR_LAS(xdata::Table *rtable)
Definition: XmasToDQM.cc:255
bool LASReadoutWorkLoop(toolbox::task::WorkLoop *wl)
Definition: XmasToDQM.cc:162
xoap::MessageReference reset(xoap::MessageReference msg)
Definition: XmasToDQM.cc:531
xdata::String LASQueueSize_
Definition: XmasToDQM.h:158
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
#define Output(cl)
Definition: vmac.h:193
toolbox::TimeVal startLASReadout_
Definition: XmasToDQM.h:182
XmasToDQM(xdaq::ApplicationStub *s)
Definition: XmasToDQM.cc:71
static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
Definition: XmasToDQM.cc:381
toolbox::task::Timer * LASReadoutTimer_
Definition: XmasToDQM.h:181
toolbox::fsm::FiniteStateMachine fsm_
Definition: XmasToDQM.h:173
void Default(xgi::Input *in, xgi::Output *out)
toolbox::task::WorkLoop * LASReadoutWorkLoop_
Definition: XmasToDQM.h:176
tuple size
Write out results.