Belle II Software  release-08-01-10
DqmMemFile.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <string>
11 
12 #include <daq/dqm/DqmSharedMem.h>
13 #include <framework/pcore/EvtMessage.h>
14 
15 #include "TMemFile.h"
16 #include "TDirectory.h"
17 
18 #define MEMFILESIZE 128000000
19 
20 namespace Belle2 {
25  class MsgHandler;
26 
27  class DqmMemFile {
28  public:
29  DqmMemFile(std::string name = "dqmhisto",
30  const std::string& mode = "readonly", int size = MEMFILESIZE);
31  DqmMemFile(int shm_id, int sem_id,
32  const std::string& mode = "readonly", int size = MEMFILESIZE);
33  ~DqmMemFile();
34 
35  // Sender function
36  TMemFile* GetMemFile();
37  int UpdateSharedMem();
38  int ClearSharedMem();
39  TMemFile* LoadMemFile();
40 
41  // Receiver functions
42  EvtMessage* StreamMemFile();
43 
44  bool SaveToFile(std::string outfile);
45 
46  private:
47  int StreamHistograms(TDirectory* curdir, MsgHandler* msg, int& nobjs);
48 
49  private:
50  DqmSharedMem* m_shm;
51  TMemFile* m_memfile;
52  char* m_buf;
53  std::string m_name;
54  int m_size;
55  bool m_writeMode;
56  };
58 }
59 
Class to manage streamed object.
Definition: EvtMessage.h:59
A class to encode/decode an EvtMessage.
Definition: MsgHandler.h:103
Abstract base class for different kinds of events.