FairMQ  1.2.3
C++ Message Passing Framework
Common.h
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #ifndef FAIR_MQ_SHMEM_COMMON_H_
9 #define FAIR_MQ_SHMEM_COMMON_H_
10 
11 #include <atomic>
12 
13 #include <boost/interprocess/managed_shared_memory.hpp>
14 
15 namespace fair
16 {
17 namespace mq
18 {
19 namespace shmem
20 {
21 
23 {
24  DeviceCounter(unsigned int c)
25  : fCount(c)
26  {}
27 
28  std::atomic<unsigned int> fCount;
29 };
30 
32 {
33  RegionCounter(unsigned int c)
34  : fCount(c)
35  {}
36 
37  std::atomic<unsigned int> fCount;
38 };
39 
41 {
43  : fActive(true)
44  {}
45 
46  bool fActive;
47 };
48 
49 struct MetaHeader
50 {
51  size_t fSize;
52  size_t fRegionId;
53  boost::interprocess::managed_shared_memory::handle_t fHandle;
54  size_t fHint;
55 };
56 
58 {
59  RegionBlock()
60  : fHandle()
61  , fSize(0)
62  , fHint(0)
63  {}
64 
65  RegionBlock(boost::interprocess::managed_shared_memory::handle_t handle, size_t size, size_t hint)
66  : fHandle(handle)
67  , fSize(size)
68  , fHint(hint)
69  {}
70 
71  boost::interprocess::managed_shared_memory::handle_t fHandle;
72  size_t fSize;
73  size_t fHint;
74 };
75 
76 } // namespace shmem
77 } // namespace mq
78 } // namespace fair
79 
80 #endif /* FAIR_MQ_SHMEM_COMMON_H_ */
Definition: Common.h:40
Definition: Common.h:31
Definition: Common.h:57
Definition: Common.h:22
Definition: DeviceRunner.h:23
Definition: Common.h:49