BmnRoot
Loading...
Searching...
No Matches
BmnOnlineShmSource.h
Go to the documentation of this file.
1#ifndef BMN_ONLINE_SHM_SOURCE_H
2#define BMN_ONLINE_SHM_SOURCE_H
3
4#include <FairOnlineSource.h>
5#include <FairSource.h>
6#include <TClonesArray.h>
7#include <TTree.h>
8
9#include <boost/interprocess/managed_shared_memory.hpp>
10#include <boost/interprocess/sync/named_semaphore.hpp>
11#include <string>
12
13namespace bIpc = boost::interprocess;
14
15class BmnOnlineShmSource : public FairOnlineSource {
16 public:
18 virtual ~BmnOnlineShmSource();
19
20 virtual Bool_t Init();
21 virtual Int_t ReadEvent(UInt_t = 0);
22 virtual void Close();
23
26
27 private:
28 Bool_t fIsRegisterBranches;
29
30 std::string fShmName;
31 std::string fWriteSemName;
32 std::string fReadSemName;
33 std::string fMsgName;
34
35 std::unique_ptr<bIpc::managed_shared_memory> fShmSegment;
36 std::unique_ptr<bIpc::named_semaphore> fWriteSem;
37 std::unique_ptr<bIpc::named_semaphore> fReadSem;
38
39 std::unordered_map<std::string, std::unique_ptr<TClonesArray>> fRegisteredBranches;
40
41 void RegisterBranches(std::unique_ptr<TTree> &inputTree);
42 void UploadData(std::unique_ptr<TTree> &inputTree);
43
44 ClassDef(BmnOnlineShmSource, 0);
45};
46
47#endif // BMN_ONLINE_SHM_SOURCE_H
virtual Int_t ReadEvent(UInt_t=0)
BmnOnlineShmSource(const BmnOnlineShmSource &)=delete
BmnOnlineShmSource & operator=(const BmnOnlineShmSource &)=delete